Exemplo n.º 1
0
		public override void PostWalk(VarInitialization node) { }
Exemplo n.º 2
0
 public VarDeclaration(VarInitialization[] vars)
 {
     _vars = vars;
 }
Exemplo n.º 3
0
		// VarInitialization
		public override bool Walk(VarInitialization node) { return false; }
Exemplo n.º 4
0
		public virtual void PostWalk(VarInitialization node) { }
Exemplo n.º 5
0
		// VarInitialization
		public virtual bool Walk(VarInitialization node) { return true; }
Exemplo n.º 6
0
        private Stmt ParseVarDeclaration()
        {
            Eat(TokenType.KeywordVar);
            int gstart = GetStart();
            List<VarInitialization> vars = new List<VarInitialization>();
            do
            {
                int start = GetStart();
                NameToken t = NextToken() as NameToken;
                Expr initValue = null;
                if (t == null)
                {
                    ReportSyntaxError("Expected NameToken.");
                    break;
                }

                if (MaybeEat(TokenType.Assign))
                {
                    initValue = ParseExpr();
                }

                VarInitialization v = new VarInitialization(t.Name, initValue);
                v.SetLoc(_globalParent, start, GetEnd());
                vars.Add(v);
            } while (MaybeEat(TokenType.Comma));

            VarDeclaration decl = new VarDeclaration(vars.ToArray());
            decl.SetLoc(_globalParent, gstart, GetEnd());

            EatSemiOrInteractiveEndOfFile();
            return decl;
        }
		// VarInitialization
		public override bool Walk(VarInitialization node)
		{
			node.Parent = _currentScope;
			node.Variable = DefineVariable(node.Name);

			return base.Walk(node);
		}