Beispiel #1
0
        public FileMutilType Parse(List <Token> tokens, ContextFile fileContext)
        {
            tape               = new TokenTape(tokens, fileContext);
            fileMY             = new FileMutilType();
            fileMY.FileContext = fileContext;

            while (tape.CurrentKind != TokenKind.EOF)
            {
                TokenKind nkind = tape.Next.Kind;
                if (nkind == TokenKind.Colon && tape.CurrentKind == TokenKind.Ident)
                {
                    SectionBase section = ParseSection();
                    if (section != null)
                    {
                        fileMY.AddSection(section);
                    }
                }
                else if (tape.CurrentKind == TokenKind.NewLine)
                {
                    SkipNewLine();
                }
                else
                {
                    SectionProc section = ParseProc();
                    if (section != null)
                    {
                        if (section.NamePart.IsConstructor())
                        {
                            SectionConstructor constructor = new SectionConstructor(section);
                            fileMY.AddSection(constructor);
                        }
                        else
                        {
                            fileMY.AddSection(section);
                        }
                    }
                }
            }
            return(fileMY);
        }