/// <summary> /// Always jumps to a identifier node where name and type is processed. /// </summary> public void Visit(MatchVariableNode node) { readingName = true; // It is not an anonnymous field. if (node.variableName != null) { node.variableName.Accept(this); } // It has set type. if (node.variableType != null) { readingName = false; node.variableType.Accept(this); } }
/// <summary> /// Parses variable enclosed in vertex or edge. /// Expects Name:Type / Name / :Type / (nothing) /// </summary> /// <returns> A variable node. </returns> static private Node ParseMatchVariable(ref int position, List <Token> tokens) { MatchVariableNode matchVariableNode = new MatchVariableNode(); // Expecting identifier, name of variable. Can be empty, if so then it is anonymous variable. Node name = ParseIdentifierExrp(ref position, tokens); if (name != null) { position++; } matchVariableNode.AddVariableName(name); // Check for type of vairiable after : if (CheckToken(position, Token.TokenType.DoubleDot, tokens)) { position++; Node identifierNode = ParseIdentifierExrp(ref position, tokens); if (identifierNode == null) { ThrowError("Match parser", "Expected IDENTIFIER after double dot.", position, tokens); } else { matchVariableNode.AddVariableType(identifierNode); } position++; } if (matchVariableNode.IsEmpty()) { return(null); } else { return(matchVariableNode); } }
public void Visit(MatchVariableNode node) { throw new NotImplementedException(); }