public void Parse() { Logs.Clear(); index = 0; result = ""; wfp.ResetLocals(); // DEBUG: Check if after Begin for (int i = 0; i < lexemes.Count; i++) { if (lexemes[i].Value == "Begin" && lexemes[i].Type == LexemeType.KEY) { index = i + 1; Logs.Add(new ParserLog(ParserLogType.Start, null, "#N/A", result)); CheckIfStatement(); Logs.Add(new ParserLog(ParserLogType.Success, null, "#N/A", result)); return; } } var log = new ParserLog(ParserLogType.Mismatch, null, "Begin if", null); Logs.Add(log); throw new ParserException(log); }
private void ThrowMismatch(string expected) { var log = new ParserLog(ParserLogType.Mismatch, (index > lexemes.Count - 1) ? null : lexemes[index], expected, result); Logs.Add(log); throw new ParserException(log); }
public ParserException(ParserLog log) : base() { Log = log; }