improve pygments lexer to detect more text to highlight and for more consistency
This commit is contained in:
@ -46,15 +46,24 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
tokens = {
|
tokens = {
|
||||||
'root': [
|
'root': [
|
||||||
(r'fix\s+', Keyword, 'fix'),
|
(r'fix\s+', Keyword, 'fix'),
|
||||||
|
(r'fix_modify\s+', Keyword, 'modify_cmd'),
|
||||||
(r'compute\s+', Keyword, 'compute'),
|
(r'compute\s+', Keyword, 'compute'),
|
||||||
|
(r'compute_modify\s+', Keyword, 'modify_cmd'),
|
||||||
(r'dump\s+', Keyword, 'dump'),
|
(r'dump\s+', Keyword, 'dump'),
|
||||||
|
(r'dump_modify\s+', Keyword, 'modify_cmd'),
|
||||||
(r'region\s+', Keyword, 'region'),
|
(r'region\s+', Keyword, 'region'),
|
||||||
(r'^\s*variable\s+', Keyword, 'variable_cmd'),
|
(r'^\s*variable\s+', Keyword, 'variable_cmd'),
|
||||||
(r'group\s+', Keyword, 'group'),
|
(r'group\s+', Keyword, 'group'),
|
||||||
(r'change_box\s+', Keyword, 'change_box'),
|
(r'change_box\s+', Keyword, 'change_box'),
|
||||||
(r'uncompute\s+', Keyword, 'uncompute'),
|
(r'create_box\s+', Keyword, 'create_box'),
|
||||||
(r'unfix\s+', Keyword, 'unfix'),
|
(r'delete_bonds\s+', Keyword, 'id_cmd'),
|
||||||
(r'undump\s+', Keyword, 'undump'),
|
(r'displace_atoms\s+', Keyword, 'id_cmd'),
|
||||||
|
(r'dynamical_matrix\s+', Keyword, 'id_cmd'),
|
||||||
|
(r'group2ndx\s+', Keyword, 'ndx_cmd'),
|
||||||
|
(r'ndx2group\s+', Keyword, 'ndx_cmd'),
|
||||||
|
(r'uncompute\s+', Keyword, 'id_cmd'),
|
||||||
|
(r'unfix\s+', Keyword, 'id_cmd'),
|
||||||
|
(r'undump\s+', Keyword, 'id_cmd'),
|
||||||
(r'write_dump\s+', Keyword, 'write_dump'),
|
(r'write_dump\s+', Keyword, 'write_dump'),
|
||||||
include('keywords'),
|
include('keywords'),
|
||||||
(r'#.*?\n', Comment),
|
(r'#.*?\n', Comment),
|
||||||
@ -91,6 +100,10 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
('\(', Name.Variable, 'expression'),
|
('\(', Name.Variable, 'expression'),
|
||||||
('\)', Name.Variable, '#pop'),
|
('\)', Name.Variable, '#pop'),
|
||||||
],
|
],
|
||||||
|
'modify_cmd' : [
|
||||||
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
|
default('#pop')
|
||||||
|
],
|
||||||
'fix' : [
|
'fix' : [
|
||||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
(r'\s+', Whitespace, 'group_id'),
|
(r'\s+', Whitespace, 'group_id'),
|
||||||
@ -122,15 +135,16 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
default('#pop')
|
default('#pop')
|
||||||
],
|
],
|
||||||
'unfix' : [
|
'create_box' : [
|
||||||
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
|
(r'\s+', Whitespace, 'group_id'),
|
||||||
|
default('#pop')
|
||||||
|
],
|
||||||
|
'id_cmd' : [
|
||||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
default('#pop')
|
default('#pop')
|
||||||
],
|
],
|
||||||
'undump' : [
|
'ndx_cmd' : [
|
||||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
|
||||||
default('#pop')
|
|
||||||
],
|
|
||||||
'uncompute' : [
|
|
||||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||||
default('#pop')
|
default('#pop')
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user