Exemple #1
0
        public FarmDataRoot(BlockNode.BLOCK_NAME block_name, BufferNode.BUFFER_NAME buffer_name)
        {
            Guid = Guid.NewGuid();

            Block = new BlockNode(block_name);

            Buffer = new BufferNode(buffer_name);

            TempValueNode = new ValueNode();
        }
Exemple #2
0
        public FarmDataRoot()
        {
            Guid = Guid.NewGuid();

            Block = new BlockNode();

            Buffer = new BufferNode();

            TempValueNode = new ValueNode();
        }
Exemple #3
0
        public void VisitProgram(BlockNode prog)
        {
            this.depth = 0;
            string spaces = HandleDepth();

            this.io.WriteLine($"{spaces}Program: (");
            string spaces2 = IncreaseDepth();

            this.io.WriteLine($"{spaces2}Statements: [");
            VisitStatements(prog);
            this.io.WriteLine($"{spaces2}]");
            this.io.WriteLine($"{spaces})");
        }
        public List <BlockNode> GetGroupControlChildren(BlockNode parent)
        {
            var gcChildren = new List <BlockNode>();

            foreach (var child in parent.Children)
            {
                if (child.Name.Kind.TypeName == GroupControlTemplateName)
                {
                    gcChildren.Add(child);
                }
            }
            return(gcChildren);
        }
        public override void VisitBlockNode(BlockNode bl)
        {
            Node parent = st.Pop();

            st.Push(parent);
            if (bl != null)
            {
                bl.Parent = parent;
            }
            st.Push(bl);
            base.VisitBlockNode(bl);
            st.Pop();
        }
