second commit
This commit is contained in:
35
env/lib/python3.11/site-packages/pygments/lexers/gcodelexer.py
vendored
Normal file
35
env/lib/python3.11/site-packages/pygments/lexers/gcodelexer.py
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"""
|
||||
pygments.lexers.gcodelexer
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Lexers for the G Code Language.
|
||||
|
||||
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from pygments.lexer import RegexLexer, bygroups
|
||||
from pygments.token import Comment, Name, Text, Keyword, Number
|
||||
|
||||
__all__ = ['GcodeLexer']
|
||||
|
||||
|
||||
class GcodeLexer(RegexLexer):
|
||||
"""
|
||||
For gcode source code.
|
||||
"""
|
||||
name = 'g-code'
|
||||
aliases = ['gcode']
|
||||
filenames = ['*.gcode']
|
||||
url = 'https://en.wikipedia.org/wiki/G-code'
|
||||
version_added = '2.9'
|
||||
|
||||
tokens = {
|
||||
'root': [
|
||||
(r';.*\n', Comment),
|
||||
(r'^[gmGM]\d{1,4}\s', Name.Builtin), # M or G commands
|
||||
(r'([^gGmM])([+-]?\d*[.]?\d+)', bygroups(Keyword, Number)),
|
||||
(r'\s', Text.Whitespace),
|
||||
(r'.*\n', Text),
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user