diff options
| author | Nick Gerner <nick.gerner@gmail.com> | 2020-08-31 07:17:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-31 16:17:38 +0200 |
| commit | 9514e794e0c2a5c7c048df97fcfef4a099e05ac3 (patch) | |
| tree | eed514306c5f7ac21d50b97853681ed43c017283 /pygments/lexers | |
| parent | bc67241664df4082af20fc30f08af8d3b5158fc8 (diff) | |
| download | pygments-git-9514e794e0c2a5c7c048df97fcfef4a099e05ac3.tar.gz | |
more explicitly define escape sequencies in JsonLexer (fix #1065) (#1528)
* more explicitly define escape sequencies in JsonLexer (fix #1065)
* adding test coverage for #1065
Diffstat (limited to 'pygments/lexers')
| -rw-r--r-- | pygments/lexers/data.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py index ebc9f708..fc8897c4 100644 --- a/pygments/lexers/data.py +++ b/pygments/lexers/data.py @@ -471,7 +471,7 @@ class JsonLexer(RegexLexer): '%(exp_part)s|%(frac_part)s)') % vars(), Number.Float), (int_part, Number.Integer), - (r'"(\\\\|\\"|[^"])*"', String.Double), + (r'"(\\(["\\/bfnrt]|u[a-fA-F0-9]]{4})|[^\\"])*"', String.Double), ], @@ -488,7 +488,7 @@ class JsonLexer(RegexLexer): # a json object - { attr, attr, ... } 'objectvalue': [ include('whitespace'), - (r'"(\\\\|\\"|[^"])*"', Name.Tag, 'objectattribute'), + (r'"(\\(["\\/bfnrt]|u[a-fA-F0-9]]{4})|[^\\"])*"', Name.Tag, 'objectattribute'), (r'\}', Punctuation, '#pop'), ], |
