Skip to content

Commit

Permalink
Fix issue
Browse files Browse the repository at this point in the history
Signed-off-by: xcgspring <[email protected]>
  • Loading branch information
xcgspring committed Dec 23, 2014
1 parent 92f3a9f commit 9255588
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions AXUI/parsing/cli_command_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def t_error(t):
LOGGER().debug("Illegal character %s in Ln: %d" % (repr(t.value[0]), t.lexer.lineno))
t.lexer.skip(1)

command_lexer = lex.lex()
cli_command_lexer = lex.lex()

##################################
#Syntactic analysis
Expand Down Expand Up @@ -77,5 +77,5 @@ def p_objects(p):
def p_error(p):
LOGGER().debug("Syntax error in input: %s, Ln: %d" % (repr(p.value), p.lineno))

command_parser = yacc.yacc(write_tables=0)
cli_command_parser = yacc.yacc(write_tables=0)

4 changes: 2 additions & 2 deletions AXUI/parsing/gui_command_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def t_error(t):
LOGGER().debug("Illegal character %s in Ln: %d" % (repr(t.value[0]), t.lexer.lineno))
t.lexer.skip(1)

command_lexer = lex.lex()
gui_command_lexer = lex.lex()

##################################
#Syntactic analysis
Expand Down Expand Up @@ -127,5 +127,5 @@ def p_number(p):
def p_error(p):
LOGGER().debug("Syntax error in input: %s, Ln: %d" % (repr(p.value), p.lineno))

command_parser = yacc.yacc(write_tables=0)
gui_command_parser = yacc.yacc(write_tables=0)

10 changes: 5 additions & 5 deletions test/test_parsing/test_cli_command_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ def setUp(self):
self.command = '''"c:\test\test 1\1.exe" {variable} parameter2'''

def test_lex(self):
from AXUI.parsing.cli_command_parsing import command_lexer
from AXUI.parsing.cli_command_parsing import cli_command_lexer

command_lexer.input(self.command)
cli_command_lexer.input(self.command)
while True:
tok = command_lexer.token()
tok = cli_command_lexer.token()
if not tok:
break
print tok

def test_yacc(self):
from AXUI.parsing.cli_command_parsing import command_lexer, command_parser
print command_parser.parse(self.command, lexer=command_lexer)
from AXUI.parsing.cli_command_parsing import cli_command_lexer, cli_command_parser
print cli_command_parser.parse(self.command, lexer=cli_command_lexer)

if __name__=="__main__":
unittest.main(verbosity=2)
Expand Down
10 changes: 5 additions & 5 deletions test/test_parsing/test_gui_command_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ def setUp(self):
self.command = '''x.y.asfas 'asf' 123 'true' true ('asdf', ('asdf', 12))'''

def test_lex(self):
from AXUI.parsing.gui_command_parsing import command_lexer
from AXUI.parsing.gui_command_parsing import gui_command_lexer

command_lexer.input(self.command)
gui_command_lexer.input(self.command)
while True:
tok = command_lexer.token()
tok = gui_command_lexer.token()
if not tok:
break
print tok

def test_yacc(self):
from AXUI.parsing.gui_command_parsing import command_lexer, command_parser
print command_parser.parse(self.command, lexer=command_lexer)
from AXUI.parsing.gui_command_parsing import gui_command_lexer, gui_command_parser
print command_parser.parse(self.command, lexer=gui_command_lexer)

if __name__=="__main__":
unittest.main(verbosity=2)
Expand Down

0 comments on commit 9255588

Please sign in to comment.