From 4c2be199e6f2beb59eb99d769fdfca3fac9ef8ee Mon Sep 17 00:00:00 2001 From: David Corbett Date: Sat, 16 Jul 2022 02:39:33 -0400 Subject: Update `Inform6Lexer` to Inform 6.40 (#2190) --- pygments/lexers/int_fiction.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'pygments') diff --git a/pygments/lexers/int_fiction.py b/pygments/lexers/int_fiction.py index 01ad8b7c..0e7c8180 100644 --- a/pygments/lexers/int_fiction.py +++ b/pygments/lexers/int_fiction.py @@ -175,6 +175,10 @@ class Inform6Lexer(RegexLexer): # Other values (_name, Name, '#pop') ], + 'value?': [ + include('value'), + default('#pop') + ], # Strings 'dictionary-word': [ (r'[~^]+', String.Escape), @@ -191,8 +195,8 @@ class Inform6Lexer(RegexLexer): (r'\\', String.Escape), (r'@(\\\s*[%s]\s*)*@((\\\s*[%s]\s*)*[0-9])*' % (_newline, _newline), String.Escape), - (r'@(\\\s*[%s]\s*)*\{((\\\s*[%s]\s*)*[0-9a-fA-F])*' - r'(\\\s*[%s]\s*)*\}' % (_newline, _newline, _newline), + (r'@(\\\s*[%s]\s*)*[({]((\\\s*[%s]\s*)*[0-9a-zA-Z_])*' + r'(\\\s*[%s]\s*)*[)}]' % (_newline, _newline, _newline), String.Escape), (r'@(\\\s*[%s]\s*)*.(\\\s*[%s]\s*)*.' % (_newline, _newline), String.Escape), @@ -210,6 +214,13 @@ class Inform6Lexer(RegexLexer): (_name, Name.Constant, '#pop'), include('value') ], + 'constant*': [ + include('_whitespace'), + (r',', Punctuation), + (r'=', Punctuation, 'value?'), + (_name, Name.Constant, 'value?'), + default('#pop') + ], '_global': [ include('_whitespace'), (_name, Name.Variable.Global, '#pop'), @@ -252,7 +263,7 @@ class Inform6Lexer(RegexLexer): (r'(?i)class\b', Keyword, ('object-body', 'duplicates', 'class-name')), (r'(?i)(constant|default)\b', Keyword, - ('default', 'expression', '_constant')), + ('default', 'constant*')), (r'(?i)(end\b)(.*)', bygroups(Keyword, Text)), (r'(?i)(extend|verb)\b', Keyword, 'grammar'), (r'(?i)fake_action\b', Keyword, ('default', '_constant')), -- cgit v1.2.1