Ejemplo n.º 1
0
        private static void ParseLines(ParseState state, QuipCompiler Compiler)
        {
            while (true)
            {
                DevourWhitespace(state);
                if (state.AtEnd()) return;
                if (state.Next() == '}')
                {
                    Compiler.EndBlock();
                    state.Advance(1);
                    return;
                }

                if (state.Next() == '@' || state.Next() == '+' || state.Next() == '?' || state.Next() == '*')
                    ParseDeclaration(state, Compiler);
                else if (state.Next() == '#') ParseDirective(state, Compiler);
                else if (state.MatchNext("follows")) ParseFollowsBlock(state, Compiler);
                else if (state.MatchNext("supplies")) ParseSuppliesBlock(state, Compiler);
                else if (state.MatchNext("directly")) ParseDirectlyBlock(state, Compiler);
                else if (state.MatchNext("//")) ParseComment(state);
                else throw new InvalidOperationException("Unknown line type");
            }
        }