Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public ParserException(ParserLog log) : base()
 {
     Log = log;
 }