Exemplo n.º 1
0
        /****************************************************************
         *                          Begin!!!
         ***************************************************************/

        /****************************************************************
         *                          Program Node
         ***************************************************************/

        public Node Program()
        {
            var progToken = Expect(TokenCategory.PROGRAM);
            var progName  = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            var declList = EvaluateDeclarations();
            var stmtList = EvaluateStatements();

            var stop = new Stop()
            {
                AnchorToken = Expect(TokenCategory.STOP)
            };

            if (this.labelCache != null)
            {
                stop.Add(this.labelCache);
                this.labelCache = null;
            }

            var end = new End()
            {
                AnchorToken = Expect(TokenCategory.END)
            };

            var prog = new Program()
            {
                progName, declList, stmtList, stop, end
            };

            prog.AnchorToken = progToken;

            while (CurrentToken != TokenCategory.EOF)
            {
                if (CurrentToken == TokenCategory.SUBROUTINE)
                {
                    prog.Add(Subroutine());
                }
                else
                {
                    prog.Add(Function());
                }
            }

            Expect(TokenCategory.EOF);
            return(prog);
        }
Exemplo n.º 2
0
 public DateRange Expand(TimeSpan margin) => new DateRange(Start.Add(-margin), Stop.Add(margin));