highlight if/then/elif/else everywhere, but revert for general keywords
This commit is contained in:
@ -9,8 +9,8 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify",
|
|||||||
"delete_atoms", "delete_bonds", "dielectric",
|
"delete_atoms", "delete_bonds", "dielectric",
|
||||||
"dihedral_coeff", "dihedral_style", "dihedral_write",
|
"dihedral_coeff", "dihedral_style", "dihedral_write",
|
||||||
"dimension", "displace_atoms", "dump_modify",
|
"dimension", "displace_atoms", "dump_modify",
|
||||||
"dynamical_matrix", "echo", "elif", "else", "fitpod",
|
"dynamical_matrix", "echo", "fitpod",
|
||||||
"fix_modify", "group2ndx", "hyper", "if",
|
"fix_modify", "group2ndx", "hyper",
|
||||||
"improper_coeff", "improper_style", "include",
|
"improper_coeff", "improper_style", "include",
|
||||||
"info", "jump", "kim", "kspace_modify",
|
"info", "jump", "kim", "kspace_modify",
|
||||||
"kspace_style", "label", "labelmap", "lattice",
|
"kspace_style", "label", "labelmap", "lattice",
|
||||||
@ -24,7 +24,7 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify",
|
|||||||
"read_restart", "replicate", "rerun", "reset_atoms",
|
"read_restart", "replicate", "rerun", "reset_atoms",
|
||||||
"reset_timestep", "restart", "run", "run_style",
|
"reset_timestep", "restart", "run", "run_style",
|
||||||
"server", "set", "shell", "special_bonds", "suffix",
|
"server", "set", "shell", "special_bonds", "suffix",
|
||||||
"tad", "temper", "temper/grem", "temper/npt", "then",
|
"tad", "temper", "temper/grem", "temper/npt",
|
||||||
"thermo", "thermo_modify", "thermo_style",
|
"thermo", "thermo_modify", "thermo_style",
|
||||||
"third_order", "timer", "timestep", "units",
|
"third_order", "timer", "timestep", "units",
|
||||||
"velocity", "write_coeff", "write_data",
|
"velocity", "write_coeff", "write_data",
|
||||||
@ -52,7 +52,7 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
(r'dump\s+', Keyword, 'dump'),
|
(r'dump\s+', Keyword, 'dump'),
|
||||||
(r'dump_modify\s+', Keyword, 'modify_cmd'),
|
(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'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'create_box\s+', Keyword, 'create_box'),
|
(r'create_box\s+', Keyword, 'create_box'),
|
||||||
@ -73,6 +73,7 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
(r'write_data\s+', Keyword, 'ndx_cmd'),
|
(r'write_data\s+', Keyword, 'ndx_cmd'),
|
||||||
(r'write_dump\s+', Keyword, 'write_dump'),
|
(r'write_dump\s+', Keyword, 'write_dump'),
|
||||||
(r'write_restart\s+', Keyword, 'ndx_cmd'),
|
(r'write_restart\s+', Keyword, 'ndx_cmd'),
|
||||||
|
include('conditionals'),
|
||||||
include('keywords'),
|
include('keywords'),
|
||||||
(r'#.*?\n', Comment),
|
(r'#.*?\n', Comment),
|
||||||
('"', String, 'string'),
|
('"', String, 'string'),
|
||||||
@ -87,6 +88,10 @@ class LAMMPSLexer(RegexLexer):
|
|||||||
(r'[\+\-\*\^\|\/\!%&=<>]', Operator),
|
(r'[\+\-\*\^\|\/\!%&=<>]', Operator),
|
||||||
(r'[\~\.\w_:,@\-\/\\0-9]+', Text),
|
(r'[\~\.\w_:,@\-\/\\0-9]+', Text),
|
||||||
],
|
],
|
||||||
|
'conditionals' : [
|
||||||
|
(words(('if','else','elif','then'), suffix=r'\b', prefix=r'\b'), Keyword)
|
||||||
|
]
|
||||||
|
,
|
||||||
'keywords' : [
|
'keywords' : [
|
||||||
(words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^\s*'), Keyword)
|
(words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^\s*'), Keyword)
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user