avoid invalid escape warnings for regexp expressions with python 3.12

This commit is contained in:
Axel Kohlmeyer
2023-10-22 20:00:33 -04:00
parent 731400e004
commit e518637d63

View File

@ -76,12 +76,12 @@ class LAMMPSLexer(RegexLexer):
include('conditionals'), include('conditionals'),
include('keywords'), include('keywords'),
(r'#.*?\n', Comment), (r'#.*?\n', Comment),
('"', String, 'string'), (r'"', String, 'string'),
('\'', String, 'single_quote_string'), (r'\'', String, 'single_quote_string'),
(r'[0-9]+:[0-9]+(:[0-9]+)?', Number), (r'[0-9]+:[0-9]+(:[0-9]+)?', Number),
(r'[0-9]+(\.[0-9]+)?([eE]\-?[0-9]+)?', Number), (r'[0-9]+(\.[0-9]+)?([eE]\-?[0-9]+)?', Number),
('\$?\(', Name.Variable, 'expression'), (r'\$?\(', Name.Variable, 'expression'),
('\$\{', Name.Variable, 'variable'), (r'\$\{', Name.Variable, 'variable'),
(r'[\w_\.\[\]]+', Name), (r'[\w_\.\[\]]+', Name),
(r'\$[\w_]+', Name.Variable), (r'\$[\w_]+', Name.Variable),
(r'\s+', Whitespace), (r'\s+', Whitespace),
@ -97,21 +97,21 @@ class LAMMPSLexer(RegexLexer):
] ]
, ,
'variable' : [ 'variable' : [
('[^\}]+', Name.Variable), (r'[^\}]+', Name.Variable),
('\}', Name.Variable, '#pop'), (r'\}', Name.Variable, '#pop'),
], ],
'string' : [ 'string' : [
('[^"]+', String), (r'[^"]+', String),
('"', String, '#pop'), (r'"', String, '#pop'),
], ],
'single_quote_string' : [ 'single_quote_string' : [
('[^\']+', String), (r'[^\']+', String),
('\'', String, '#pop'), (r'\'', String, '#pop'),
], ],
'expression' : [ 'expression' : [
('[^\(\)]+', Name.Variable), (r'[^\(\)]+', Name.Variable),
('\(', Name.Variable, 'expression'), (r'\(', Name.Variable, 'expression'),
('\)', Name.Variable, '#pop'), (r'\)', Name.Variable, '#pop'),
], ],
'modify_cmd' : [ 'modify_cmd' : [
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier), (r'[\w_\-\.\[\]]+', Name.Variable.Identifier),