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 @@ -126,10 +126,12 @@ def next_sexp(self):
126126 # https://github.com/ejgallego/coq-serapi/issues/212
127127 MSG = "SerTop printed an empty line. Last response: {!r}."
128128 raise ValueError (MSG .format (self .last_response ))
129- self .last_response = response
130- sexp = sx .load (response )
131129 debug (response , '<< ' )
132- return sexp
130+ self .last_response = response
131+ try :
132+ return sx .load (response )
133+ except sx .ParseError :
134+ return response
133135
134136 def _send (self , sexp ):
135137 s = sx .dump ([b'query%d' % self .next_qid , sexp ])
Original file line number Diff line number Diff line change @@ -73,8 +73,14 @@ def parse(tokens):
7373 top .append (tok )
7474 return top [0 ]
7575
76+ class ParseError (Exception ):
77+ pass
78+
7679def load (bs ):
77- return parse (tokenize (bs ))
80+ try :
81+ return parse (tokenize (bs ))
82+ except IndexError :
83+ raise ParseError ()
7884
7985def unparse (sexp , buf ):
8086 stack = [sexp ]
You can’t perform that action at this time.
0 commit comments