Exemple #6
0
        private Node If()
        {
            // IF! condition block else?
            SourcePosition pos       = Match(TokenType.IF).Position;
            Node           test      = Condition();
            BlockNode      thenBlock = Block();
            Node           elseBlock = null;

            if (LookAhead(1) == TokenType.ELSE)
            {
                elseBlock = Else();
            }
            return(new IfNode(pos, test, thenBlock, elseBlock));
        }
        public void Apply_Move45Depth1_ShouldApplyALock()
        {
            var field = Field.Create(0, 0, 0, @"
				..........
				..X......."                );

            var actual = BlockNode.Apply(field, 1, new ApplyParameters(new MT19937Generator())
            {
                Round = 45
            });

            FieldAssert.AreEqual(@"
				..X......."                , 0, 0, 0, actual);
        }
Exemple #8
0
        private IEnumerable <ControlState> GetSubtreeStatesImpl(BlockNode node)
        {
            var childstates = node.Children?.SelectMany(child => GetSubtreeStatesImpl(child)) ?? Enumerable.Empty <ControlState>();

            if (!_editorStateStore.TryGetControlState(node.Name.Identifier, out var state))
            {
                return(childstates);
            }

            return(childstates.Concat(new List <ControlState>()
            {
                state
            }));
        }
        public override Node VisitBlock(BlockContext context)
        {
            _blockDepth++;

            var blockNode = new BlockNode(context.Start, _blockDepth);

            foreach (StatementContext x in context.statement())
            {
                blockNode.AddChild(Visit(x));
            }

            _blockDepth--;
            return(blockNode);
        }
Exemple #10
0
        private ExpressionNode Evaluate(BlockNode node, Context context)
        {
            ExpressionNode result = new ExpressionNode()
            {
                Context = context
            };

            foreach (var exp in node.Code)
            {
                result = Evaluate((dynamic)exp, context);
            }

            return(result);
        }
        private void AddComponentDefaults(BlockNode topParent, Dictionary<string, ControlTemplate> templateDefaults)
        {
            var type = topParent.Name.Kind.TypeName;
            if (!_templateStore.TryGetTemplate(type, out var template) || !(template.IsComponentTemplate ?? false))
                return;

            var componentTemplate = new ControlTemplate(type, "", "");

            foreach (var prop in topParent.Properties)
            {
                componentTemplate.InputDefaults.Add(prop.Identifier, prop.Expression.Expression);
            }
            templateDefaults.Add(type, componentTemplate);
        }
Exemple #12
0
        protected virtual BlockArgumentNode ParseBlockArgument(BlockNode parent, SpecialCharacterToken colon)
        {
            // PARSE: <block argument> ::= ':' identifier
            Token token = this.GetNextTokenxx(Preference.Default);

            if (!(token is IdentifierToken))
            {
                this.ReportParserError(parent, SemanticErrors.MissingBlockArgument, token);
                this.ResidueToken = token;
                // NB: BlockArgumentNode must be able to handle null for argument name token.
                return(new BlockArgumentNode(parent, colon, null));
            }
            return(new BlockArgumentNode(parent, colon, (IdentifierToken)token));
        }
Exemple #13
0
 public override void VisitBlockNode(BlockNode bl)
 {
     if (bl == null)
     {
         return;
     }
     foreach (var st in bl.StList)
     {
         if (st != null)
         {
             st.Visit(this);
         }
     }
 }
Exemple #14
0
 private void GetFuncsFromTree(BlockNode tree, ref List <FunctionDefinitionNode> funcs)
 {
     foreach (Node child in tree.Children)
     {
         if (child is FunctionDefinitionNode funcDef)
         {
             funcs.Add(funcDef);
         }
         else if (child is BlockNode block)
         {
             GetFuncsFromTree(block, ref funcs);
         }
     }
 }
        public override ASTN VisitBlock([NotNull] BlockContext context)
        {
            BlockNode node = new BlockNode(context)
            {
                ExprBlock = new List <ExprNode>()
            };

            foreach (var expr in context.expr())
            {
                node.ExprBlock.Add(VisitExpr(expr) as ExprNode);
            }

            return(node);
        }
Exemple #16
0
        public void CanGetRequirementsFromBlockNode()
        {
            var node = new BlockNode();

            node.Init(s_DescriptorB);

            var iMayRequireNormals = node as IMayRequireNormal;

            Assert.IsNotNull(iMayRequireNormals);

            var neededCoordinateSpace = iMayRequireNormals.RequiresNormal(ShaderStageCapability.Fragment);

            Assert.AreEqual(NeededCoordinateSpace.World, neededCoordinateSpace);
        }
Exemple #17
0
        public void Should_throw_with_empty_blocks(BlockNode emptyBlock)
        {
            var model    = new { X = true };
            var template = SyntaxTree.Block(
                SyntaxTree.Conditional(
                    SyntaxTreeExpression.Property(model.GetType(), "X"),
                    emptyBlock,
                    emptyBlock
                    ));

            Assert.Throws <VeilCompilerException>(() =>
            {
                this.ExecuteTemplate(template, model);
            });
        }
Exemple #18
0
 public override void VisitBlockNode(BlockNode bl)
 {
     Console.WriteLine(Tag + " VisitBlockNode");
     if (bl == null)
     {
         return;
     }
     foreach (var st in bl.StList)
     {
         if (st != null)
         {
             st.Visit(this);
         }
     }
 }
 public IEnumerable <string> Transform(BlockNode item)
 {
     Scopes.Root.AddBlock(item.Name, item.BlockContents);
     if (ShouldRender)
     {
         Scopes.Root.CurrentBlockName  = item.Name;
         Scopes.Root.CurrentBlockIndex = 0;
         var containerNode = Scopes.Root.GetBlock(item.Name) ?? item.BlockContents;
         foreach (var output in containerNode.Transform(this))
         {
             yield return(output);
         }
         Scopes.Root.CurrentBlockName = null;
     }
 }
Exemple #20
0
 private Node blockExpansion()
 {
     if (peek() is Colon)
     {
         Token token = expect(typeof(Colon))
         ;
         Colon     colon     = (Colon)token;
         BlockNode blockNode = new BlockNode();
         blockNode.setLineNumber(colon.getLineNumber());
         blockNode.setFileName(filename);
         blockNode.getNodes().AddLast(parseExpr());
         return(blockNode);
     }
     return(block());
 }
Exemple #21
0
        private void AddControlStates(BlockNode root, EditorStateStore stateStore)
        {
            foreach (var child in root.Children)
            {
                AddControlStates(child, stateStore);
            }

            var name = root.Name.Identifier;

            // If the state exists, add to merged document
            if (ControlStates.TryGetValue(name, out var state))
            {
                stateStore.TryAddControl(state);
            }
        }
 public override void Visit(BlockNode node)
 {
     PrettyPrintNewLine();
     CSharpString.Append("{");
     IndentationLevel++;
     PrettyPrintNewLine();
     foreach (StmtNode stmt in node.StmtNodes)
     {
         stmt.Accept(this);
     }
     IndentationLevel--;
     PrettyPrintNewLine();
     CSharpString.Append("}");
     PrettyPrintNewLine();
 }
Exemple #23
0
 public override void Visit(BlockNode node)
 {
     WriteIndent();
     ProgramBuilder.Append('{');
     NewLine();
     IncreaseIndent();
     foreach (var s in node.StList)
     {
         s.Visit(this);
     }
     DecreaseIndent();
     WriteIndent();
     ProgramBuilder.Append('}');
     NewLine();
 }
Exemple #24
0
    void refreshBlock(BlockNode block)
    {
        int x = (int)block.coord.x;
        int y = (int)block.coord.y;
        int z = (int)block.coord.z;

        if (block.BlockType != 0)
        {
            InformationHolder holder = new InformationHolder();
            holder.cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            holder.cube.transform.position = Vector3.zero;
            createObjectMesh(holder, MapData [x, y, z].BlockType, MapData [x, y, z].coord);
            Destroy(holder.cube.GetComponent <BoxCollider> ());
        }
    }
Exemple #25
0
        public void CanAddBlockNodeToContext()
        {
            GraphData graph = new GraphData();

            graph.AddContexts();

            var node = new BlockNode();

            node.Init(s_DescriptorA);
            graph.AddBlock(node, graph.fragmentContext, 0);

            Assert.AreEqual(0, graph.edges.Count());
            Assert.AreEqual(1, graph.GetNodes <BlockNode>().Count());
            Assert.AreEqual(1, graph.fragmentContext.blocks.Count());
        }
Exemple #26
0
        public static void Optimize(BlockNode block)
        {
            while (PropagateConstants(block) || RemoveUnusedVariables(block) || TransformToIncDec(block))
            {
            }

            foreach (var child in block.GetChildren())
            {
                if (child is IfNode ifnode)
                {
                    Optimize(ifnode.IfTrue);
                    Optimize(ifnode.IfFalse);
                }
            }
        }
Exemple #27
0
        public TetrisGrid(int width, int height)
        {
            Width  = width;
            Height = height;

            mAllNodes = new BlockNode[width, height];

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    mAllNodes[i, j] = new BlockNode(i, j);
                }
            }
        }
