From acd323167ddbceb54c867902ff3ab1db5babd618 Mon Sep 17 00:00:00 2001 From: Fabrice Salvaire Date: Sun, 23 Dec 2018 20:48:05 +0100 Subject: [PATCH] cleanup --- PythonicGcodeMachine/Gcode/Rs274/Lexer.py | 10 ++++++++-- PythonicGcodeMachine/Gcode/Rs274/Parser.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PythonicGcodeMachine/Gcode/Rs274/Lexer.py b/PythonicGcodeMachine/Gcode/Rs274/Lexer.py index ab888cd..a161d87 100644 --- a/PythonicGcodeMachine/Gcode/Rs274/Lexer.py +++ b/PythonicGcodeMachine/Gcode/Rs274/Lexer.py @@ -78,10 +78,12 @@ class GcodeLexer: 'TANGENT', 'TIMES', + # 'LETTER', 'A', 'B', 'C', 'D', - 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'P', 'Q', 'R', 'S', 'T', 'X', 'Y', 'Z', + 'N', 'POSITIVE_INTEGER', 'POSITIVE_REAL', @@ -121,6 +123,9 @@ class GcodeLexer: t_TANGENT = r'tan' t_TIMES = r'\*' + # clash with acos ... ??? + # t_LETTER = r'(' + '|'.join('abcd' + 'fghijklm' + 'pqrst' + 'xyz') + ')' + t_A = r'a' T_B = r'b' t_C = r'c' @@ -134,7 +139,6 @@ class GcodeLexer: t_K = r'k' t_L = r'l' t_M = r'm' - t_N = r'n' t_P = r'p' t_Q = r'q' @@ -146,6 +150,8 @@ class GcodeLexer: t_Y = r'y' t_Z = r'z' + t_N = r'n' + # def t_POSITIVE_INTEGER(self, t): # r'\d+' # t.value = int(t.value) diff --git a/PythonicGcodeMachine/Gcode/Rs274/Parser.py b/PythonicGcodeMachine/Gcode/Rs274/Parser.py index 2b4378e..7d47cad 100644 --- a/PythonicGcodeMachine/Gcode/Rs274/Parser.py +++ b/PythonicGcodeMachine/Gcode/Rs274/Parser.py @@ -174,6 +174,7 @@ class GcodeParser: p[0] = Ast.Word(p[1], p[2]) def p_mid_line_letter(self, p): + # LETTER '''mid_line_letter : A | B | C -- GitLab