Exemplo n.º 1
0
def p_error(p):
    if p:
        print("Syntax error at line {0}, column {1}: LexToken({2}, '{3}')".
              format(p.lineno, scanner.find_tok_column(line, p), p.type,
                     p.value))
    else:
        print("Unexpected end of input")
Exemplo n.º 2
0
def p_error(p):
    if p is None:
        print('Unexpected end of input')
    else:
        column = find_tok_column(p)
        print(
            f"Syntax error at line {p.lineno}, column {column}: LexToken({p.type}, '{p.value}')"
        )
Exemplo n.º 3
0
def p_error(p):
    if p:
        print('Syntax error at line {0}, column {1}: LexToken({2}, \'{3}\')'.format(
            p.lexer.lineno, scanner.find_tok_column(p), p.type, p.value))
    else:
        print('Unexpected end of input')