pub enum Expr {
Show 14 variants Nil, True, False, VarArg, Float(FloatType), Int(IntType), String(String), Name(String), ParenExpr(Box<Expr>), FuncBody(FuncBody), Table(Table), BinExpr(BinExpr), UnExpr(UnExpr), SuffixedExpr(SuffixedExpr),
}

Variants§

§

Nil

§

True

§

False

§

VarArg

§

Float(FloatType)

§

Int(IntType)

§

String(String)

§

Name(String)

§

ParenExpr(Box<Expr>)

§

FuncBody(FuncBody)

§

Table(Table)

§

BinExpr(BinExpr)

§

UnExpr(UnExpr)

§

SuffixedExpr(SuffixedExpr)

Implementations§

Examples found in repository?
src/compiler.rs (line 230)
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
    fn adjust_assign(&mut self, num_left: usize, right_exprs: &Vec<Expr>) -> i32 {
        let extra = num_left as i32 - right_exprs.len() as i32;
        if let Some(last_expr) = right_exprs.last() {
            if last_expr.has_multi_ret() {
                // TODO : process multi return value
                todo!("process mult ret")
            }
        }

        if extra > 0 {
            let context = self.context();
            let from = context.get_reg_top();
            context.reserve_regs(extra as u32);
            context.proto.code_nil(from, extra as u32);
        }

        extra
    }
Examples found in repository?
src/parser.rs (line 377)
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
    fn exprstat(&mut self) -> ParseResult<Stat> {
        let expr = self.suffixedexpr()?;
        if self.test(TokenType::Assign) || self.test(TokenType::Comma) {
            Ok(Stat::AssignStat(self.assignment(expr.to_assignable())?))
        } else {
            Ok(Stat::CallStat(CallStat {
                call: expr.to_assignable(),
            }))
        }
    }

    // assignment -> ',' suffixedexp assignment
    // assignment -> '=' explist
    fn assignment(&mut self, first: Assignable) -> ParseResult<AssignStat> {
        let mut left: Vec<Assignable> = Vec::new();
        left.push(first);
        while self.test_next(TokenType::Comma) {
            left.push(self.suffixedexpr()?.to_assignable())
        }
        self.check_next(TokenType::Assign)?;
        self.skip_comment();
        let right = self.exprlist()?;
        Ok(AssignStat { left, right })
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.