diff --git a/Makefile b/Makefile index 21b1edbf..7b847f2a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: all ci-test test release devenv publish +.PHONY: all ci-test test release devenv publish install + +PACK_VER=$(shell cat package.json | grep -e '^[[:space:]]*"version":' | sed -e 's/[[:space:]]*"version":[[:space:]]*"\(.*\)",/\1/') all: devenv release @@ -9,11 +11,10 @@ ci-test: release # Check if the version specified in "package.json" matches the latest git tag @if [ \ - `cat package.json | grep -e '^[[:space:]]*"version":' | sed -e 's/[[:space:]]*"version":[[:space:]]*"\(.*\)",/\1/'` \ + $(PACK_VER) \ != \ `git describe --tags --abbrev=0 | sed -e 's/v\([[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\).*/\1/'` \ ] ; \ - then echo "Error: package.version != git.tag" && exit 1 ; fi update-test: # Run tests and overwrite the output @@ -24,7 +25,8 @@ test: ci-test atom -t test/atom-spec devenv: - npm install --dev + npm install --include=dev + npm install -g vsce release: ./node_modules/.bin/syntaxdev build-plist --in grammars/src/MagicPython.syntax.yaml --out grammars/MagicPython.tmLanguage @@ -38,6 +40,10 @@ release: ./node_modules/.bin/syntaxdev atom-spec --package-name MagicPython --tests test/**/*.py --syntax grammars/src/MagicPython.syntax.yaml --out test/atom-spec/python-spec.js ./node_modules/.bin/syntaxdev atom-spec --package-name MagicPython --tests test/**/*.re --syntax grammars/src/MagicRegExp.syntax.yaml --out test/atom-spec/python-re-spec.js +install: + vsce package + code --install-extension MagicPython-$(PACK_VER).vsix + publish: test apm publish patch rm -rf ./node_modules/syntaxdev diff --git a/README.md b/README.md index 64d9eb43..d4bb835c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Magic Python [![Build Status](https://travis-ci.org/MagicStack/MagicPython.svg?branch=master)](https://travis-ci.org/MagicStack/MagicPython) [![apm](https://img.shields.io/apm/dm/magicpython.svg?label=Atom)](https://atom.io/packages/magicpython) [![Package Control](https://img.shields.io/packagecontrol/dt/MagicPython.svg?label=Sublime%20Text)](https://packagecontrol.io/packages/MagicPython) [![VSM](https://vsmarketplacebadge.apphb.com/installs-short/magicstack.MagicPython.svg?subject=Visual%20Studio%20Code)](https://marketplace.visualstudio.com/items?itemName=magicstack.MagicPython) +# Magic Python (yupp enabled mod) [![Build Status](https://travis-ci.org/MagicStack/MagicPython.svg?branch=master)](https://travis-ci.org/MagicStack/MagicPython) [![apm](https://img.shields.io/apm/dm/magicpython.svg?label=Atom)](https://atom.io/packages/magicpython) [![Package Control](https://img.shields.io/packagecontrol/dt/MagicPython.svg?label=Sublime%20Text)](https://packagecontrol.io/packages/MagicPython) [![VSM](https://vsmarketplacebadge.apphb.com/installs-short/magicstack.MagicPython.svg?subject=Visual%20Studio%20Code)](https://marketplace.visualstudio.com/items?itemName=magicstack.MagicPython) This is a package with preferences and syntax highlighter for cutting edge Python 3, although Python 2 is well supported, too. The syntax is compatible diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 6486dba4..aaee0f2d 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -19,6 +19,7 @@ fileTypes: [ "Snakefile" "smk" "tac" + "yu-py" ] firstLineMatch: "^#![ \\t]*/.*\\bpython[\\d\\.]*\\b" uuid: "742deb57-6e38-4192-bed6-410746efd85d" @@ -394,6 +395,15 @@ repository: { include: "#comments" } + { + include: "#yupp-comment" + } + { + include: "#yupp-quoted" + } + { + include: "#yupp-application" + } { include: "#expression-bare" } @@ -5012,3 +5022,41 @@ repository: match: "(\\w)" } ] + "yupp-comment": + name: "comment.yupp" + begin: "\\(\\$\\!" + end: "\\)" + patterns: [ + { + include: "#yupp-comment-parentheses-eater" + } + ] + "yupp-comment-parentheses-eater": + begin: "\\(" + end: "\\)" + patterns: [ + { + include: "#yupp-comment-parentheses-eater" + } + ] + "yupp-quoted": + name: "string.yupp" + begin: "\\(\\$(macro|code|quote|`)" + beginCaptures: + "1": + name: "keyword.yupp" + end: "\\)" + patterns: [ + { + include: "#yupp-comment-parentheses-eater" + } + ] + "yupp-application": + name: "source.yupp" + begin: "\\(\\$" + end: "\\)" + patterns: [ + { + include: "#yupp-comment-parentheses-eater" + } + ] diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 5a07f545..52c219e6 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -26,6 +26,7 @@ Snakefile smk tac + yu-py firstLineMatch ^#![ \t]*/.*\bpython[\d\.]*\b @@ -591,6 +592,18 @@ it's probably control flow like: include #comments + + include + #yupp-comment + + + include + #yupp-quoted + + + include + #yupp-application + include #expression-bare @@ -8739,6 +8752,76 @@ indirectly through syntactic constructs + yupp-comment + + name + comment.yupp + begin + \(\$\! + end + \) + patterns + + + include + #yupp-comment-parentheses-eater + + + + yupp-comment-parentheses-eater + + begin + \( + end + \) + patterns + + + include + #yupp-comment-parentheses-eater + + + + yupp-quoted + + name + string.yupp + begin + \(\$(macro|code|quote|`) + beginCaptures + + 1 + + name + keyword.yupp + + + end + \) + patterns + + + include + #yupp-comment-parentheses-eater + + + + yupp-application + + name + source.yupp + begin + \(\$ + end + \) + patterns + + + include + #yupp-comment-parentheses-eater + + + diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 9c80c8b3..1b0beb4e 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -4,7 +4,7 @@ scopeName: source.python # NOTE: remember to update package.json with VSCode file types. fileTypes: [py, py3, rpy, pyw, cpy, pyi, SConstruct, Sconstruct, sconstruct, SConscript, - gyp, gypi, wsgi, kv, Snakefile, smk, tac] + gyp, gypi, wsgi, kv, Snakefile, smk, tac, yu-py] firstLineMatch: ^#![ \t]*/.*\bpython[\d\.]*\b uuid: 742deb57-6e38-4192-bed6-410746efd85d @@ -205,6 +205,8 @@ repository: fguard: "" guard: "" + - file: 'yupp.inc.syntax.yaml' + impossible: comment: This is a special rule that should be used where no match @@ -423,6 +425,9 @@ repository: comment: valid Python expressions with comments and line continuation patterns: - include: '#comments' + - include: '#yupp-comment' + - include: '#yupp-quoted' + - include: '#yupp-application' - include: '#expression-bare' - include: '#line-continuation' diff --git a/grammars/src/yupp.inc.syntax.yaml b/grammars/src/yupp.inc.syntax.yaml new file mode 100644 index 00000000..766e2524 --- /dev/null +++ b/grammars/src/yupp.inc.syntax.yaml @@ -0,0 +1,30 @@ +--- +yupp-comment: + name: comment.yupp + begin: \(\$\! + end: \) + patterns: + - include: '#yupp-comment-parentheses-eater' + +yupp-comment-parentheses-eater: + begin: \( + end: \) + patterns: + - include: '#yupp-comment-parentheses-eater' + +yupp-quoted: + name: string.yupp + begin: \(\$(macro|code|quote|`) + beginCaptures: + '1': {name: keyword.yupp} + end: \) + patterns: + - include: '#yupp-comment-parentheses-eater' + +yupp-application: + name: source.yupp + begin: \(\$ + end: \) + patterns: + - include: '#yupp-comment-parentheses-eater' +... diff --git a/misc/scopes b/misc/scopes index 12785af1..948fee82 100644 --- a/misc/scopes +++ b/misc/scopes @@ -5,6 +5,7 @@ comment.typehint.ignore.notation.python comment.typehint.punctuation.notation.python comment.typehint.type.notation.python comment.typehint.variable.notation.python +comment.yupp constant.character.escape.python constant.character.escape.regexp constant.character.format.placeholder.other.python @@ -60,6 +61,7 @@ keyword.operator.python keyword.operator.quantifier.regexp keyword.operator.unpacking.arguments.python keyword.operator.unpacking.parameter.python +keyword.yupp meta.attribute.python meta.backreference.named.regexp meta.backreference.regexp @@ -128,6 +130,7 @@ punctuation.separator.inheritance.python punctuation.separator.parameters.python punctuation.separator.period.python punctuation.separator.slice.python +source.yupp storage.modifier.declaration.python storage.modifier.flag.regexp storage.type.class.python @@ -153,6 +156,7 @@ string.quoted.raw.single.python string.quoted.single.python string.regexp.quoted.multi.python string.regexp.quoted.single.python +string.yupp support.function.builtin.python support.function.magic.python support.other.escape.special.regexp diff --git a/package.json b/package.json index a974bd74..e1d5f3ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.1.1", + "version": "1.1.2", "engines": { "atom": "*", "node": "*", @@ -8,12 +8,12 @@ }, "repository": { "type": "git", - "url": "https://github.com/MagicStack/MagicPython.git" + "url": "https://github.com/in4lio/MagicPython.git" }, "bugs": { "url": "https://github.com/MagicStack/MagicPython/issues" }, - "description": "Syntax highlighter for cutting edge Python.", + "description": "Syntax highlighter for cutting edge Python (yupp enabled mod).", "license": "MIT", "publisher": "magicstack", "categories": [ @@ -23,7 +23,8 @@ "python", "highlighter", "syntax", - "python3" + "python3", + "yupp" ], "icon": "icon.png", "galleryBanner": { @@ -59,7 +60,8 @@ ".kv", "Snakefile", ".smk", - ".tac" + ".tac", + ".yu-py" ] } ], @@ -72,8 +74,7 @@ ] }, "devDependencies": { - "oniguruma": "^7.0.0", + "oniguruma": "^7.2.1", "syntaxdev": "^0.1.3" - }, - "dependencies": {} + } }