diff --git a/src/joystick_diagrams/adaptors/dcs_world.py b/src/joystick_diagrams/adaptors/dcs_world.py index c98c5cb..f41d2ec 100644 --- a/src/joystick_diagrams/adaptors/dcs_world.py +++ b/src/joystick_diagrams/adaptors/dcs_world.py @@ -6,8 +6,8 @@ import logging from shutil import ExecError from ply import lex, yacc -import joystick_diagrams.adaptors.dcs_world_lex # pylint: disable=unused-import -import joystick_diagrams.adaptors.dcs_world_parse # pylint: disable=unused-import +#import joystick_diagrams.adaptors.dcs_world_lex # pylint: disable=unused-import +#import joystick_diagrams.adaptors.dcs_world_parse # pylint: disable=unused-import import joystick_diagrams.adaptors.joystick_diagram_interface as jdi _logger = logging.getLogger(__name__) @@ -202,7 +202,7 @@ def t_NUMBER(t): # pylint: disable=invalid-name return t def t_STRING(t): # pylint: disable=invalid-name - r"\"[\w|\/|\(|\)|\-|\:|\+|\,|\&|\.|\'|\s]+\" " + r"\"[\w|\/|\(|\)|\-|\:|\+|\,|\&|\.|\'|\<|\>|\s]+\" " t.value = t.value[1:-1] return t @@ -267,7 +267,7 @@ def p_error(t): # pylint: disable=invalid-name ) # Build the parser - parser = yacc.yacc(debug=False, optimize=1, tabmodule="dcs_world_parse") + parser = yacc.yacc(debug=False, optimize=1, tabmodule="dcs_world_yacc") # Parse the data try: diff --git a/src/joystick_diagrams/adaptors/dcs_world_lex.py b/src/joystick_diagrams/adaptors/dcs_world_lex.py index 61ae8e6..1209132 100644 --- a/src/joystick_diagrams/adaptors/dcs_world_lex.py +++ b/src/joystick_diagrams/adaptors/dcs_world_lex.py @@ -1,47 +1,10 @@ # dcs_world_lex.py. This file automatically created by PLY (version 3.11). Don't edit! -_tabversion = "3.10" -_lextokens = set( - ( - "COMMA", - "DOUBLE_VAL", - "EQUALS", - "FALSE", - "LBRACE", - "LCURLY", - "NUMBER", - "RBRACE", - "RCURLY", - "STRING", - "TRUE", - ) -) -_lexreflags = 96 -_lexliterals = "" -_lexstateinfo = {"INITIAL": "inclusive"} -_lexstatere = { - "INITIAL": [ - ( - '(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\s]+\\")|(?P(true))|(?P(false))|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', - [ - None, - ("t_DOUBLE_VAL", "DOUBLE_VAL"), - None, - ("t_NUMBER", "NUMBER"), - ("t_STRING", "STRING"), - ("t_TRUE", "TRUE"), - None, - ("t_FALSE", "FALSE"), - None, - (None, "LCURLY"), - (None, "RCURLY"), - (None, "LBRACE"), - (None, "RBRACE"), - (None, "COMMA"), - (None, "EQUALS"), - ], - ) - ] -} -_lexstateignore = {"INITIAL": " \t\n"} -_lexstateerrorf = {"INITIAL": "t_error"} +_tabversion = '3.10' +_lextokens = set(('COMMA', 'DOUBLE_VAL', 'EQUALS', 'FALSE', 'LBRACE', 'LCURLY', 'NUMBER', 'RBRACE', 'RCURLY', 'STRING', 'TRUE')) +_lexreflags = 96 +_lexliterals = '' +_lexstateinfo = {'INITIAL': 'inclusive'} +_lexstatere = {'INITIAL': [('(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\<|\\>|\\s]+\\" )|(?P(true))|(?P(false))|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', [None, ('t_DOUBLE_VAL', 'DOUBLE_VAL'), None, ('t_NUMBER', 'NUMBER'), ('t_STRING', 'STRING'), ('t_TRUE', 'TRUE'), None, ('t_FALSE', 'FALSE'), None, (None, 'LCURLY'), (None, 'RCURLY'), (None, 'LBRACE'), (None, 'RBRACE'), (None, 'COMMA'), (None, 'EQUALS')])]} +_lexstateignore = {'INITIAL': ' \t\n'} +_lexstateerrorf = {'INITIAL': 't_error'} _lexstateeoff = {} diff --git a/src/joystick_diagrams/adaptors/dcs_world_parse.py b/src/joystick_diagrams/adaptors/dcs_world_parse.py deleted file mode 100644 index 9f51fd3..0000000 --- a/src/joystick_diagrams/adaptors/dcs_world_parse.py +++ /dev/null @@ -1,279 +0,0 @@ -# dcs_world_parse.py -# This file is automatically generated. Do not edit. -# pylint: disable=W,C,R -_tabversion = "3.10" - -_lr_method = "LALR" - -_lr_signature = "COMMA DOUBLE_VAL EQUALS FALSE LBRACE LCURLY NUMBER RBRACE RCURLY STRING TRUEdict : LCURLY dvalues RCURLYdvalues : dvalue\n | dvalue COMMA\n | dvalue COMMA dvalueskey : LBRACE NUMBER RBRACE\n | LBRACE STRING RBRACE dvalue : key EQUALS STRING\n | key EQUALS boolean\n | key EQUALS DOUBLE_VAL\n | key EQUALS NUMBER\n | key EQUALS dict boolean : TRUE\n | FALSE\n " - -_lr_action_items = { - "LCURLY": ( - [ - 0, - 9, - ], - [ - 2, - 2, - ], - ), - "$end": ( - [ - 1, - 7, - ], - [ - 0, - -1, - ], - ), - "LBRACE": ( - [ - 2, - 8, - ], - [ - 6, - 6, - ], - ), - "RCURLY": ( - [ - 3, - 4, - 7, - 8, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - ], - [ - 7, - -2, - -1, - -3, - -4, - -7, - -8, - -9, - -10, - -11, - -12, - -13, - ], - ), - "COMMA": ( - [ - 4, - 7, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - ], - [ - 8, - -1, - -7, - -8, - -9, - -10, - -11, - -12, - -13, - ], - ), - "EQUALS": ( - [ - 5, - 20, - 21, - ], - [ - 9, - -5, - -6, - ], - ), - "NUMBER": ( - [ - 6, - 9, - ], - [ - 10, - 16, - ], - ), - "STRING": ( - [ - 6, - 9, - ], - [ - 11, - 13, - ], - ), - "DOUBLE_VAL": ( - [ - 9, - ], - [ - 15, - ], - ), - "TRUE": ( - [ - 9, - ], - [ - 18, - ], - ), - "FALSE": ( - [ - 9, - ], - [ - 19, - ], - ), - "RBRACE": ( - [ - 10, - 11, - ], - [ - 20, - 21, - ], - ), -} - -_lr_action = {} -for _k, _v in _lr_action_items.items(): - for _x, _y in zip(_v[0], _v[1]): - if not _x in _lr_action: - _lr_action[_x] = {} - _lr_action[_x][_k] = _y -del _lr_action_items - -_lr_goto_items = { - "dict": ( - [ - 0, - 9, - ], - [ - 1, - 17, - ], - ), - "dvalues": ( - [ - 2, - 8, - ], - [ - 3, - 12, - ], - ), - "dvalue": ( - [ - 2, - 8, - ], - [ - 4, - 4, - ], - ), - "key": ( - [ - 2, - 8, - ], - [ - 5, - 5, - ], - ), - "boolean": ( - [ - 9, - ], - [ - 14, - ], - ), -} - -_lr_goto = {} -for _k, _v in _lr_goto_items.items(): - for _x, _y in zip(_v[0], _v[1]): - if not _x in _lr_goto: - _lr_goto[_x] = {} - _lr_goto[_x][_k] = _y -del _lr_goto_items -_lr_productions = [ - ("S' -> dict", "S'", 1, None, None, None), - ("dict -> LCURLY dvalues RCURLY", "dict", 3, "p_dict", "dcs_world.py", 170), - ("dvalues -> dvalue", "dvalues", 1, "p_dvalues", "dcs_world.py", 174), - ("dvalues -> dvalue COMMA", "dvalues", 2, "p_dvalues", "dcs_world.py", 175), - ("dvalues -> dvalue COMMA dvalues", "dvalues", 3, "p_dvalues", "dcs_world.py", 176), - ("key -> LBRACE NUMBER RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 182), - ("key -> LBRACE STRING RBRACE", "key", 3, "p_key_expression", "dcs_world.py", 183), - ( - "dvalue -> key EQUALS STRING", - "dvalue", - 3, - "p_value_expression", - "dcs_world.py", - 187, - ), - ( - "dvalue -> key EQUALS boolean", - "dvalue", - 3, - "p_value_expression", - "dcs_world.py", - 188, - ), - ( - "dvalue -> key EQUALS DOUBLE_VAL", - "dvalue", - 3, - "p_value_expression", - "dcs_world.py", - 189, - ), - ( - "dvalue -> key EQUALS NUMBER", - "dvalue", - 3, - "p_value_expression", - "dcs_world.py", - 190, - ), - ( - "dvalue -> key EQUALS dict", - "dvalue", - 3, - "p_value_expression", - "dcs_world.py", - 191, - ), - ("boolean -> TRUE", "boolean", 1, "p_boolean", "dcs_world.py", 195), - ("boolean -> FALSE", "boolean", 1, "p_boolean", "dcs_world.py", 196), -] diff --git a/src/joystick_diagrams/adaptors/dcs_world_yacc.py b/src/joystick_diagrams/adaptors/dcs_world_yacc.py new file mode 100644 index 0000000..a2d37e1 --- /dev/null +++ b/src/joystick_diagrams/adaptors/dcs_world_yacc.py @@ -0,0 +1,43 @@ + +# dcs_world_yacc.py +# This file is automatically generated. Do not edit. +# pylint: disable=W,C,R +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'COMMA DOUBLE_VAL EQUALS FALSE LBRACE LCURLY NUMBER RBRACE RCURLY STRING TRUEdict : LCURLY dvalues RCURLYdvalues : dvalue\n | dvalue COMMA\n | dvalue COMMA dvalueskey : LBRACE NUMBER RBRACE\n | LBRACE STRING RBRACEdvalue : key EQUALS STRING\n | key EQUALS boolean\n | key EQUALS DOUBLE_VAL\n | key EQUALS NUMBER\n | key EQUALS dictboolean : TRUE\n | FALSE\n ' + +_lr_action_items = {'LCURLY':([0,9,],[2,2,]),'$end':([1,7,],[0,-1,]),'LBRACE':([2,8,],[6,6,]),'RCURLY':([3,4,7,8,12,13,14,15,16,17,18,19,],[7,-2,-1,-3,-4,-7,-8,-9,-10,-11,-12,-13,]),'COMMA':([4,7,13,14,15,16,17,18,19,],[8,-1,-7,-8,-9,-10,-11,-12,-13,]),'EQUALS':([5,20,21,],[9,-5,-6,]),'NUMBER':([6,9,],[10,16,]),'STRING':([6,9,],[11,13,]),'DOUBLE_VAL':([9,],[15,]),'TRUE':([9,],[18,]),'FALSE':([9,],[19,]),'RBRACE':([10,11,],[20,21,]),} + +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items + +_lr_goto_items = {'dict':([0,9,],[1,17,]),'dvalues':([2,8,],[3,12,]),'dvalue':([2,8,],[4,4,]),'key':([2,8,],[5,5,]),'boolean':([9,],[14,]),} + +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +_lr_productions = [ + ("S' -> dict","S'",1,None,None,None), + ('dict -> LCURLY dvalues RCURLY','dict',3,'p_dict','dcs_world.py',228), + ('dvalues -> dvalue','dvalues',1,'p_dvalues','dcs_world.py',232), + ('dvalues -> dvalue COMMA','dvalues',2,'p_dvalues','dcs_world.py',233), + ('dvalues -> dvalue COMMA dvalues','dvalues',3,'p_dvalues','dcs_world.py',234), + ('key -> LBRACE NUMBER RBRACE','key',3,'p_key_expression','dcs_world.py',240), + ('key -> LBRACE STRING RBRACE','key',3,'p_key_expression','dcs_world.py',241), + ('dvalue -> key EQUALS STRING','dvalue',3,'p_value_expression','dcs_world.py',245), + ('dvalue -> key EQUALS boolean','dvalue',3,'p_value_expression','dcs_world.py',246), + ('dvalue -> key EQUALS DOUBLE_VAL','dvalue',3,'p_value_expression','dcs_world.py',247), + ('dvalue -> key EQUALS NUMBER','dvalue',3,'p_value_expression','dcs_world.py',248), + ('dvalue -> key EQUALS dict','dvalue',3,'p_value_expression','dcs_world.py',249), + ('boolean -> TRUE','boolean',1,'p_boolean','dcs_world.py',253), + ('boolean -> FALSE','boolean',1,'p_boolean','dcs_world.py',254), +]