コード例 #1
0
        /// <summary>
        /// Parses vertex node.
        /// </summary>
        /// <returns> A vertex node. </returns>
        static private Node ParseVertex(ref int position, List <Token> tokens)
        {
            VertexNode vertexNode = new VertexNode();

            CheckLeftParen(ref position, tokens);
            // Parse Values of the variable.
            Node variableNode = ParseMatchVariable(ref position, tokens);

            vertexNode.AddMatchVariable(variableNode);
            CheckRightParen(ref position, tokens);

            // Position incremented from leaving function PsrseVariable.
            // Try parse an Edge.
            Node edgeNode = ParseEdge(ref position, tokens);

            if (edgeNode != null)
            {
                vertexNode.AddNext(edgeNode);
                return(vertexNode);
            }

            // Try Parse another pattern, divided by comma.
            Node newPattern = ParseNewPatternExpr(ref position, tokens);

            if (newPattern != null)
            {
                vertexNode.AddNext(newPattern);
            }

            // Always must return valid vertex.
            return(vertexNode);
        }
コード例 #2
0
        /// <summary>
        /// Try to jump to a variable node inside the vertex or continue to the edge.
        /// </summary>
        public void Visit(VertexNode node)
        {
            this.readingVertex = true;

            ParsedPatternNode vm = new VertexParsedPatternNode();

            currentPattern.AddParsedPatternNode(vm);

            if (node.matchVariable != null)
            {
                node.matchVariable.Accept(this);
            }
            if (node.next != null)
            {
                node.next.Accept(this);
            }
        }
コード例 #3
0
 public void Visit(VertexNode node)
 {
     throw new NotImplementedException();
 }