Exemplo n.º 1
0
        private static TempNode Parse(IEnumerator<Token> e)
        {
            if (e.Current.Type == TokenType.Identifier)
            {
                var node = new TempNode { Type = AstNodeType.Identifier, Value = e.Current.Value };
                e.MoveNext();
                node.AddNode(Parse(e));
                return node;
            }
            if (e.Current.Type == TokenType.Dot)
            {
                var callNode = new TempNode { Type = AstNodeType.Call };
                callNode.AddNode(ParseCallNode(e));
                return callNode;
            }
            if (e.Current.Type == TokenType.String || e.Current.Type == TokenType.Number)
            {
                return new TempNode { Type = AstNodeType.Literal, Value = e.Current.Value };
            }

            if (e.MoveNext())
                return Parse(e);

            return null;
        }
Exemplo n.º 2
0
        private static TempNode Parse(IEnumerator <Token> e)
        {
            if (e.Current.Type == TokenType.Identifier)
            {
                var node = new TempNode {
                    Type = AstNodeType.Identifier, Value = e.Current.Value
                };
                e.MoveNext();
                node.AddNode(Parse(e));
                return(node);
            }
            if (e.Current.Type == TokenType.Dot)
            {
                var callNode = new TempNode {
                    Type = AstNodeType.Call
                };
                callNode.AddNode(ParseCallNode(e));
                return(callNode);
            }
            if (e.Current.Type == TokenType.String || e.Current.Type == TokenType.Number)
            {
                return(new TempNode {
                    Type = AstNodeType.Literal, Value = e.Current.Value
                });
            }

            if (e.MoveNext())
            {
                return(Parse(e));
            }

            return(null);
        }
Exemplo n.º 3
0
 private static void ParseArguments(IEnumerator<Token> e, TempNode methodNode)
 {
     e.MoveNext();
     while (e.Current.Type != TokenType.CloseParen)
     {
         methodNode.AddNode(Parse(e));
         e.MoveNext();
     }
 }
Exemplo n.º 4
0
 private static void ParseArguments(IEnumerator <Token> e, TempNode methodNode)
 {
     e.MoveNext();
     while (e.Current.Type != TokenType.CloseParen)
     {
         methodNode.AddNode(Parse(e));
         e.MoveNext();
     }
 }