Skip to content
Snippets Groups Projects
Select Git revision
  • 12e3a48fb11a8bb80b10f201fb54ba2532baf72a
  • master default protected
2 results

model4.rs

Blame
  • tmp.rs 646 B
    use crust::{
        ast::Span,
        parse::{parse_assign, test},
    };
    
    fn main() {
        // test("- -1 + + 1", - -1 + 1);  // rust does not allow + as a unary op (I do ;)
        // test("(-1-1)+(-1+3)", (-1 - 1) + (-1) + 3);
        // // just to check that right associative works (you don't need to implement pow)
        // test("2+3**2**3*5+1", 2 + 3i32.pow(2u32.pow(3)) * 5 + 1);
        // test("(12*2)/3-4", (12 * 2) / 3 - 4);
        // test("1*2+3", 1 * 2 + 3);
        // // just to check that we get a parse error
        // test("1*2+3+3*21-a12+2", 1 * 2 + 3 + 3 * 21 - 12 + 2);
        test("1 + a(1, 2)", 1 + 2);
        println!("{:?}", parse_assign(Span::new("3 = 4")));
    }