diff --git a/setup.py b/setup.py index be91625..d673963 100644 --- a/setup.py +++ b/setup.py @@ -13,12 +13,23 @@ if sys.platform == "win32": base = "Win32GUI" -files = {"include_files": [ + +build_options = { + "include_files": [ "./images", "./templates", "./config.cfg", + "./readme.md", ], - } + "excludes": [ + "tkinter", + "test", + "http", + "email", + "distutils" + ], + "optimize": 2, + } setup( name='Joystick Diagrams', @@ -38,6 +49,6 @@ 'Source': 'https://github.com/Rexeh/joystick-diagrams/src', }, - options={'build_exe': files}, + options={'build_exe': build_options}, executables = [Executable("./src/joystick_diagrams.py", base = base, icon = './images/logo.ico')] ) diff --git a/src/adaptors/dcs_world.py b/src/adaptors/dcs_world.py index 09ce191..295268f 100644 --- a/src/adaptors/dcs_world.py +++ b/src/adaptors/dcs_world.py @@ -6,6 +6,8 @@ import ply.yacc as yacc import functions.helper as helper import adaptors.joystick_diagram_interface as jdi +import adaptors.dcs_world_lex # Do not remove - PLY production requirement +import adaptors.dcs_world_parse # Do not remove - PLY production requirement class DCSWorld_Parser(jdi.JDinterface): @@ -203,7 +205,7 @@ def p_error(t): ## TODO: Consider env vars to run optimize=1 in deployed version lexer = lex.lex( debug=False, - optimize=0, + optimize=1, lextab='dcs_world_lex', reflags=re.UNICODE | re.VERBOSE ) @@ -211,6 +213,7 @@ def p_error(t): # Build the parser parser = yacc.yacc( debug=False, + optimize=1, tabmodule='dcs_world_parse' ) @@ -218,6 +221,5 @@ def p_error(t): try: data = parser.parse(self.file) except Exception as error: - print(data) - + print(error) return data \ No newline at end of file diff --git a/src/adaptors/dcs_world_lex.py b/src/adaptors/dcs_world_lex.py new file mode 100644 index 0000000..c2fa0e3 --- /dev/null +++ b/src/adaptors/dcs_world_lex.py @@ -0,0 +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'} +_lexstateeoff = {} diff --git a/src/adaptors/dcs_world_parse.py b/src/adaptors/dcs_world_parse.py index 12a958b..0e474a8 100644 --- a/src/adaptors/dcs_world_parse.py +++ b/src/adaptors/dcs_world_parse.py @@ -27,17 +27,17 @@ del _lr_goto_items _lr_productions = [ ("S' -> dict","S'",1,None,None,None), - ('dict -> LCURLY dvalues RCURLY','dict',3,'p_dict','dcs_world.py',171), - ('dvalues -> dvalue','dvalues',1,'p_dvalues','dcs_world.py',175), - ('dvalues -> dvalue COMMA','dvalues',2,'p_dvalues','dcs_world.py',176), - ('dvalues -> dvalue COMMA dvalues','dvalues',3,'p_dvalues','dcs_world.py',177), - ('key -> LBRACE NUMBER RBRACE','key',3,'p_key_expression','dcs_world.py',183), - ('key -> LBRACE STRING RBRACE','key',3,'p_key_expression','dcs_world.py',184), - ('dvalue -> key EQUALS STRING','dvalue',3,'p_value_expression','dcs_world.py',188), - ('dvalue -> key EQUALS boolean','dvalue',3,'p_value_expression','dcs_world.py',189), - ('dvalue -> key EQUALS DOUBLE_VAL','dvalue',3,'p_value_expression','dcs_world.py',190), - ('dvalue -> key EQUALS NUMBER','dvalue',3,'p_value_expression','dcs_world.py',191), - ('dvalue -> key EQUALS dict','dvalue',3,'p_value_expression','dcs_world.py',192), - ('boolean -> TRUE','boolean',1,'p_boolean','dcs_world.py',196), - ('boolean -> FALSE','boolean',1,'p_boolean','dcs_world.py',197), + ('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), ]