File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ def parse(tokens):
4747 if len (semantics .context ) > 10 :
4848 semantics .context .pop (0 )
4949 parser .feed (token )
50- if semantics .failed or semantics .errors :
51- raise BQLParseError ('\n ' .join (semantics .errors ))
50+ if semantics .errors :
51+ raise BQLParseError (semantics .errors )
52+ if semantics .failed :
53+ raise BQLParseError (['parse failed mysteriously' ])
5254 assert semantics .phrases is not None
5355 return semantics .phrases
5456
@@ -83,6 +85,8 @@ def parse_failed(self):
8385
8486 def syntax_error (self , (token , text )):
8587 if token == - 1 : # error
88+ self .errors .append ('Bad token: %r' % (text ,))
89+ else :
8690 self .errors .append ("Syntax error near [%s] after [%s]" % (
8791 text , ' ' .join ([str (t ) for (_t , t ) in self .context [:- 1 ]])))
8892
Original file line number Diff line number Diff line change @@ -51,8 +51,10 @@ def parse(tokenses):
5151 if len (semantics .context ) > 10 :
5252 semantics .context .pop (0 )
5353 parser .feed (token )
54- if semantics .failed or semantics .errors :
55- raise BQLParseError ('\n ' .join (semantics .errors ))
54+ if semantics .errors :
55+ raise BQLParseError (semantics .errors )
56+ if semantics .failed :
57+ raise BQLParseError (['parse failed mysteriously' ])
5658 assert semantics .schema is not None
5759 return semantics .schema
5860
@@ -108,6 +110,8 @@ def parse_failed(self):
108110
109111 def syntax_error (self , (token , text )):
110112 if token == - 1 : # error
113+ self .errors .append ('Bad token: %r' % (text ,))
114+ else :
111115 self .errors .append ("Syntax error near [%s] after [%s]" % (
112116 text , ' ' .join ([str (t ) for (_t , t ) in self .context [:- 1 ]])))
113117
You can’t perform that action at this time.
0 commit comments