Exemple #28
0
        public BlockScope CollectIdentifiers(BlockNode block)
        {
            DeclaringScope declaringScope = DeclaringScope.MethodLike;

            if (block.Parent is ClassTypeDeclerationNode)
            {
                declaringScope = DeclaringScope.ClassLike;
            }

            ListDictionary <string, TypeInformation> scope = new ListDictionary <string, TypeInformation>();

            foreach (var child in block)
            {
                if (child.Type == NodeType.VariableDecleration)
                {
                    VariableDeclerationNode variableNode = (VariableDeclerationNode)child;
                    foreach (var decleration in variableNode.Declerations)
                    {
                        string name = decleration.Identifier.Name;
                        scope.Add(name,
                                  new TypeInformation(
                                      variableNode.DeclerationType.ActualType,
                                      variableNode.ProtectionLevel,
                                      decleration.Interval.a,
                                      declaringScope));
                    }
                }
                else if (child.Type == NodeType.MethodDecleration)
                {
                    MethodDeclerationNode methodNode = (MethodDeclerationNode)child;
                    string name = methodNode.Identifier.Value;
                    scope.Add(name,
                              new TypeInformation(
                                  methodNode.MethodSignature.ActualType,
                                  methodNode.ProtectionLevel,
                                  methodNode.Interval.a,
                                  declaringScope));
                }
            }

            ConcurrentDictionary <string, TypeInformation[]> newscope = new ConcurrentDictionary <string, TypeInformation[]>(_scopeDictionary);

            foreach (KeyValuePair <string, List <TypeInformation> > pair in scope)
            {
                newscope.TryAdd(pair.Key, pair.Value.ToArray());
            }
            return(new BlockScope(newscope, _classes));
        }
        public void BeforeWrite(BlockNode node, bool inResponsiveContext)
        {
            var controlName  = node.Name.Identifier;
            var templateName = node.Name.Kind.TypeName;
            var variantName  = node.Name.Kind.OptionalVariant;

            var styleName = $"default{templateName.FirstCharToUpper()}Style";

            HashSet <string> propNames = null;

            if (_controlStore.TryGetControlState(controlName, out var controlState))
            {
                styleName = controlState.StyleName;
                propNames = new HashSet <string>(controlState.Properties.Select(state => state.PropertyName)
                                                 .Concat(controlState.DynamicProperties?.Select(state => state.PropertyName) ?? Enumerable.Empty <string>()));
            }

            ControlTemplate template;

            if (!_templateStore.TryGetValue(templateName, out template))
            {
                template = null;
            }

            var defaults = new DefaultRuleHelper(styleName, template, templateName, variantName, _theme, inResponsiveContext).GetDefaultRules();

            foreach (var property in node.Properties)
            {
                defaults.Remove(property.Identifier);
            }

            foreach (var defaultkvp in defaults)
            {
                if (propNames != null && !propNames.Contains(defaultkvp.Key))
                {
                    continue;
                }

                node.Properties.Add(new PropertyNode
                {
                    Identifier = defaultkvp.Key,
                    Expression = new ExpressionNode
                    {
                        Expression = defaultkvp.Value
                    }
                });
            }
        }
            public void Visit(BlockNode node)
            {
                // Ignore test templates here. 
                // Test templates have control-like syntax, but allowed to repeat names:
                //    Step4 As TestStep:
                if (AppTestTransform.IsTestSuite(node.Name.Kind.TypeName))
                {
                    return;
                }

                this.Visit(node.Name);
                foreach(var child in node.Children )
                {
                    this.Visit(child);
                }
            }
