diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-01-04 15:16:01 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-01-04 15:16:01 +0100 |
commit | 867fbbd26114b70d04c5885e1447af1d8acb08df (patch) | |
tree | 61cce9391c3d7f6b30d7743e2267020d1cc70f9d | |
parent | 719fb6d1a64bceb7be139a756be46c402b17ff97 (diff) | |
download | pygments-867fbbd26114b70d04c5885e1447af1d8acb08df.tar.gz |
Small improvements to the SGF lexer.
Update CHANGES, simplify regex, regenerate mappings.
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pygments/lexers/_mapping.py | 1 | ||||
-rw-r--r-- | pygments/lexers/sgf.py | 6 |
3 files changed, 6 insertions, 2 deletions
@@ -14,6 +14,7 @@ Version 2.4.0 * FloScript (PR#750) * Hspec (PR#790) + * SGF (PR#780) * Slurm (PR#760) - Updated lexers: diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index d9894a33..fea05640 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -388,6 +388,7 @@ LEXERS = { 'SlurmBashLexer': ('pygments.lexers.shell', 'Slurm', ('slurm', 'sbatch'), ('*.sl',), ()), 'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)), 'SmalltalkLexer': ('pygments.lexers.smalltalk', 'Smalltalk', ('smalltalk', 'squeak', 'st'), ('*.st',), ('text/x-smalltalk',)), + 'SmartGameFormatLexer': ('pygments.lexers.sgf', 'SmartGameFormat', ('sgf',), ('*.sgf',), ()), 'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)), 'SnobolLexer': ('pygments.lexers.snobol', 'Snobol', ('snobol',), ('*.snobol',), ('text/x-snobol',)), 'SnowballLexer': ('pygments.lexers.dsls', 'Snowball', ('snowball',), ('*.sbl',), ()), diff --git a/pygments/lexers/sgf.py b/pygments/lexers/sgf.py index 8dd9beaa..aa934b49 100644 --- a/pygments/lexers/sgf.py +++ b/pygments/lexers/sgf.py @@ -12,6 +12,8 @@ :copyright: Copyright 2006-2018 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. + + .. versionadded:: 2.4 """ from pygments.lexer import RegexLexer, bygroups @@ -27,7 +29,7 @@ class SmartGameFormatLexer(RegexLexer): tokens = { 'root': [ - (r'([\(\):;\s])', Punctuation), + (r'[\s():;]', Punctuation), # tokens: (r'(A[BW]|AE|AN|AP|AR|AS|[BW]L|BM|[BW]R|[BW]S|[BW]T|CA|CH|CP|CR|DD|DM|DO|DT|EL|EV|EX|FF|FG|G[BW]|GC|GM|GN|HA|HO|ID|IP|IT|IY|KM|KO|L|LB|LN|LT|M|MA|MN|N|OB|OM|ON|OP|OT|OV|P[BW]|PC|PL|PM|RE|RG|RO|RU|SO|SC|SE|SI|SL|SO|SQ|ST|SU|SZ|T[BW]|TC|TE|TM|TR|UC|US|V|VW|[BW]|C)', Name.Builtin), @@ -44,7 +46,7 @@ class SmartGameFormatLexer(RegexLexer): (r'(\[)([a-z]{2})(:)([a-z]{2})(\])', bygroups(Punctuation, String, Punctuation, String, Punctuation)), - (r'(\[)([\w\s\(\)\.\-\:,\#\+\?]+)(\])', + (r'(\[)([\w\s#()+,\-.:?]+)(\])', bygroups(Punctuation, String, Punctuation)), (r'(\[)(\s.*)(\])', bygroups(Punctuation, Text, Punctuation)), |