nitcc_runtime :: Parser :: parse_error
Used by generated parsers
# Produce a parse error and stop the parsing
# Used by generated parsers
fun parse_error
do
var token = peek_token
#print "* parse error in state {state} on token {token}"
#print " expected: {state.error_msg}"
#print " node_stack={node_stack.join(", ")}"
#print " state_stack={state_stack.join(", ")}"
node_stack.push(token)
var error: NError
if token isa NLexerError then
error = token
else
error = new NParserError
error.position = token.position
error.text = token.text
error.token = token
end
error.error_tree.children.add_all(node_stack)
error.expected = state.error_msg
node_stack.clear
node_stack.add error
stop = true
end
lib/nitcc_runtime/nitcc_runtime.nit:72,2--96,4