public void Parse(string[] lines) { if (lines.Any(_ => _.Contains("stack"))) { this.isWithStack = true; } for (int i = 0; i < lines.Length; i++) { if (lines[i].Contains("alphabet: ")) { string alphabet = lines[i].Substring(10); this._parser.ParseAlphabet(alphabet); } else if (lines[i].Contains("stack")) { string stackString = lines[i].Substring(6); this._parser.ParseStack(stackString); } else if (lines[i].Contains("states")) { string states = lines[i].Substring(8); this._parser.ParseStates(states); } else if (lines[i].Contains("final")) { string final = lines[i].Substring(7); this._parser.ParseFinalStates(final); } else if (lines[i].Contains("transitions")) { i++; while (!lines[i].Contains("end")) { this._parser.ParseTransition(lines[i]); i++; } } else if (lines[i].Contains("dfa")) { string dfa = lines[i].Substring(5); this.expectedDfa = this.parseExpectedValue(dfa[0]); } else if (lines[i].Contains("words")) { i++; if (this.isWithStack) { this._stackController = new StackController(_transitions, _stack); } this.handleLineWord(lines, i); } else if (lines[i].Contains("finite")) { string finite = lines[i].Substring(6); this.expectedFinite = this._parser.ParseFinite(finite); } } }
public StackEntry(IStackController parent) { m_Parent = parent; }