You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Block comments can end with a special character (any of |&?;) but if you put anything after the special character it crashes with
Traceback (most recent call last):
File "env/bin/sdp", line 8, in <module>
sys.exit(main())
File "env/lib/python3.9/site-packages/simple_ddl_parser/cli.py", line 75, in main
run_for_file(args)
File "env/lib/python3.9/site-packages/simple_ddl_parser/cli.py", line 44, in run_for_file
result = parse_from_file(
File "env/lib/python3.9/site-packages/simple_ddl_parser/ddl_parser.py", line 232, in parse_from_file
return DDLParser(df.read()).run(file_path=file_path, **kwargs)
File "env/lib/python3.9/site-packages/simple_ddl_parser/parser.py", line 302, in run
self.tables = self.parse_data()
File "env/lib/python3.9/site-packages/simple_ddl_parser/parser.py", line 215, in parse_data
self.process_line(num != len(lines) - 1)
File "env/lib/python3.9/site-packages/simple_ddl_parser/parser.py", line 245, in process_line
self.process_statement()
File "env/lib/python3.9/site-packages/simple_ddl_parser/parser.py", line 249, in process_statement
self.parse_statement()
File "env/lib/python3.9/site-packages/simple_ddl_parser/parser.py", line 257, in parse_statement
_parse_result = yacc.parse(self.statement)
File "env/lib/python3.9/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "env/lib/python3.9/site-packages/ply/yacc.py", line 1063, in parseopt_notrack
lookahead = get_token() # Get the next token
File "env/lib/python3.9/site-packages/ply/lex.py", line 386, in token
newtok = self.lexerrorf(tok)
File "env/lib/python3.9/site-packages/simple_ddl_parser/ddl_parser.py", line 222, in t_error
raise DDLParserError("Unknown symbol %r" % (t.value[0],))
simple_ddl_parser.ddl_parser.DDLParserError: Unknown symbol '|'
To Reproduce
Steps to reproduce the behavior:
Succeeds:
/*
xyz|
*/
CREATE TABLE `test` (
`id` INT NOT NULL AUTO_INCREMENT
);
Fails:
/*
|xyz
*/
CREATE TABLE `test` (
`id` INT NOT NULL AUTO_INCREMENT
);
Expected behavior
Position of |&?; characters within a block comment should not affect whether the file parses or not
Additional context
Python v3.9.6
sdp v0.27.0
ply v3.11
The text was updated successfully, but these errors were encountered:
Describe the bug
Block comments can end with a special character (any of
|&?;
) but if you put anything after the special character it crashes withTo Reproduce
Steps to reproduce the behavior:
Succeeds:
Fails:
Expected behavior
Position of
|&?;
characters within a block comment should not affect whether the file parses or notAdditional context
The text was updated successfully, but these errors were encountered: