Esempio n. 1
0
        public Node ConstantDeclaration()
        {
            var constNode = new Constant_Declaration()
            {
                AnchorToken = Expect(TokenCategory.CONST)
            };

            while (CurrentToken == TokenCategory.IDENTIFIER)
            {
                var identifierNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.IDENTIFIER)
                };
                var assignmentNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.ASSIGN)
                };

                assignmentNode.Add(identifierNode);
                assignmentNode.Add(Literal());
                Expect(TokenCategory.EOL);

                constNode.Add(assignmentNode);
            }


            return(constNode);
        }
Esempio n. 2
0
 public Node ConstantDeclaration()
 {
     var constant_node = new Constant_Declaration()
     {
         AnchorToken = Expect(TokenCategory.IDENTIFIER)
     };
     Expect(TokenCategory.COLON_EQUAL);
     constant_node.Add(Literal());
     Expect(TokenCategory.SEMICOLON);
     return constant_node;
 }