예제 #1
0
        private p_RuleExpression obtainRuleExpression()
        {
            p_RuleExpression ruleExpression = new p_RuleExpression();

            ruleExpression.rulePieces = new List<p_RuleExpression_rulePiece>();
            while (true)
            {

                p_RuleExpression_rulePiece piece = new p_RuleExpression_rulePiece();

                if (piece.HasNamePrefix = resetState(checkNamePrefix))
                {
                    piece.NamePrefix = obtainNamePrefix();
                }

                {

                    if (resetState(checkOrPiece))
                    {
                        piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.OrPiece, obtainOrPiece());
                        goto nextPiece1;
                    }
                }
                if (resetState(checkString))
                {
                    piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.String, obtainString());
                    goto nextPiece1;
                }

                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isIdentifier("tab"))
                    {
                        if (symbolGenerator.Advance().isSymbol("<"))
                        {
                            symbolGenerator.RestoreState();

                            piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.DecreaseTab);
                            goto nextPiece1;
                        }
                    }
                    symbolGenerator.PopState();
                }
                {
                    symbolGenerator.PushState();

                    if (symbolGenerator.Advance().isIdentifier("tab"))
                    {
                        if (symbolGenerator.Advance().isSymbol(">"))
                        {
                            symbolGenerator.RestoreState();
                            piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.IncreaseTab);
                            goto nextPiece1;
                        }
                    }
                    symbolGenerator.PopState();
                }
                if (resetState(checkIdentifier))
                {
                    piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.RulePiece, obtainIdentifier());
                    goto nextPiece1;
                }

                goto goodDone;

            nextPiece1:
                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isSymbol("?"))
                    {
                        symbolGenerator.RestoreState();
                        piece.suffix = p_RuleExpression_rulePiece_suffix.QuestionMark;
                    }
                    else
                        symbolGenerator.PopState();
                }
                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isSymbol("*"))
                    {
                        symbolGenerator.RestoreState();
                        piece.suffix = p_RuleExpression_rulePiece_suffix.Multiply;
                    }
                    else
                        symbolGenerator.PopState();
                }

                ruleExpression.rulePieces.Add(piece);
                continue;
            }
            goodDone:
            return ruleExpression;
        }
예제 #2
0
        private p_RuleExpression obtainRuleExpression()
        {
            p_RuleExpression ruleExpression = new p_RuleExpression();

            ruleExpression.rulePieces = new List <p_RuleExpression_rulePiece>();
            while (true)
            {
                p_RuleExpression_rulePiece piece = new p_RuleExpression_rulePiece();

                if (piece.HasNamePrefix = resetState(checkNamePrefix))
                {
                    piece.NamePrefix = obtainNamePrefix();
                }

                {
                    if (resetState(checkOrPiece))
                    {
                        piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.OrPiece, obtainOrPiece());
                        goto nextPiece1;
                    }
                }
                if (resetState(checkString))
                {
                    piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.String, obtainString());
                    goto nextPiece1;
                }


                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isIdentifier("tab"))
                    {
                        if (symbolGenerator.Advance().isSymbol("<"))
                        {
                            symbolGenerator.RestoreState();

                            piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.DecreaseTab);
                            goto nextPiece1;
                        }
                    }
                    symbolGenerator.PopState();
                }
                {
                    symbolGenerator.PushState();

                    if (symbolGenerator.Advance().isIdentifier("tab"))
                    {
                        if (symbolGenerator.Advance().isSymbol(">"))
                        {
                            symbolGenerator.RestoreState();
                            piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.IncreaseTab);
                            goto nextPiece1;
                        }
                    }
                    symbolGenerator.PopState();
                }
                if (resetState(checkIdentifier))
                {
                    piece.rule = new p_RuleExpression_rulePiece_rule(p_RuleExpression_rulePiece_ruleType.RulePiece, obtainIdentifier());
                    goto nextPiece1;
                }

                goto goodDone;

nextPiece1:
                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isSymbol("?"))
                    {
                        symbolGenerator.RestoreState();
                        piece.suffix = p_RuleExpression_rulePiece_suffix.QuestionMark;
                    }
                    else
                    {
                        symbolGenerator.PopState();
                    }
                }
                {
                    symbolGenerator.PushState();
                    if (symbolGenerator.Advance().isSymbol("*"))
                    {
                        symbolGenerator.RestoreState();
                        piece.suffix = p_RuleExpression_rulePiece_suffix.Multiply;
                    }
                    else
                    {
                        symbolGenerator.PopState();
                    }
                }

                ruleExpression.rulePieces.Add(piece);
                continue;
            }
goodDone:
            return(ruleExpression);
        }