Beispiel #1
0
        /// <summary>
        /// Tries whether after an vertex there is a comma, if there is the comma, that means there are more patterns to parse.
        /// </summary>
        /// <returns> Start of a new pattern. </returns>
        static private Node ParseNewPatternExpr(ref int position, List <Token> tokens)
        {
            // Checks for comma, after comma next pattern must be
            if (!CheckToken(position, Token.TokenType.Comma, tokens))
            {
                return(null);
            }
            position++;

            MatchDividerNode matchDivider = new MatchDividerNode();


            Node newPattern = ParseVertex(ref position, tokens);

            if (newPattern == null)
            {
                ThrowError("Match parser", "Expected Vertex after comma.", position, tokens);
            }
            matchDivider.AddNext(newPattern);
            return(matchDivider);
        }
Beispiel #2
0
 /// <summary>
 /// Serves as a dividor of multiple patterns.
 /// Create new pattern and start its parsing.
 /// </summary>
 public void Visit(MatchDividerNode node)
 {
     currentPattern = new ParsedPattern();
     result.Add(currentPattern);
     node.next.Accept(this);
 }
 public void Visit(MatchDividerNode node)
 {
     throw new NotImplementedException();
 }