summaryrefslogtreecommitdiffstats
path: root/venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py')
-rw-r--r--venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py b/venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py
new file mode 100644
index 00000000..c3a4a58a
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/pygments/lexers/gcodelexer.py
@@ -0,0 +1,35 @@
+"""
+ pygments.lexers.gcodelexer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for the G Code Language.
+
+ :copyright: Copyright 2006-2023 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.
+
+ .. versionadded:: 2.9
+ """
+ name = 'g-code'
+ aliases = ['gcode']
+ filenames = ['*.gcode']
+
+ 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),
+ ]
+ }