Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MagicStack/MagicPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.11
Choose a base ref
...
head repository: MagicStack/MagicPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 21, 2017

  1. 1
    Copy the full SHA
    d39070f View commit details

Commits on Aug 11, 2017

  1. Clean-up the grammar so that MagicRegExp does not have missing rules. (

    …#100)
    
    Thanks to @stoivo for noticing this issue.
    vpetrovykh authored Aug 11, 2017
    Copy the full SHA
    361a496 View commit details
  2. Update README.md. (#99)

    vpetrovykh authored Aug 11, 2017
    1
    Copy the full SHA
    dcb1a38 View commit details
  3. Highlight . in its own scope. (#101)

    The scope for `.` is `punctuation.separator.period.python`.
    vpetrovykh authored and 1st1 committed Aug 11, 2017
    1
    Copy the full SHA
    b453f26 View commit details
  4. Prepare 1.0.12 release

    1st1 committed Aug 11, 2017
    Copy the full SHA
    935abef View commit details

Commits on Jul 10, 2018

  1. 1
    Copy the full SHA
    f340032 View commit details

Commits on Jul 19, 2018

  1. Update string formatting scopes.

    Add two scopes for finer control of format highlighting:
    - meta.format.percent.python
    - meta.format.brace.python
    
    Issue #106.
    vpetrovykh committed Jul 19, 2018
    1
    Copy the full SHA
    fb56c6a View commit details
  2. Copy the full SHA
    2780782 View commit details
  3. Stop interpreting exec as a keyword.

    Issue #134.
    vpetrovykh committed Jul 19, 2018
    Copy the full SHA
    9c874c6 View commit details
  4. Fix an issue with import highlighting.

    Issue #133.
    vpetrovykh committed Jul 19, 2018
    Copy the full SHA
    7c43d1c View commit details
  5. Update the * and ** in funciton call scopes.

    Use `keyword.operator.unpacking.arguments.python` more consistently.
    
    Issue #132.
    vpetrovykh committed Jul 19, 2018
    1
    Copy the full SHA
    ad6bd62 View commit details

Commits on Sep 12, 2018

  1. Modify foldEndPattern

    Kyle Barron authored and vpetrovykh committed Sep 12, 2018
    Copy the full SHA
    cc2b832 View commit details

Commits on Oct 4, 2018

  1. Bugfix for an apparent infinite loop in grammar. (#163)

    This is a case of semantically equivalent regex not being
    computationally equivalent. The issue also relates to how negative
    character classes (e.g. `[^abc]`) are treated. In the end I had to
    replace something of the form `(A | B)*` with `A* (BA*)*` to avoid
    grinding the regex engine to a halt.
    
    Issue #150.
    vpetrovykh authored and 1st1 committed Oct 4, 2018
    Copy the full SHA
    1b72e04 View commit details
  2. Copy the full SHA
    a891320 View commit details
  3. Tokenize @ and . in decorators (#110)

    * Tokenize `@` in decorators
    
    * Tokenize periods in decorators
    chbk authored and 1st1 committed Oct 4, 2018
    Copy the full SHA
    4030374 View commit details
  4. Add support for new Python 3.7 attrs/builtins

    Fixes #151 and #126
    1st1 committed Oct 4, 2018
    Copy the full SHA
    9540297 View commit details
  5. Prepare 1.1.0 release

    1st1 committed Oct 4, 2018
    Copy the full SHA
    c8893ca View commit details
  6. package.json: deps -> dev-deps

    1st1 committed Oct 4, 2018
    Copy the full SHA
    da6fa07 View commit details

Commits on Oct 5, 2018

  1. Prepare 1.1.1 release

    1st1 committed Oct 5, 2018
    Copy the full SHA
    1417e08 View commit details

Commits on Oct 21, 2018

  1. Fix comment (#167)

    This PR adds missing part of a word in the comment.
    fjeicam authored and 1st1 committed Oct 21, 2018
    Copy the full SHA
    ea55e27 View commit details
  2. Scope from, import, and as the same way in imports. (#165)

    Use `keyword.control.import.python` scope for `from`, `import`, and `as`
    keywords when they appear as part of an import statement.
    Use `keyword.control.flow.python` scope for `from` and `as` if they
    appear elsewhere.
    
    Issue: #123.
    vpetrovykh authored and 1st1 committed Oct 21, 2018
    Copy the full SHA
    8ff35b3 View commit details

Commits on Mar 15, 2019

  1. Upgrade syntaxdev to 0.1.0

    1st1 committed Mar 15, 2019
    Copy the full SHA
    38422d3 View commit details
  2. Fix the 'make devenv' target

    1st1 committed Mar 15, 2019
    Copy the full SHA
    e57ccc1 View commit details

Commits on Oct 17, 2019

  1. Add a meta.member.access.python scope.

    Add a `meta.member.access.python` scope wrapping around any attribute
    access or method call.
    
    Fixes #188.
    vpetrovykh committed Oct 17, 2019
    Copy the full SHA
    c0f8d51 View commit details
  2. Bump syntaxdev dep

    1st1 committed Oct 17, 2019
    Copy the full SHA
    076e2bb View commit details

Commits on Oct 22, 2019

  1. Add an update-test make target.

    The `update-test` make target will automatically update the output of
    any test that failed. This kind of bulk update is intended to be used
    when the changes to scopes affect a large number of files. Of course, the
    actual updated tests should still be reviewed for correctness.
    vpetrovykh committed Oct 22, 2019
    1
    Copy the full SHA
    9d40c71 View commit details

Commits on Feb 16, 2020

  1. Copy the full SHA
    c9b3409 View commit details

Commits on Mar 31, 2020

  1. Add snakemake (#203)

    goi42 authored Mar 31, 2020
    Copy the full SHA
    0b09c1f View commit details

Commits on May 1, 2020

  1. Add some more specific scopes for member access.

    Add `meta.attribute.python` to mark otherwise non-special attributes.
    Add `meta.indexed-name.python` to mark the name of the object being
    indexed.
    
    In combination with `meta.member.access.python` the above scopes can
    help highlight member access that is no otherwise using a builtin or
    some other special case. For highlighting method names in method calls
    the combination of `meta.member.access.python` and
    `meta.function-call.generic.python` could be used.
    
    Fixes #188.
    vpetrovykh committed May 1, 2020
    Copy the full SHA
    dd48b8f View commit details
  2. Improve detection of call signature and kwargs.

    Correctly identify calls of the form "foo[123](bar=2)" to highlight the
    contents of the parentheses as call arguments.
    
    Issue: #197
    vpetrovykh committed May 1, 2020
    Copy the full SHA
    72ccccb View commit details
  3. Update the way "in" is scoped.

    The "in" keyword is scoped as either `keyword.operator.logical.python`
    or as `keyword.control.flow.python` depending on whether it appears as
    part of a "for ... in" construct.
    
    Fixes: #193
    vpetrovykh committed May 1, 2020
    1
    Copy the full SHA
    2ca894f View commit details

Commits on May 18, 2020

  1. Copy the full SHA
    b4b2e6e View commit details

Commits on Jul 31, 2020

  1. Copy the full SHA
    225fa4c View commit details
  2. Remove invalid first_line_match key

    pchaigno authored and vpetrovykh committed Jul 31, 2020
    2
    Copy the full SHA
    b2b4f4a View commit details

Commits on Nov 12, 2020

  1. Github doesn't seem to use MP for highlighter tokenization

    MagicPython is still used by Linguist, but the actual syntax
    hightlighting seems to be driven by something else now.  Thus, remove
    the outdated statement from the README.
    
    Closes: #225
    elprans authored and 1st1 committed Nov 12, 2020
    1
    Copy the full SHA
    2802ded View commit details

Commits on Oct 14, 2022

  1. Add Python 3.8 features.

    Add walrus operator `:=`.
    Add positional only args separator `/`.
    Add `=` to f-string formatting.
    
    Fixes #189
    vpetrovykh committed Oct 14, 2022
    1
    Copy the full SHA
    db32a0d View commit details
  2. Make raw f-strings consistent.

    Any f-string allows variable interpolation, that includes a raw
    f-string. Make all raw prefixes (`r` or `R`) behave the same way in
    combination with `f` prefix.
    
    Fixes #186
    vpetrovykh committed Oct 14, 2022
    1
    Copy the full SHA
    5b5f388 View commit details

Commits on Oct 19, 2022

  1. Update the syntax to Python 3.10

    Update the built-ins, dunders and add `match` and `case` keywords.
    vpetrovykh committed Oct 19, 2022
    1
    Copy the full SHA
    7d0f2b2 View commit details
Showing with 7,679 additions and 6,263 deletions.
  1. +1 −1 .gitignore
  2. +7 −2 Makefile
  3. +12 −12 README.md
  4. +326 −1,081 grammars/MagicPython.cson
  5. +606 −2,143 grammars/MagicPython.tmLanguage
  6. +23 −0 grammars/MagicRegExp.cson
  7. +50 −1 grammars/MagicRegExp.tmLanguage
  8. +199 −191 grammars/src/MagicPython.syntax.yaml
  9. +8 −9 grammars/src/comment.inc.syntax.yaml
  10. +165 −164 grammars/src/pyfstring.inc.syntax.yaml
  11. +108 −109 grammars/src/pystring.inc.syntax.yaml
  12. +112 −97 grammars/src/regexp-common.inc.syntax.yaml
  13. +156 −157 grammars/src/regexp.inc.syntax.yaml
  14. +14 −15 grammars/src/regexp.wrapper.syntax.yaml
  15. BIN icon.png
  16. +0 −23 icon.svg
  17. +11 −3 misc/example.py
  18. +8 −0 misc/scopes
  19. +13 −4 package.json
  20. +1 −1 settings/atom.cson
  21. +1 −1 snippets/sublime/Try-Except-Else-Finally.sublime-snippet
  22. +1 −1 snippets/sublime/Try-Except-Else.sublime-snippet
  23. +1 −1 snippets/sublime/Try-Except-Finally.sublime-snippet
  24. +1 −1 snippets/sublime/Try-Except.sublime-snippet
  25. +17 −0 test/atom-spec/python-re-spec.js
  26. +3,597 −1,342 test/atom-spec/python-spec.js
  27. +3 −1 test/builtins/builtins1.py
  28. +90 −78 test/builtins/builtins3.py
  29. +13 −12 test/builtins/builtins4.py
  30. +14 −10 test/builtins/builtins5.py
  31. +13 −0 test/builtins/builtins6.py
  32. +16 −0 test/builtins/builtins7.py
  33. +2 −1 test/calls/call1.py
  34. +32 −0 test/calls/call10.py
  35. +44 −0 test/calls/call11.py
  36. +12 −11 test/calls/call3.py
  37. +9 −8 test/calls/call4.py
  38. +2 −2 test/calls/call5.py
  39. +4 −4 test/calls/call6.py
  40. +33 −32 test/calls/call7.py
  41. +35 −30 test/calls/call8.py
  42. +5 −4 test/calls/print1.py
  43. +11 −10 test/classes/class11.py
  44. +12 −11 test/classes/class12.py
  45. +7 −6 test/classes/class14.py
  46. +6 −5 test/classes/class2.py
  47. +16 −0 test/classes/class9.py
  48. +32 −30 test/classes/super1.py
  49. +3 −0 test/docstrings/continuation2.py
  50. +47 −0 test/docstrings/continuation5.py
  51. +1 −1 test/docstrings/regr1.py
  52. +11 −10 test/expressions/const1.py
  53. +3 −2 test/expressions/expr10.py
  54. +8 −7 test/expressions/expr11.py
  55. +3 −2 test/expressions/expr15.py
  56. +5 −4 test/expressions/expr18.py
  57. +20 −13 test/expressions/expr19.py
  58. +39 −0 test/expressions/expr21.py
  59. +33 −0 test/expressions/expr22.py
  60. +1 −1 test/expressions/expr4.py
  61. +1 −1 test/expressions/expr5.py
  62. +7 −6 test/expressions/expr7.py
  63. +7 −5 test/expressions/keywords.py
  64. +16 −0 test/expressions/special2.py
  65. +33 −33 test/fstrings/comment4.py
  66. +19 −17 test/fstrings/empty2.py
  67. +40 −0 test/fstrings/fraw1.py
  68. +36 −0 test/fstrings/fraw2.py
  69. +36 −0 test/fstrings/fraw3.py
  70. +45 −0 test/fstrings/fraw4.py
  71. +1 −1 test/fstrings/nested1.py
  72. +3 −1 test/fstrings/nested3.py
  73. +14 −10 test/fstrings/prefixes2.py
  74. +14 −10 test/fstrings/prefixes3.py
  75. +18 −0 test/fstrings/simple10.py
  76. +3 −2 test/fstrings/simple2.py
  77. +2 −2 test/functions/async1.py
  78. +34 −0 test/functions/decl15.py
  79. +3 −1 test/functions/decl2.py
  80. +1 −1 test/functions/decl4.py
  81. +9 −9 test/functions/decorators1.py
  82. +4 −4 test/functions/decorators2.py
  83. +2 −2 test/functions/decorators3.py
  84. +5 −5 test/functions/decorators4.py
  85. +7 −7 test/functions/decorators5.py
  86. +13 −11 test/functions/decorators6.py
  87. +6 −6 test/functions/decorators7.py
  88. +1 −1 test/functions/decorators8.py
  89. +35 −0 test/functions/lambda10.py
  90. +3 −0 test/illegals/backticks3.py
  91. +8 −7 test/illegals/illegal1.py
  92. +10 −0 test/regexp/comments3.re
  93. +0 −56 test/regexp/fregexp1.py
  94. +0 −28 test/regexp/fregexp2.py
  95. +0 −28 test/regexp/fregexp3.py
  96. +0 −36 test/regexp/fregexp4.py
  97. +0 −26 test/regexp/fregexp5.py
  98. +0 −39 test/regexp/fregexp6.py
  99. +3 −0 test/regexp/python2.py
  100. +161 −160 test/regexp/python8.py
  101. +2 −1 test/statements/annotation1.py
  102. +1 −1 test/statements/for1.py
  103. +44 −0 test/statements/for2.py
  104. +38 −0 test/statements/for3.py
  105. +33 −0 test/statements/from1.py
  106. +4 −3 test/statements/import1.py
  107. +9 −3 test/statements/import2.py
  108. +4 −4 test/statements/import3.py
  109. +4 −4 test/statements/import4.py
  110. +5 −4 test/statements/import5.py
  111. +1 −1 test/statements/import6.py
  112. +20 −0 test/statements/import7.py
  113. +48 −0 test/statements/import8.py
  114. +67 −0 test/statements/import9.py
  115. +61 −0 test/statements/match1.py
  116. +112 −0 test/statements/match2.py
  117. +114 −0 test/statements/match3.py
  118. +59 −0 test/statements/match4.py
  119. +112 −0 test/statements/match5.py
  120. +53 −0 test/statements/match6.py
  121. +97 −0 test/statements/match7.py
  122. +47 −0 test/strings/bug1.py
  123. +35 −0 test/strings/bug2.py
  124. +2 −1 test/strings/bytes2.py
  125. +10 −11 test/strings/format1.py
  126. +4 −4 test/strings/format10.py
  127. +2 −2 test/strings/format11.py
  128. +2 −2 test/strings/format12.py
  129. +2 −2 test/strings/format15.py
  130. +19 −0 test/strings/format16.py
  131. +16 −15 test/strings/format2.py
  132. +7 −7 test/strings/format3.py
  133. +6 −10 test/strings/format4.py
  134. +7 −10 test/strings/format5.py
  135. +1 −1 test/strings/format6.py
  136. +2 −2 test/strings/format7.py
  137. +5 −5 test/strings/format9.py
  138. +1 −1 test/unicode/unicode1.py
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ node_modules
.DS_Store
*.cache
*.pyc

package-lock.json
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -15,11 +15,16 @@ ci-test: release
] ; \
then echo "Error: package.version != git.tag" && exit 1 ; fi

update-test:
# Run tests and overwrite the output
./node_modules/.bin/syntaxdev test --tests test/**/*.py --syntax grammars/src/MagicPython.syntax.yaml --overwrite-tests
./node_modules/.bin/syntaxdev test --tests test/**/*.re --syntax grammars/src/MagicRegExp.syntax.yaml --overwrite-tests

test: ci-test
atom -t .
atom -t test/atom-spec

devenv:
npm install syntaxdev@0.0.16
npm install --dev

release:
./node_modules/.bin/syntaxdev build-plist --in grammars/src/MagicPython.syntax.yaml --out grammars/MagicPython.tmLanguage
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,24 +3,24 @@
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
with [Sublime Text](http://www.sublimetext.com), [Atom](http://atom.io) and
[Visual Studio Code](http://code.visualstudio.com).
It is meant to be a drop-in replacement for the default Python package.
[Visual Studio Code](http://code.visualstudio.com). It is meant to be a drop-in
replacement for the default Python package.

MagicPython correctly highlights all Python 3.5 and 3.6 syntax features,
including type annotations, f-strings and regular expressions. It is built
from scratch for robustness with an extensive test suite.
**Attention VSCode users**: MagicPython is used as the _default_
Python highlighter in Visual Studio Code. Don't install it unless you
want or need the cutting edge version of it. You will likely see no
difference because you're already using MagicPython.

We are proud to say that MagicPython has been included into the
[github/linguist](https://github.com/github/linguist), a library used
by GitHub.com to process languages.
MagicPython correctly highlights all Python 3 syntax features,
including type annotations, f-strings and regular expressions. It is
built from scratch for robustness with an extensive test suite.


![](https://magicstack.github.io/MagicPython/example.png)

Type hints in comments require support by the color scheme. The one
Type hints in comments require support by the color scheme. The one
used in the screenshot is
[Chromodynamics](https://github.com/MagicStack/Chromodynamics).

![](https://magicstack.github.io/MagicPython/example.png)


## Installation Instructions

Loading