Пример #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")
Пример #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}')"
        )
Пример #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')