コード例 #1
0
ファイル: DmlFileReader.cs プロジェクト: frankgu98/Phosphaze
        protected override void ProcessNext()
        {
            try
            {
                if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_ASSIGN))
                {
                    ProcessAssignment(NamespaceType.Global);
                }
                else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_RANGE))
                {
                    ProcessRange();
                }
                else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.UQNAME) ||
                         DmlTokens.IsBuiltin(CurrentToken))
                {
                    ProcessExpression(GetUntil(DmlTokens.EOL));
                }
                else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_BULLET))
                {
                    SetExpecting(DmlTokens.AT, DmlTokens.UQNAME, DmlTokens.LANGLE);
                    Advance(2, exception: DmlSyntaxError.BadBulletDeclaration());

                    string bulletName = CurrentToken;
                    Advance(exception: DmlSyntaxError.BadBulletDeclaration());

                    BulletBuilder bulletBuilder = new BulletBuilder(bulletName, GetNamespaceBlock(), currentLine);
                    bulletBuilder.Parse();

                    Bullets[bulletName] = (DmlBulletFactory)bulletBuilder.GetResult();
                }
                else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_TIMELINE))
                {
                    if (globalTimeline != null)
                    {
                        throw DmlSyntaxError.DuplicateTimeline();
                    }
                    SetExpecting(DmlTokens.LANGLE);
                    Advance(exception: DmlSyntaxError.BlockMissingDelimiters("Timeline"));

                    TimelineBuilder timelineBuilder = new TimelineBuilder(GetNamespaceBlock(), currentLine);
                    timelineBuilder.Parse();

                    globalTimeline = (DmlTimeline)timelineBuilder.GetResult();
                }
            }
            catch (DmlSyntaxError exception)
            {
                throw new DmlSyntaxError(currentLine, exception);
            }
        }