void variable(out Compiler.IfVariable variable) { Scanner.ignore_space = false; while (la.kind == 4) { Get(); } Expect(3); variable = Context.GetVariable( t.val ); while (la.kind == 6 || la.kind == 42 || la.kind == 43) { if (la.kind == 42) { instance_member(); } else if (la.kind == 43) { class_member(); } else { struct_field(); } } if (la.kind == 7) { Get(); Expect(1); } if (la.kind == 40) { Get(); Expect(1); Expect(41); } while (la.kind == 4) { Get(); } Scanner.ignore_space = true; }
void value(out Compiler.IfValue value) { value = null; IfVariable var=null; if (la.kind == 1 || la.kind == 2) { literal(out value); } else if (la.kind == 3 || la.kind == 4) { variable(out var); value = var; } else SynErr(56); }
void term(out Compiler.IfExpression e) { string op; IfExpression e2; e=null; factor(out e); while (la.kind == 8 || la.kind == 9) { multiply(out op); factor(out e2); e = new BinaryExpression(e, op, e2); } }
void literal(out Compiler.IfValue value) { value = null; if (la.kind == 2) { Get(); value = new Compiler.StringLiteral( t.val.Substring(1,t.val.Length-2) ); } else if (la.kind == 1) { Get(); value = new Compiler.IntegerLiteral( Convert.ToInt32( t.val) ); } else SynErr(57); }
void factor(out Compiler.IfExpression e) { Compiler.IfValue val; e=null; if (StartOf(6)) { value(out val); e = new ExpressionLeaf( val ); } else if (la.kind == 40) { Get(); expression(out e); Expect(41); } else SynErr(60); }
void expression(out Compiler.IfExpression e) { e=null; string op; IfExpression e2; if (la.kind == 6) { Get(); term(out e2); e = new UnaryExpression ("-", e2 ); } else if (StartOf(5)) { term(out e); } else SynErr(58); while (la.kind == 6 || la.kind == 7) { addition(out op); term(out e2); e = new BinaryExpression(e, op, e2); } }