Example #1
0
 public void Table(IList<IList<Token>> rows, Position tablePosition)
 {
     if (NextEvent("table", tablePosition))
         listener.Table(rows, tablePosition);
 }
Example #2
0
            public void NextEvent(string @event, Position position)
            {
                if (!transitionMap.ContainsKey(state))
                {
                    throw new Exception("Unknown state: " + state + " for machine " + name);
                }
                var states = transitionMap[state];

                if (!states.ContainsKey(@event))
                {
                    throw new Exception("Unknown transition: " + @event + " among " + states + " for machine " + name + " in state " + state);
                }

                var newState = states[@event];

                if ("E" == newState)
                {
                    throw new ParseException(state, @event, ExpectedEvents, position);
                }

                Match push = PUSH.Match(newState);
                if (push.Success)
                {
                    parser.pushMachine(push.Groups[1].Captures[0].Value);
                    parser.NextEvent(@event, position);
                }
                else if ("pop()" == newState)
                {
                    parser.popMachine();
                    parser.NextEvent(@event, position);
                }
                else
                {
                    state = newState;
                }
            }
Example #3
0
 public void SyntaxError(string state, string @event, IEnumerable<string> legalEvents, Position position)
 {
 }
Example #4
0
        private bool NextEvent(string @event, Position position)
        {
            try
            {
                machine().NextEvent(@event, position);
                return true;
            }
            catch (ParseException e)
            {
                if (throwOnError) throw;

                listener.SyntaxError(e.State, @event, e.ExpectedEvents, position);
                return false;
            }
        }