statement : ID LP expr RP EQ expr
168269
def p_substr_assignment_no_let(p):
    
    # This can be only a substr assignment like a$(i + 3) = ".", since arrays
    # have ARRAY_ID already
    entry = SYMBOL_TABLE.access_call(p[1], p.lineno(1))
    if entry is None:
        return

    if entry.class_ == CLASS.unknown:
        entry.class_ = CLASS.var

    if p[6].type_ != TYPE.string:
        api.errmsg.syntax_error_expected_string(p.lineno(5), p[6].type_)

    lineno = p.lineno(2)
    base = make_number(OPTIONS.string_base.value, lineno, _TYPE(gl.STR_INDEX_TYPE))
    substr = make_typecast(_TYPE(gl.STR_INDEX_TYPE), p[3], lineno)
    p[0] = make_sentence('LETSUBSTR', entry,
                         make_binary(lineno, 'MINUS', substr, base, func=lambda x, y: x - y),
                         make_binary(lineno, 'MINUS', substr, base, func=lambda x, y: x - y),
                         p[6])
1216379
def p_exprs(p):
    
    if len(p) == 2:
        p[0] = node.expr_list([p[1]])
    elif len(p) == 4:
        p[0] = p[1]
        p[0].append(p[3])
    else:
        assert (0)
    assert isinstance(p[0], node.expr_list)
845739
def eq(self, other):
        """"""
        other_node = self.box(other).node
        return _expr(exprnode.eq(self.node, other_node))
186780
def p_statements_statement(p):
    
    if len(p) == 2:
        p[0] = make_block(p[1])
    else:
        p[0] = make_block(p[1], p[2])
967496
def p_statement_do_while(p):
    ''
    p[0] = ast.DoWhile(p[2], p[5], lineno=p.lineno(1))
512610
Expr assign() {
		Tok idTok = peek();
		if (idTok.sym != Sym.ID) {
			return ternary();
		}
		
		int begin = forward;
		// ID = expr
		if (move().sym == Sym.ASSIGN) {
			move();
			return new Assign(idTok.value(), expr(), location);
		}
		
		// array、map 赋值：ID [ expr ] = expr
		if (peek().sym == Sym.LBRACK) {
			move();
			Expr index = expr();
			match(Sym.RBRACK);
			if (peek().sym == Sym.ASSIGN) {
				move();
				return new Assign(idTok.value(), index, expr(), location);	// 右结合无限连
			}
		}
		
		resetForward(begin);
		return ternary();
	}
438555
def p_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = self.asttypes.Comma(left=p[1], right=p[3])
            p[0].setpos(p, 2)
387293
def p_statement(self, p):
        
        p[0] = ['statement', p[1][0], p[1][1]]

        if self.options.get('lowercasenames'):
            p[0][1] = p[0][1].lower()

        if (not self.options.get('nostripvalues') and
                not hasattr(p[0][2], 'is_single_quoted') and
                not hasattr(p[0][2], 'is_double_quoted')):
            p[0][2] = p[0][2].rstrip()
1306150
def p_expression_eq(self, p):
        ''
        p[0] = Eq(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
14820
Expr ternary() {
		Expr cond = or();
		if (peek().sym == Sym.QUESTION) {
			move();
			Expr exprOne = expr();
			match(Sym.COLON);
			return new Ternary(cond, exprOne, expr(), location);
		}
		return cond;
	}
768414
def p_for_statement(self, p):
        ''
        p[0] = ForStatement(p[3], p[4], p[5], p[7], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
591410
def arithm_expr_parse(line):
    
    vals = []
    ops = []
    for tok in line + [';']:
        if tok in priority:  # tok is an operator
            while (tok != '(' and ops and
                   priority[ops[-1]] >= priority[tok]):
                right = vals.pop()
                left = vals.pop()
                vals.append((left, ops.pop(), right))
            if tok == ')':
                ops.pop()    # this is the corresponding '('
            else:
                ops.append(tok)
        elif tok.isdigit():  # tok is an integer
            vals.append(int(tok))
        else:                # tok is an identifier
            vals.append(tok)
    return vals.pop()
882271
def p_expression(tok):
        """"""
        if len(tok) == 4:
            tok[0] = LogicalBinOpRule(tok[2], tok[1], tok[3])
        else:
            tok[0] = tok[1]
573628
def p_exprlt(p):
    
    a = int(p[1]) if p[1].isdigit() else 0
    b = int(p[3]) if p[3].isdigit() else 0

    p[0] = '1' if a < b else '0'
946688
def p_lexpr(p):
    
    global LET_ASSIGNMENT

    LET_ASSIGNMENT = True  # Mark we're about to start a LET sentence

    if p[1] == 'LET':
        p[0] = p[2]
        i = 2
    else:
        p[0] = p[1]
        i = 1

    SYMBOL_TABLE.access_id(p[i], p.lineno(i))
254561
def p_statement_randomize_expr(p):
    
    p[0] = make_sentence('RANDOMIZE', make_typecast(TYPE.ulong, p[2], p.lineno(1)))
964384
def p_expr_list(self, p):
        ''''''
        if len(p) == 4:
            p[1].append(p[3])
            p[0] = p[1]
        elif len(p) == 2:
            p[0] = [p[1]]