Exemple #31
0
        public void CanCreateSlotFromCustomSlotBlockDescriptor()
        {
            var node = new BlockNode();

            node.Init(s_CustomSlotDescriptor);
            List <MaterialSlot> slots = new List <MaterialSlot>();

            node.GetSlots(slots);

            Assert.IsNotNull(slots);
            Assert.AreEqual(1, slots.Count);
            Assert.AreNotEqual(s_MaterialSlot, slots[0]); //We actually WANT to create a new slot in this case
            Assert.AreEqual(s_MaterialSlot.displayName, slots[0].displayName);
            Assert.AreEqual(s_MaterialSlot.valueType, slots[0].valueType);
            Assert.AreEqual(s_MaterialSlot.value, ((Vector3MaterialSlot)slots[0]).value);
        }
Exemple #32
0
 private void ParseBlock(Node subtree)
 {
     SymbolTable.EnterScope();
     BlockNode block = new BlockNode(subtree);
     while (tokens.CurrentToken != TokenType.End)
     {
         if (tokens.CurrentToken.Type == TokenType.EOF)
         {
             ErrorHandler.RaiseError(new Error(tokens.CurrentToken.LineNo, "Unexpected end of file. Maybe missing an 'End'?"));
             Fail();
         }
             ParseStatement(block);
     }
     tokens.ConsumeToken(TokenType.End).ConsumeToken(TokenType.Delim);
     SymbolTable.ExitScope();
 }
        public void GenerateCode(BlockNode node, ICIL_CodeGenerator codeGenerator)
        {
            node.Holder = codeGenerator.DefineVariable();
            codeGenerator.AddLocalVariable(
                new CIL_LocalVariable((Variable)node.Holder));

            foreach (var expression in node.Expression)
            {
                GenerateCode(expression, codeGenerator);
            }

            var last = node.Expression.Last();

            codeGenerator.AddInstruction(
                new Assign((Variable)node.Holder, last.Holder));
        }
