Пример #1
0
        private void command(SyntaxNode parentNode)
        {
            if (current is Keyword && current.Text == "namespace")
            {
                read(); // namespace
                if (!(current is Identifier))
                    throw new SyntaxException();

                CommandNode commandNode =
                    new CommandNode(CommandType.Namespace, current.Text).AddTo(parentNode) as CommandNode;

                read(); // keyword
            }
            else if (current is Keyword && current.Text == "using")
            {
                read(); // using
                if (!(current is Identifier))
                    throw new SyntaxException();

                CommandNode commandNode =
                    new CommandNode(CommandType.Using, current.Text).AddTo(parentNode) as CommandNode;

                read(); // identifier
            }
            else if (current is Keyword && current.Text == "generate")
            {
                CommandNode commandNode =
                    new CommandNode(CommandType.Generate, current.Text).AddTo(parentNode) as CommandNode;

                read(); // using
                generateParameters(commandNode);
            }
            else
                throw new SyntaxException();
        }
Пример #2
0
 private void commaGen(CommandNode commandNode)
 {
     if (current is Character && current.Text == ",")
     {
         read(); // ,
         generateParameters(commandNode);
     }
 }
Пример #3
0
 private void generateParameters(CommandNode commandNode)
 {
     if (current is Keyword && current.Text == "id")
     {
         read(); // id;
         commaGen(commandNode);
     }
     else if (current is Keyword && current.Text == "fk")
     {
         read(); // fk
         commaGen(commandNode);
     }
     else
         throw new SyntaxException();
 }