private void Expacc() { _currentNode.AddChild(new ParseNode(ParseEnum.ExpressionAccent)); _currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1]; if (!_lex.EndOfInput) { if (_current is AddSub) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); _current = _lex.GetNextToken(); Term(); Expacc(); } else if (_current is Equals) { _currentNode.AddChild(new ParseNode(ParseEnum.Equals)); _current = _lex.GetNextToken(); Expressie(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } } _currentNode = _currentNode.GetParent(); }
public void Init() { _testTree = new ParseNode(ParseEnum.Start); _testTree.AddChild(new ParseNode(ParseEnum.Expression)); _testTree.GetChildren()[0].AddChild(new ParseNode(ParseEnum.Term)); _testTree.GetChildren()[0].AddChild(new ParseNode(ParseEnum.ExpressionAccent)); ParseNode node = _testTree.GetChildren()[0].GetChildren()[0]; node.AddChild(new ParseNode(ParseEnum.Factor)); node.AddChild(new ParseNode(ParseEnum.TermAccent)); node.GetChildren()[0].AddChild(new ParseNode(ParseEnum.Number, "3")); node.GetChildren()[1].AddChild(new ParseNode(ParseEnum.Empty)); node = _testTree.GetChildren()[0].GetChildren()[1]; node.AddChild(new ParseNode(ParseEnum.Operator, "+")); node.AddChild(new ParseNode(ParseEnum.Term)); node.AddChild(new ParseNode(ParseEnum.ExpressionAccent)); ParseNode termNode = node.GetChildren()[1]; termNode.AddChild(new ParseNode(ParseEnum.Factor)); termNode.AddChild(new ParseNode(ParseEnum.TermAccent)); termNode.GetChildren()[0].AddChild(new ParseNode(ParseEnum.Number, "4")); termNode.GetChildren()[1].AddChild(new ParseNode(ParseEnum.Empty)); node.GetChildren()[2].AddChild(new ParseNode(ParseEnum.Empty)); }
private void Expacc() { _currentNode.AddChild(new ParseNode(ParseEnum.ExpressionAccent)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; if (_current is AddSub) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Term(); Expacc(); } else if (_current is Equals) { _currentNode.AddChild(new ParseNode(ParseEnum.Equals)); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Expressie(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } _currentNode = _currentNode.GetParent(); }
private void Factor() { _currentNode.AddChild(new ParseNode(ParseEnum.Factor)); _currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1]; if (!_lex.EndOfInput) { if (_current is OpenParenthesis) { _currentNode.AddChild(new ParseNode(ParseEnum.OpenParenthesis)); _current = _lex.GetNextToken(); Expressie(); if (_current is CloseParenthesis) { _currentNode.AddChild(new ParseNode(ParseEnum.CloseParenthesis)); _current = _lex.GetNextToken(); } } else if (_current is Variable) { _currentNode.AddChild(new ParseNode(ParseEnum.Variable, _current.GetValue())); _current = _lex.GetNextToken(); } else if (_current is Number) { _currentNode.AddChild(new ParseNode(ParseEnum.Number, _current.GetValue())); _current = _lex.GetNextToken(); } else { Console.WriteLine("Syntaxfout."); Stop(); } } _currentNode = _currentNode.GetParent(); }
private void Expressie() { _currentNode.AddChild(new ParseNode(ParseEnum.Expression)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; Term(); Expacc(); _currentNode = _currentNode.GetParent(); }
private bool ParseJoinObject(ParseNode parent) { ParseNode next = new ParseNode("<join_object>"); SaveState s = SaveParserState(next); if (ParseTableName(next) && ConsumeChar('(') && ParseColumns(next) && ConsumeChar(')')) { parent.AddChild(next); return(true); } LoadSaveState(s, next); if (ConsumeChar('(') && ParseColumns(next) && ConsumeChar(')')) { SaveState p = SaveParserState(); if (ParseTableName(next)) { parent.AddChild(next); next.ChildrenList.Reverse(); return(true); } LoadSaveState(p); if (ConsumeChar('(') && ParseJoinInfoFull(next) && ConsumeChar(')')) { parent.AddChild(next); next.ChildrenList.Reverse(); return(true); } } LoadSaveState(s, next); if (ConsumeChar('(') && ParseJoinInfoFull(next) && ConsumeString(")(") && ParseColumns(next) && ConsumeChar(')')) { parent.AddChild(next); return(true); } return(false); }
public bool ParseObject(ParseNode parent) { var next = new ParseNode("<object>"); if (!ParseSymbol(next)) { return(false); } if (MatchChar('(')) { if (!ParseFunctionCall(next)) { return(false); } } if (MatchChar('.')) { if (!ParseMember(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseKeyInfo(ParseNode parent) { ParseNode next = new ParseNode("<key_info>"); ParseNode nextNext; if (ConsumeChar('*')) { nextNext = new ParseNode("*"); } else if (ConsumeChar('&')) { nextNext = new ParseNode("&"); } else if (ConsumeChar('-')) { nextNext = new ParseNode("-"); } else { return(false); } next.AddChild(nextNext); parent.AddChild(next); return(true); }
public bool ParseCommand(out ParseNode parent) { parent = null; ParseNode output = new ParseNode("<command>"); SaveState s1 = SaveParserState(output); output.AddChild(new ParseNode("<method>")); // Table based commands if (ParseObject(output)) { if (ConsumeString(" as ")) { output["<method>"].AddChild(new ParseNode("setVar")); if (!ParseString(output["<method>"])) { return(false); } } parent = output; return(true); } return(true); }
private bool ParseElement(ParseNode parent) { ParseNode next = new ParseNode("<method>"); parent.AddChild(next); return(true); }
public void MoveNode(ParseNode fromNode, ParseNode toNode, int childIndex) { if (root != fromNode) { var parent = fromNode.GetParent(); parent.RemoveChild(fromNode); toNode.AddChild(childIndex, fromNode); ((ParseNodeDrawable)root).UpdateDepths(0); } }
private bool ParseObject(ParseNode parent) { if (!ParseObject(out ParseNode next)) { return(false); } parent.AddChild(next); return(true); }
private void Termacc() { _currentNode.AddChild(new ParseNode(ParseEnum.TermAccent)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; if (_current is Operator) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Factor(); Termacc(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } _currentNode = _currentNode.GetParent(); }
private bool ParseListObject(ParseNode parent, InternalParserFunction function) { ParseNode next = new ParseNode("<list_object>"); if (!function(next)) { return(false); } parent.AddChild(next); return(true); }
protected bool ParseSentenceTail(ParseNode parent) { ParseNode next = new ParseNode("<sentence_tail>"); if (!MatchChar('"') && !ParseSentencePrime(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseTableName(ParseNode parent) { ParseNode next = new ParseNode("<table_name>"); if (!ParseString(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseCaller(ParseNode parent) { var next = new ParseNode("<caller>"); if (!ParseSymbol(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseTupleString(ParseNode parent) { ParseNode next = new ParseNode("<tuple>"); if (!ConsumePattern("{.*(" + RADTuple.ELEMENT_SEPERATOR + ".*)*}", out string singleTuple)) { return(false); } next.AddChild(new ParseNode(singleTuple)); parent.AddChild(next); return(true); }
private bool ParseDigit(ParseNode parent) { ParseNode next = new ParseNode("<digit>"); if (!MatchPattern(@"\d")) { return(false); } next.AddChild(new ParseNode("" + CurrentCharacter)); AdvancePointer(); parent.AddChild(next); return(true); }
private bool ParseSymbolBackTail(ParseNode parent) { ParseNode next = new ParseNode("<symbol_back_tail>"); if (MatchPattern(@"\w")) { if (!ParseSymbolBack(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseContraintsTail(ParseNode parent) { ParseNode next = new ParseNode("<contraints_tail>"); if (ConsumeChar(',')) { if (!ParseContraints(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseStringTail(ParseNode parent) { ParseNode next = new ParseNode("<string_tail>"); if (MatchPattern(@"[a-zA-Z_.0-9*]")) { if (!ParseString(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseTupleListTail(ParseNode parent) { ParseNode next = new ParseNode("<tuple_list_tail>"); if (!MatchChar('}')) { if (!ParseTupleList(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseIntTail(ParseNode parent) { ParseNode next = new ParseNode("<int_tail>"); if (MatchPattern(@"\d")) { if (!ParseInt(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseColumnMore(ParseNode parent) { ParseNode next = new ParseNode("<column_more>"); if (ConsumeChar(',')) { if (!ParseColumns(next)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseListMore(ParseNode parent, InternalParserFunction function) { ParseNode next = new ParseNode("<list_more>"); if (ConsumeChar(',')) { if (!ParseList(next, function)) { return(false); } } parent.AddChild(next); return(true); }
protected bool ParseInt(ParseNode parent) { ParseNode next = new ParseNode("<int>"); if (!ParseDigit(next)) { return(false); } if (!ParseIntTail(next)) { return(false); } parent.AddChild(next); return(true); }
public bool ParseColumns(ParseNode parent) { ParseNode next = new ParseNode("<columns>"); if (!ParseColumnName(next)) { return(false); } if (!ParseColumnMore(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseSymbolChar(ParseNode parent) { ParseNode next = new ParseNode("<symbol_char>"); if (!MatchPattern(@"\w")) { return(false); } ParseNode nextNext = new ParseNode("" + CurrentCharacter); next.AddChild(nextNext); AdvancePointer(); parent.AddChild(next); return(true); }
private bool ParseSymbolBack(ParseNode parent) { ParseNode next = new ParseNode("<symbol_back>"); if (!ParseSymbolChar(next)) { return(false); } if (!ParseSymbolBackTail(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseRelationList(ParseNode parent) { ParseNode next = new ParseNode("<relation_list>"); if (!ParseColumnDetails(next)) { return(false); } if (!ParseRelationListTail(next)) { return(false); } parent.AddChild(next); return(true); }
private void Termacc() { _currentNode.AddChild(new ParseNode(ParseEnum.TermAccent)); _currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1]; if (!_lex.EndOfInput) { if (_current is Operator) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); _current = _lex.GetNextToken(); Factor(); Termacc(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } } _currentNode = _currentNode.GetParent(); }