Exemple #34
0
    	// For global variables (accessable anywhere)
    	//NullableDictionnary globalVariables = new NullableDictionnary();
    	
    	// For main variables (accessable anywhere but methods)
    	
    	
    	
    	//NullableDictionnary mainVariables = new NullableDictionnary();
    	
    	// This should tell the statements where they have to look up variables
    	//NullableDictionnary variableAccess = mainVariables;

    	//String output;
    	//public String GetOutput() {
    	//	return output;
    	//}



    // $ANTLR start "compilationUnit"
    // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\SGLTreeWalker.g:41:1: compilationUnit : ( mainStatement )+ EOF ;
    public void compilationUnit() // throws RecognitionException [1]
    {   
         
          BlockNode bn = new BlockNode(); 
          node = bn; 
          Scope scope = new Scope(currentScope); 
          currentScope = scope; 

        try 
    	{
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\SGLTreeWalker.g:51:2: ( ( mainStatement )+ EOF )
            // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\SGLTreeWalker.g:51:4: ( mainStatement )+ EOF
            {
            	// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\SGLTreeWalker.g:51:4: ( mainStatement )+
            	int cnt1 = 0;
            	do 
            	{
            	    int alt1 = 2;
            	    int LA1_0 = input.LA(1);

            	    if ( ((LA1_0 >= VARDEF && LA1_0 <= ASSIGN) || LA1_0 == 30) )
            	    {
            	        alt1 = 1;
            	    }


            	    switch (alt1) 
            		{
            			case 1 :
            			    // C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\SGLTreeWalker.g:51:4: mainStatement
            			    {
            			    	PushFollow(FOLLOW_mainStatement_in_compilationUnit70);
            			    	mainStatement();
            			    	state.followingStackPointer--;


            			    }
            			    break;

            			default:
            			    if ( cnt1 >= 1 ) goto loop1;
            		            EarlyExitException eee1 =
            		                new EarlyExitException(1, input);
            		            throw eee1;
            	    }
            	    cnt1++;
            	} while (true);

            	loop1:
            		;	// Stops C# compiler whining that label 'loop1' has no statements

            	Match(input,EOF,FOLLOW_EOF_in_compilationUnit73); 

            }

             
              currentScope = currentScope.parent(); 

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return ;
    }
 public void PushBlock(BlockNode block)
 {
     stack.Push(block);
     variables = new ScopedDictionary<string, ValueProviderBase>(variables); 
 }
            void ParseInternal()
            {
                this.mainBlock = new BlockNode(null);
                this.stack = new Stack<BlockNode>();
                this.errors = new List<TemplateError>(); 
                PushBlock(mainBlock);

                var matches = TemplateUtils.KeywordsRegex.Matches(text);

                if (matches.Count == 0)
                {
                    stack.Peek().Nodes.Add(new LiteralNode { Text = text });
                    stack.Pop();
                    return;
                }

                int index = 0;
                foreach (Match match in matches)
                {
                    if (index < match.Index)
                    {
                        stack.Peek().Nodes.Add(new LiteralNode { Text = text.Substring(index, match.Index - index) });
                    }
                    var type = match.Groups["type"].Value;
                    var token = match.Groups["token"].Value;
                    var keyword = match.Groups["keyword"].Value;
                    var dec = match.Groups["dec"].Value;
                    switch (keyword)
                    {
                        case "":
                        case "raw":
                            var tok = TemplateUtils.TokenFormatRegex.Match(token);
                            if (!tok.Success)
                                AddError(true, "{0} has invalid format".FormatWith(token));
                            else
                            {
                                var t = TryParseValueProvider(type, tok.Groups["token"].Value, dec);

                                stack.Peek().Nodes.Add(new ValueNode(t, tok.Groups["format"].Value.DefaultText(null), isRaw: keyword.Contains("raw")));

                                DeclareVariable(t);
                            }
                            break;
                        case "declare":
                            {
                                var t = TryParseValueProvider(type, token, dec);

                                stack.Peek().Nodes.Add(new DeclareNode(t, this.AddError));

                                DeclareVariable(t);
                            }
                            break;
                        case "any":
                            {
                                AnyNode any;
                                ValueProviderBase vp;
                                var filter = TemplateUtils.TokenOperationValueRegex.Match(token);
                                if (!filter.Success)
                                {
                                    vp = TryParseValueProvider(type, token, dec);

                                    any = new AnyNode(vp);
                                }
                                else
                                {
                                    vp = TryParseValueProvider(type, filter.Groups["token"].Value, dec);
                                    var comparer = filter.Groups["comparer"].Value;
                                    var value = filter.Groups["value"].Value;
                                    any = new AnyNode(vp, comparer, value, this.AddError);

                                }
                                stack.Peek().Nodes.Add(any);
                                PushBlock(any.AnyBlock);

                                DeclareVariable(vp);
                                break;
                            }
                        case "notany":
                            {
                                var an = (AnyNode)PopBlock(typeof(AnyNode)).owner;
                                if (an != null)
                                    PushBlock(an.CreateNotAny());
                                break;
                            }
                        case "endany":
                            {
                                PopBlock(typeof(AnyNode));
                                break;
                            }
                        case "foreach":
                            {
                                ValueProviderBase vp = TryParseValueProvider(type, token, dec);
                                var fn = new ForeachNode(vp);
                                stack.Peek().Nodes.Add(fn);
                                PushBlock(fn.Block);
                                vp.IsForeach = true;
                                DeclareVariable(vp);
                                break;
                            }
                        case "endforeach":
                            {
                                PopBlock(typeof(ForeachNode));
                            }
                            break;
                        case "if":
                            {
                                IfNode ifn;
                                ValueProviderBase vp;
                                var filter = TemplateUtils.TokenOperationValueRegex.Match(token);
                                if (!filter.Success)
                                {
                                    vp = TryParseValueProvider(type, token, dec);
                                    ifn = new IfNode(vp, this);
                                }
                                else
                                {
                                    vp = TryParseValueProvider(type, filter.Groups["token"].Value, dec);
                                    var comparer = filter.Groups["comparer"].Value;
                                    var value = filter.Groups["value"].Value;
                                    ifn = new IfNode(vp, comparer, value, this.AddError);
                                }
                                stack.Peek().Nodes.Add(ifn);
                                PushBlock(ifn.IfBlock);
                                DeclareVariable(vp);
                                break;
                            }
                        case "else":
                            {
                                var ifn = (IfNode)PopBlock(typeof(IfNode)).owner;
                                if (ifn != null)
                                    PushBlock(ifn.CreateElse());
                                break;
                            }
                        case "endif":
                            {
                                PopBlock(typeof(IfNode));
                                break;
                            }
                        default :
                            AddError(true, "'{0}' is deprecated".FormatWith(keyword));
                            break;
                    }
                    index = match.Index + match.Length;
                }

                if (stack.Count != 1)
                    AddError(true, "Last block is not closed: {0}".FormatWith(stack.Peek()));

                var lastM = matches.Cast<Match>().LastOrDefault();
                if (lastM != null && lastM.Index + lastM.Length < text.Length)
                    stack.Peek().Nodes.Add(new LiteralNode { Text = text.Substring(lastM.Index + lastM.Length) });

                stack.Pop();
            }
Exemple #37
0
 public UserFunction(ParameterNode parameters, BlockNode body, Environment father)
 {
     _parameters = parameters;
     _body = body;
     _father = father;
 }
 public ForeachNode(ValueProviderBase valueProvider)
 {
     this.ValueProvider = valueProvider;
     this.Block = new BlockNode(this);
 }
        public ITreeNode Program()
        {
            ITreeNode programNode = new ErrorNode();

            switch (curTokenType)
            {
                case TokenType.BEGINBL:
                    Match(ref matchToken, TokenType.BEGINBL);
                    ITreeNode someStatement = Program();
                    BlockNode block = new BlockNode();
                    block.addStatement(someStatement);
                    while (curTokenType != TokenType.ENDBL)
                    {
                        someStatement = Program();
                        block.addStatement(someStatement);
                    }
                    Match(ref matchToken, TokenType.ENDBL);
                    programNode = block;
                    break;
                case TokenType.LABEL:
                    Match(ref matchToken, TokenType.LABEL);
                    LabelNode labeledBlock = new LabelNode(matchToken.getValue());
                    ITreeNode labeledStatement;
                    do
                    {
                        labeledStatement = Program();
                        labeledBlock.addStatement(labeledStatement);
                    }
                    while (curTokenType != TokenType.EOF);
                    programNode = labeledBlock;
                    break;
                case TokenType.INTDEC:
                    Match(ref matchToken, TokenType.INTDEC);
                    Match(ref matchToken, TokenType.ID);
                    programNode = new IdentifierDeclarationNode(IdentifierType.INT, matchToken.getValue());
                    Match(ref matchToken, TokenType.EOS);
                    break;
                case TokenType.BOOLDEC:
                    Match(ref matchToken, TokenType.BOOLDEC);
                    Match(ref matchToken, TokenType.ID);
                    programNode = new IdentifierDeclarationNode(IdentifierType.BOOL, matchToken.getValue());
                    Match(ref matchToken, TokenType.EOS);
                    break;
                case TokenType.FOR:
                    Match(ref matchToken, TokenType.FOR);
                    Match(ref matchToken, TokenType.LPAREN);
                    AssignmentNode init = (AssignmentNode)Program();
                    AssignmentNode step = (AssignmentNode)Program();
                    BooleanExpressionNode condition = (BooleanExpressionNode)BooleanExpression();
                    Match(ref matchToken, TokenType.RPAREN);
                    BlockNode forBody = (BlockNode)Program();
                    programNode = new ForNode(init, step, condition, forBody);
                    break;
                /*case TokenType.FUN:
                    Match(ref matchToken, TokenType.FUN);
                    IdentifierNode id = (IdentifierNode)Factor();
                    programNode = new FunctionNode(id);
                    Match(ref matchToken, TokenType.EOS);
                    break;*/
                case TokenType.GOTO:
                    Match(ref matchToken, TokenType.GOTO);
                    Match(ref matchToken, TokenType.ID);
                    IdentifierNode gotoLabel = new IdentifierNode(matchToken.getValue(), IdentifierType.LABEL);
                    programNode = new GotoNode(gotoLabel);
                    Match(ref matchToken, TokenType.EOS);
                    break;
                case TokenType.ID:
                    Match(ref matchToken, TokenType.ID);
                    IdentifierNode assignId = new IdentifierNode(matchToken.getValue(), IdentifierType.UNKNOWN);
                    Match(ref matchToken, TokenType.ASSIGN);
                    BooleanExpressionNode assignValue = (BooleanExpressionNode)BooleanExpression();
                    programNode = new AssignmentNode(assignId, assignValue);
                    Match(ref matchToken, TokenType.EOS);
                    break;
                case TokenType.IF:
                    Match(ref matchToken, TokenType.IF);
                    ITreeNode thenBranch;
                    ITreeNode elseBranch;

                    Match(ref matchToken, TokenType.LPAREN);
                    BooleanExpressionNode ifCondition = (BooleanExpressionNode)BooleanExpression();
                    Match(ref matchToken, TokenType.RPAREN);
                    Match(ref matchToken, TokenType.THEN);
                    thenBranch = (BlockNode)Program();
                    if (curTokenType == TokenType.ELSE)
                    {
                        Match(ref matchToken, TokenType.ELSE);
                        elseBranch = (BlockNode)Program();
                    }
                    else
                    {
                        elseBranch = new BlankNode();
                    }
                    programNode = new IfNode(ifCondition, thenBranch, elseBranch);
                    break;
                /*case TokenType.LET:
                    Match(ref matchToken, TokenType.LET);
                    IdentifierNode shortId = (IdentifierNode)Factor();
                    Match(ref matchToken, TokenType.ASSIGN);
                    BooleanExpressionNode subst = (BooleanExpressionNode)BooleanExpression();
                    Match(ref matchToken, TokenType.IN);
                    BooleanExpressionNode target = (BooleanExpressionNode)BooleanExpression();
                    programNode = new LetNode(shortId, subst, target);
                    Match(ref matchToken, TokenType.EOS);
                    break;*/
                case TokenType.PRINT:
                    Match(ref matchToken, TokenType.PRINT);
                    Match(ref matchToken, TokenType.LPAREN);
                    BooleanExpressionNode printArgument = (BooleanExpressionNode)BooleanExpression();
                    Match(ref matchToken, TokenType.RPAREN);
                    programNode = new PrintNode(printArgument);
                    Match(ref matchToken, TokenType.EOS);
                    break;
                case TokenType.WHILE:
                    Match(ref matchToken, TokenType.WHILE);
                    Match(ref matchToken, TokenType.LPAREN);
                    BooleanExpressionNode whileCondition = (BooleanExpressionNode)BooleanExpression();
                    Match(ref matchToken, TokenType.RPAREN);
                    BlockNode whileBody = (BlockNode)Program();
                    programNode = new WhileNode(whileCondition, whileBody);
                    break;
                case TokenType.EOF:
                    programNode = new BlankNode();
                    break;
                default:
                    Expect(TokenType.UNKNOWN, lookAheadToken);
                    break;
            }
            return programNode;
        }
 internal AnyNode(ValueProviderBase valueProvider)
 {
     this.ValueProvider = valueProvider;
     AnyBlock = new BlockNode(this);
 }
 public BlockNode CreateNotAny()
 {
     NotAnyBlock = new BlockNode(this);
     return NotAnyBlock;
 }
 public BlockNode CreateElse()
 {
     ElseBlock = new BlockNode(this);
     return ElseBlock;
 }
            internal IfNode(ValueProviderBase valueProvider, string operation, string value, Action<bool, string> addError)
            {
                this.ValueProvider = valueProvider;
                this.Operation = FilterValueConverter.ParseOperation(operation);
                this.Value = value;

                ValueProvider.ValidateConditionValue(value, Operation, addError);

                this.IfBlock = new BlockNode(this);
            }
 internal IfNode(ValueProviderBase valueProvider, TemplateWalker walker)
 {
     this.ValueProvider = valueProvider;
     this.IfBlock = new BlockNode(this);
 }