def p_error(p):
if not p:
print("End of file.")
return
if p.type == 'EOF':
if ZCClex.lexer.lexer.curlyBalance > 0:
parser.errok()
return lex.LexToken(
'RCURCLYBRACKET',
'}',
p.lexer.lineno,
p.lexer.lexpos)
else:
return
print("Syntax error at %r, at line: %d, column: %d." % (
p.value, p.lexer.lineno, ZCClex.find_column(p.lexer.lexdata, p)))
if p.type == 'IDENTIFIER':
print("Undefined Type " + p.value[1])
if parser.errorCounter > 0:
print("In panic mode\n")
while True:
tok = parser.token()
if not tok or tok.type == 'SEMICOLON' or tok.type == 'RCURLYBRACKET':
break
parser.restart()
else:
parser.errorCounter += 1
return p
评论列表
文章目录