Exemple #1
0
def p_assign_err(p):
    """
    void : expression ASSIGN
         | expression PLUS_EQUAL
         | expression MINUS_EQUAL
    """
    tell_error(p, 2, "The left-hand-side of :=/+=/-= must be a variable name, not an expression.")
    raise SyntaxError
Exemple #2
0
def p_expr_block_err(p):
    "block : '(' error ')'"
    tell_error(p, 0, "Block doesn't contain valid list of statements")
Exemple #3
0
def p_condition_err(p):
    "condition : '(' error ')'"
    tell_error(p, 0, "Condition should be a (single) expression.")
Exemple #4
0
def p_expr_err(p):
    "expression_list : expression error ','"
    tell_error(p, 0, "Error while parsing an expression.")
Exemple #5
0
def p_expr_string_err(p):
    "expression : error STRING"
    tell_error(p, 2, """Strings can't be used as expressions; they can only appear as part of $...="..." or $...+"...".""")