Beispiel #1
0
    /**
     * <summary>Initializes the parser by creating all the production
     * patterns.</summary>
     *
     * <exception cref='ParserCreationException'>if the parser
     * couldn't be initialized correctly</exception>
     */
    private void CreatePatterns()
    {
        ProductionPattern             pattern;
        ProductionPatternAlternative  alt;

        pattern = new ProductionPattern((int) GrammarConstants.DOCUMENT,
                                        "DOCUMENT");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) GrammarConstants.TEXT, 1, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) GrammarConstants.TEXT,
                                        "TEXT");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) GrammarConstants.EVERYTHING, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) GrammarConstants.CHARACTER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) GrammarConstants.NUMBER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) GrammarConstants.WHITESPACE, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);
    }
Beispiel #2
0
    /**
     * <summary>Initializes the parser by creating all the production
     * patterns.</summary>
     *
     * <exception cref='ParserCreationException'>if the parser
     * couldn't be initialized correctly</exception>
     */
    private void CreatePatterns()
    {
        ProductionPattern             pattern;
        ProductionPatternAlternative  alt;

        pattern = new ProductionPattern((int) DokiScriptConstants.DOKI,
                                        "Doki");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.PART, 1, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.PART,
                                        "Part");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.BLOCK, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.FLAG, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.OPTION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.JUMP, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.BLOCK,
                                        "Block");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.WORLD, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_1, 1, -1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.RETURN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_2, 1, -1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.RETURN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.ACTION,
                                        "Action");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TAB, 1, 1);
        alt.AddProduction((int) DokiScriptConstants.VOICE_ACTION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TAB, 1, 1);
        alt.AddProduction((int) DokiScriptConstants.OTHER_ACTION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TAB, 1, 1);
        alt.AddToken((int) DokiScriptConstants.TEXT, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.VOICE_ACTION,
                                        "VoiceAction");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.VOICE, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_3, 0, -1);
        alt.AddToken((int) DokiScriptConstants.TEXT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.OTHER_ACTION,
                                        "OtherAction");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.TAG, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_4, 0, -1);
        alt.AddToken((int) DokiScriptConstants.SEMICOLON, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.TAG,
                                        "Tag");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.BACKGROUND, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.WEATHER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.SOUND, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.BGM, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.VIDEO, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.MOVE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.POSTURE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.ROLE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.OTHER, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.KEY,
                                        "Key");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.SRC, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TRANSITION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TIME, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TYPE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.LEVEL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.MODE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.POSITION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.NAME, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.ANCHOR, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.TAG_PARAMETER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY1, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY2, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY3, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY4, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY5, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY6, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY7, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY8, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.KEY9, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.LIVE2D, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.ZOOM, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.VALUE,
                                        "Value");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.COMMA, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.COMMA, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_RIGHT, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.COMMA, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_RIGHT, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.DECIMAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.QUOTED_TEXT, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.FLAG,
                                        "Flag");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.SQUARE_BRACKET_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.QUOTED_TEXT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.COMMA, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_RIGHT, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_5, 0, -1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.SQUARE_BRACKET_RIGHT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.RETURN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.OPTION,
                                        "Option");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.ANGLE_BRACKET_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.CLICK, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.RETURN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) DokiScriptConstants.JUMP,
                                        "Jump");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_RIGHT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.RETURN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_1,
                                        "Subproduction1");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.RETURN, 0, 1);
        alt.AddProduction((int) DokiScriptConstants.ACTION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_2,
                                        "Subproduction2");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.RETURN, 0, 1);
        alt.AddProduction((int) DokiScriptConstants.ACTION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_3,
                                        "Subproduction3");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.KEY, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.EQUAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddProduction((int) DokiScriptConstants.VALUE, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_4,
                                        "Subproduction4");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) DokiScriptConstants.KEY, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.EQUAL, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddProduction((int) DokiScriptConstants.VALUE, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_5,
                                        "Subproduction5");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.OR, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.QUOTED_TEXT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_LEFT, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.COMMA, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) DokiScriptConstants.SPACE, 0, 1);
        alt.AddToken((int) DokiScriptConstants.PARENTHESE_RIGHT, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);
    }
Beispiel #3
0
    /**
     * <summary>Initializes the parser by creating all the production
     * patterns.</summary>
     *
     * <exception cref='ParserCreationException'>if the parser
     * couldn't be initialized correctly</exception>
     */
    private void CreatePatterns() {
        ProductionPattern             pattern;
        ProductionPatternAlternative  alt;

        pattern = new ProductionPattern((int) ExpressionConstants.EXPRESSION,
                                        "Expression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.XOR_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.XOR_EXPRESSION,
                                        "XorExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.OR_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_1, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.OR_EXPRESSION,
                                        "OrExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.AND_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_2, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.AND_EXPRESSION,
                                        "AndExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.NOT_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_3, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.NOT_EXPRESSION,
                                        "NotExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.NOT, 0, 1);
        alt.AddProduction((int) ExpressionConstants.IN_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.IN_EXPRESSION,
                                        "InExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.COMPARE_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_4, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.IN_TARGET_EXPRESSION,
                                        "InTargetExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.FIELD_PROPERTY_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.IN_LIST_TARGET_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.IN_LIST_TARGET_EXPRESSION,
                                        "InListTargetExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.ARGUMENT_LIST, 1, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.COMPARE_EXPRESSION,
                                        "CompareExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.SHIFT_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_6, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.SHIFT_EXPRESSION,
                                        "ShiftExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.ADDITIVE_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_8, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.ADDITIVE_EXPRESSION,
                                        "AdditiveExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.MULTIPLICATIVE_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_10, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.MULTIPLICATIVE_EXPRESSION,
                                        "MultiplicativeExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.POWER_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_12, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.POWER_EXPRESSION,
                                        "PowerExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.NEGATE_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_13, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.NEGATE_EXPRESSION,
                                        "NegateExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.SUB, 0, 1);
        alt.AddProduction((int) ExpressionConstants.MEMBER_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.MEMBER_EXPRESSION,
                                        "MemberExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.BASIC_EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_14, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.MEMBER_ACCESS_EXPRESSION,
                                        "MemberAccessExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.DOT, 1, 1);
        alt.AddProduction((int) ExpressionConstants.MEMBER_FUNCTION_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.BASIC_EXPRESSION,
                                        "BasicExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.LITERAL_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.EXPRESSION_GROUP, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.MEMBER_FUNCTION_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.SPECIAL_FUNCTION_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.MEMBER_FUNCTION_EXPRESSION,
                                        "MemberFunctionExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.FIELD_PROPERTY_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.FUNCTION_CALL_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.FIELD_PROPERTY_EXPRESSION,
                                        "FieldPropertyExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.IDENTIFIER, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.SPECIAL_FUNCTION_EXPRESSION,
                                        "SpecialFunctionExpression");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.IF_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.CAST_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.IF_EXPRESSION,
                                        "IfExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.IF, 1, 1);
        alt.AddToken((int) ExpressionConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.ARGUMENT_SEPARATOR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.ARGUMENT_SEPARATOR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.CAST_EXPRESSION,
                                        "CastExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.CAST, 1, 1);
        alt.AddToken((int) ExpressionConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.ARGUMENT_SEPARATOR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.CAST_TYPE_EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.CAST_TYPE_EXPRESSION,
                                        "CastTypeExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.IDENTIFIER, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_15, 0, -1);
        alt.AddToken((int) ExpressionConstants.ARRAY_BRACES, 0, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.INDEX_EXPRESSION,
                                        "IndexExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LEFT_BRACE, 1, 1);
        alt.AddProduction((int) ExpressionConstants.ARGUMENT_LIST, 1, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_BRACE, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.FUNCTION_CALL_EXPRESSION,
                                        "FunctionCallExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.IDENTIFIER, 1, 1);
        alt.AddToken((int) ExpressionConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.ARGUMENT_LIST, 0, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.ARGUMENT_LIST,
                                        "ArgumentList");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_16, 0, -1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.LITERAL_EXPRESSION,
                                        "LiteralExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.INTEGER, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.REAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.STRING_LITERAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.BOOLEAN_LITERAL_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.HEX_LITERAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.CHAR_LITERAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.NULL_LITERAL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.DATETIME, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.TIMESPAN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.BOOLEAN_LITERAL_EXPRESSION,
                                        "BooleanLiteralExpression");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.TRUE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.FALSE, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) ExpressionConstants.EXPRESSION_GROUP,
                                        "ExpressionGroup");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        alt.AddToken((int) ExpressionConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_1,
                                        "Subproduction1");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.XOR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.OR_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_2,
                                        "Subproduction2");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.OR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.AND_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_3,
                                        "Subproduction3");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.AND, 1, 1);
        alt.AddProduction((int) ExpressionConstants.NOT_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_4,
                                        "Subproduction4");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.IN, 1, 1);
        alt.AddProduction((int) ExpressionConstants.IN_TARGET_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_5,
                                        "Subproduction5");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.EQ, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.GT, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LT, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.GTE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LTE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.NE, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_6,
                                        "Subproduction6");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_5, 1, 1);
        alt.AddProduction((int) ExpressionConstants.SHIFT_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_7,
                                        "Subproduction7");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.LEFT_SHIFT, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.RIGHT_SHIFT, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_8,
                                        "Subproduction8");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_7, 1, 1);
        alt.AddProduction((int) ExpressionConstants.ADDITIVE_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_9,
                                        "Subproduction9");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.ADD, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.SUB, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_10,
                                        "Subproduction10");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_9, 1, 1);
        alt.AddProduction((int) ExpressionConstants.MULTIPLICATIVE_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_11,
                                        "Subproduction11");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.MUL, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.DIV, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.MOD, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_12,
                                        "Subproduction12");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_11, 1, 1);
        alt.AddProduction((int) ExpressionConstants.POWER_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_13,
                                        "Subproduction13");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.POWER, 1, 1);
        alt.AddProduction((int) ExpressionConstants.NEGATE_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_14,
                                        "Subproduction14");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.MEMBER_ACCESS_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) ExpressionConstants.INDEX_EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_15,
                                        "Subproduction15");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.DOT, 1, 1);
        alt.AddToken((int) ExpressionConstants.IDENTIFIER, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_16,
                                        "Subproduction16");
        pattern.Synthetic = true;
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) ExpressionConstants.ARGUMENT_SEPARATOR, 1, 1);
        alt.AddProduction((int) ExpressionConstants.EXPRESSION, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);
    }
Beispiel #4
0
        /**
         * <summary>Initializes the parser by creating all the production
         * patterns.</summary>
         *
         * <exception cref='ParserCreationException'>if the parser
         * couldn't be initialized correctly</exception>
         */
        private void CreatePatterns()
        {
            ProductionPattern             pattern;
            ProductionPatternAlternative  alt;

            pattern = new ProductionPattern((int) GherkinConstants.FEATURE,
                                            "Feature");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TAGS, 0, 1);
            alt.AddProduction((int) GherkinConstants.FEATURE_HEADER, 1, 1);
            alt.AddProduction((int) GherkinConstants.BLANK_LINE, 0, -1);
            alt.AddProduction((int) GherkinConstants.BACKGROUND, 0, 1);
            alt.AddProduction((int) GherkinConstants.FEATURE_ITEM, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.FEATURE_HEADER,
                                            "FeatureHeader");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_FEATURE, 1, 1);
            alt.AddProduction((int) GherkinConstants.SUMMARY_LINE, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.SUMMARY_LINE,
                                            "SummaryLine");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.FREE_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.BACKGROUND,
                                            "Background");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.BACKGROUND_HEADER, 1, 1);
            alt.AddProduction((int) GherkinConstants.STEP, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.BACKGROUND_HEADER,
                                            "BackgroundHeader");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_BACKGROUND, 1, 1);
            alt.AddProduction((int) GherkinConstants.FREE_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.FEATURE_ITEM,
                                            "FeatureItem");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TAGS, 0, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_1, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.SCENARIO,
                                            "Scenario");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.SCENARIO_HEADER, 1, 1);
            alt.AddProduction((int) GherkinConstants.STEP, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.SCENARIO_HEADER,
                                            "ScenarioHeader");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_SCENARIO, 1, 1);
            alt.AddProduction((int) GherkinConstants.FREE_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.SCENARIO_OUTLINE,
                                            "ScenarioOutline");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.SCENARIO_OUTLINE_HEADER, 1, 1);
            alt.AddProduction((int) GherkinConstants.STEP, 1, -1);
            alt.AddProduction((int) GherkinConstants.EXAMPLES, 1, 1);
            alt.AddProduction((int) GherkinConstants.BLANK_LINE, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.SCENARIO_OUTLINE_HEADER,
                                            "ScenarioOutlineHeader");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_SCENARIO_OUTLINE, 1, 1);
            alt.AddProduction((int) GherkinConstants.FREE_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.EXAMPLES,
                                            "Examples");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.EXAMPLES_HEADER, 1, 1);
            alt.AddProduction((int) GherkinConstants.TABLE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.EXAMPLES_HEADER,
                                            "ExamplesHeader");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_EXAMPLES, 1, 1);
            alt.AddProduction((int) GherkinConstants.FREE_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.STEP,
                                            "Step");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.WHITESPACE, 0, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_2, 1, 1);
            alt.AddProduction((int) GherkinConstants.TEXT, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_3, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.BLANK_LINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TABLE,
                                            "Table");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TABLE_ROW, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TABLE_ROW,
                                            "TableRow");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.WHITESPACE, 0, 1);
            alt.AddToken((int) GherkinConstants.PIPE, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_4, 1, -1);
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TABLE_COLUMN,
                                            "TableColumn");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TEXT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.WHITESPACE,
                                            "Whitespace");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.HORIZONTAL_WHITESPACE, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.FREE_LINE,
                                            "FreeLine");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TEXT, 0, 1);
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.BLANK_LINE,
                                            "BlankLine");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TEXT,
                                            "Text");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.WHITESPACE, 0, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_5, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_6, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TAGS,
                                            "Tags");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TAG, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_7, 0, -1);
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) GherkinConstants.TAG,
                                            "Tag");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.AT, 1, 1);
            alt.AddToken((int) GherkinConstants.TEXT_CHAR, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_1,
                                            "Subproduction1");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.SCENARIO, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.SCENARIO_OUTLINE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_2,
                                            "Subproduction2");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_GIVEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_WHEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_THEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_AND, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_BUT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_3,
                                            "Subproduction3");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.COLON, 1, 1);
            alt.AddToken((int) GherkinConstants.EOL, 1, 1);
            alt.AddProduction((int) GherkinConstants.TABLE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_4,
                                            "Subproduction4");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.TABLE_COLUMN, 1, 1);
            alt.AddToken((int) GherkinConstants.PIPE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_5,
                                            "Subproduction5");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.TEXT_CHAR, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.AT, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_FEATURE, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_GIVEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_WHEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_THEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_AND, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_BUT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_6,
                                            "Subproduction6");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.HORIZONTAL_WHITESPACE, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.TEXT_CHAR, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.AT, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_FEATURE, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_BACKGROUND, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_SCENARIO, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_SCENARIO_OUTLINE, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_EXAMPLES, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_GIVEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_WHEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_THEN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_AND, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) GherkinConstants.T_BUT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_7,
                                            "Subproduction7");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) GherkinConstants.WHITESPACE, 1, 1);
            alt.AddProduction((int) GherkinConstants.TAG, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);
        }
Beispiel #5
0
        /**
         * <summary>Initializes the parser by creating all the production
         * patterns.</summary>
         *
         * <exception cref='ParserCreationException'>if the parser
         * couldn't be initialized correctly</exception>
         */
        private void CreatePatterns()
        {
            ProductionPattern             pattern;
            ProductionPatternAlternative  alt;

            pattern = new ProductionPattern((int) CommandGrammarConstants.COMMANDS,
                                            "Commands");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) CommandGrammarConstants.COMMAND, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_1, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) CommandGrammarConstants.COMMAND,
                                            "Command");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) CommandGrammarConstants.EXPRESSION, 1, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) CommandGrammarConstants.EXPRESSION,
                                            "Expression");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) CommandGrammarConstants.TEXT, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) CommandGrammarConstants.STRING, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) CommandGrammarConstants.PARAMETER, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) CommandGrammarConstants.COMMAND_START, 1, 1);
            alt.AddProduction((int) CommandGrammarConstants.COMMAND, 1, 1);
            alt.AddToken((int) CommandGrammarConstants.COMMAND_END, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_1,
                                            "Subproduction1");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) CommandGrammarConstants.COMMAND_SEPARATOR, 1, 1);
            alt.AddProduction((int) CommandGrammarConstants.COMMAND, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);
        }
Beispiel #6
0
        /**
         * <summary>Initializes the parser by creating all the production
         * patterns.</summary>
         *
         * <exception cref='ParserCreationException'>if the parser
         * couldn't be initialized correctly</exception>
         */
        private void CreatePatterns()
        {
            ProductionPattern             pattern;
            ProductionPatternAlternative  alt;

            pattern = new ProductionPattern((int) PicoConstants.PROGRAM,
                                            "Program");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.SEPARATOR, 0, 1);
            alt.AddProduction((int) PicoConstants.SYMBOLS, 1, 1);
            alt.AddProduction((int) PicoConstants.ORIGIN, 1, 1);
            alt.AddProduction((int) PicoConstants.LINES, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.SEPARATOR,
                                            "Separator");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.ENTER, 1, 1);
            alt.AddToken((int) PicoConstants.ENTER, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.SYMBOLS,
                                            "Symbols");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.SYMBOL, 1, 1);
            alt.AddProduction((int) PicoConstants.SYMBOL, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.SYMBOL,
                                            "Symbol");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.IDENTIFIER, 1, 1);
            alt.AddToken((int) PicoConstants.EQUALS, 1, 1);
            alt.AddProduction((int) PicoConstants.INTEGER, 1, 1);
            alt.AddProduction((int) PicoConstants.SEPARATOR, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.INTEGER,
                                            "Integer");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.SIGN, 0, 1);
            alt.AddToken((int) PicoConstants.NUMBER, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ORIGIN,
                                            "Origin");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.ORG, 1, 1);
            alt.AddToken((int) PicoConstants.NUMBER, 1, 1);
            alt.AddProduction((int) PicoConstants.SEPARATOR, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.LINES,
                                            "Lines");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.LINE, 1, 1);
            alt.AddProduction((int) PicoConstants.LINE, 0, -1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.LINE,
                                            "Line");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_1, 0, 1);
            alt.AddProduction((int) PicoConstants.INSTRUCTION, 1, 1);
            alt.AddProduction((int) PicoConstants.SEPARATOR, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.INSTRUCTION,
                                            "Instruction");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.MOVE, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARITHMETIC, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.BRANCH, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.IO, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.CALL, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.RETURN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.END, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.MOVE,
                                            "Move");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.MOV, 1, 1);
            alt.AddProduction((int) PicoConstants.MOVE_ARGS, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARITHMETIC,
                                            "Arithmetic");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_2, 1, 1);
            alt.AddProduction((int) PicoConstants.ARITHMETIC_ARGS, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.BRANCH,
                                            "Branch");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_3, 1, 1);
            alt.AddProduction((int) PicoConstants.BRANCH_ARGS, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.IO,
                                            "IO");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_4, 1, 1);
            alt.AddProduction((int) PicoConstants.IOARGS, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.CALL,
                                            "Call");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.JSR, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG3, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.RETURN,
                                            "Return");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.RTS, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.END,
                                            "End");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.STOP, 1, 1);
            alt.AddProduction((int) PicoConstants.END_ARGS, 0, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.MOVE_ARGS,
                                            "MoveArgs");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_5, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARITHMETIC_ARGS,
                                            "ArithmeticArgs");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_6, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.BRANCH_ARGS,
                                            "BranchArgs");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_8, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.IOARGS,
                                            "IOArgs");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_9, 0, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.END_ARGS,
                                            "EndArgs");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_11, 0, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG12,
                                            "Arg12");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG2, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG34,
                                            "Arg34");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG3, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG4, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG123,
                                            "Arg123");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG2, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG3, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG1234,
                                            "Arg1234");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG2, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG3, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG4, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG1,
                                            "Arg1");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.INTEGER, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG2,
                                            "Arg2");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.HASH, 1, 1);
            alt.AddToken((int) PicoConstants.IDENTIFIER, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG3,
                                            "Arg3");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.IDENTIFIER, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) PicoConstants.ARG4,
                                            "Arg4");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.LEFT_PAREN, 1, 1);
            alt.AddToken((int) PicoConstants.IDENTIFIER, 1, 1);
            alt.AddToken((int) PicoConstants.RIGHT_PAREN, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_1,
                                            "Subproduction1");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.IDENTIFIER, 1, 1);
            alt.AddToken((int) PicoConstants.COLON, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_2,
                                            "Subproduction2");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.ADD, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.SUB, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.MUL, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.DIV, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_3,
                                            "Subproduction3");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.BEQ, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.BGT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_4,
                                            "Subproduction4");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.IN, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.OUT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_5,
                                            "Subproduction5");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1234, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG123, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_6,
                                            "Subproduction6");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG1234, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG12, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_7,
                                            "Subproduction7");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_8,
                                            "Subproduction8");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_7, 1, 1);
            pattern.AddAlternative(alt);
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) PicoConstants.ARG1, 1, 1);
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_9,
                                            "Subproduction9");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG1234, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_10,
                                            "Subproduction10");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) SynteticPatterns.SUBPRODUCTION_11,
                                            "Subproduction11");
            pattern.Synthetic = true;
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) PicoConstants.COMMA, 1, 1);
            alt.AddProduction((int) PicoConstants.ARG34, 1, 1);
            alt.AddProduction((int) SynteticPatterns.SUBPRODUCTION_10, 0, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);
        }
        /**
         * <summary>Initializes the parser by creating all the production
         * patterns.</summary>
         *
         * <exception cref='ParserCreationException'>if the parser
         * couldn't be initialized correctly</exception>
         */
        private void CreatePatterns()
        {
            ProductionPattern             pattern;
            ProductionPatternAlternative  alt;

            pattern = new ProductionPattern((int) IrfConstants.IRF_DOCUMENT,
                                            "IrfDocument");
            alt = new ProductionPatternAlternative();
            alt.AddProduction((int) IrfConstants.ROOT_NODE, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.ROOT_NODE,
                                            "RootNode");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.LT, 1, 1);
            alt.AddToken((int) IrfConstants.PLAYER_NOTES, 1, 1);
            alt.AddProduction((int) IrfConstants.USER_NODE, 0, 1);
            alt.AddToken((int) IrfConstants.GT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.USER_NODE,
                                            "UserNode");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.LT, 1, 1);
            alt.AddToken((int) IrfConstants.PLAYER_NOTE_SET, 1, 1);
            alt.AddToken((int) IrfConstants.USER_NAME, 1, 1);
            alt.AddProduction((int) IrfConstants.PLAYER_NOTE_NODE, 1, -1);
            alt.AddToken((int) IrfConstants.GT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.PLAYER_NOTE_NODE,
                                            "PlayerNoteNode");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.LT, 1, 1);
            alt.AddToken((int) IrfConstants.PLAYER_NOTE, 1, 1);
            alt.AddProduction((int) IrfConstants.PLAYER_NAME_ATTRIBUTE, 1, 1);
            alt.AddProduction((int) IrfConstants.NOTE_TEXT_ATTRIBUTE, 0, 1);
            alt.AddProduction((int) IrfConstants.TIMESTAMP_ATTRIBUTE, 0, 1);
            alt.AddProduction((int) IrfConstants.CLASSIFICATION_ATTRIBUTE, 0, 1);
            alt.AddToken((int) IrfConstants.GT, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.PLAYER_NAME_ATTRIBUTE,
                                            "PlayerNameAttribute");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.PLAYER_NAME, 1, 1);
            alt.AddToken((int) IrfConstants.EQUAL, 1, 1);
            alt.AddToken((int) IrfConstants.QUOTED_STRING, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.NOTE_TEXT_ATTRIBUTE,
                                            "NoteTextAttribute");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.NOTE_TEXT, 1, 1);
            alt.AddToken((int) IrfConstants.EQUAL, 1, 1);
            alt.AddToken((int) IrfConstants.QUOTED_STRING, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.TIMESTAMP_ATTRIBUTE,
                                            "TimestampAttribute");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.TIMESTAMP, 1, 1);
            alt.AddToken((int) IrfConstants.EQUAL, 1, 1);
            alt.AddToken((int) IrfConstants.QUOTED_STRING, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);

            pattern = new ProductionPattern((int) IrfConstants.CLASSIFICATION_ATTRIBUTE,
                                            "ClassificationAttribute");
            alt = new ProductionPatternAlternative();
            alt.AddToken((int) IrfConstants.CLASSIFICATION, 1, 1);
            alt.AddToken((int) IrfConstants.EQUAL, 1, 1);
            alt.AddToken((int) IrfConstants.QUOTED_STRING, 1, 1);
            pattern.AddAlternative(alt);
            AddPattern(pattern);
        }
Beispiel #8
0
    /**
     * <summary>Initializes the parser by creating all the production
     * patterns.</summary>
     *
     * <exception cref='ParserCreationException'>if the parser
     * couldn't be initialized correctly</exception>
     */
    private void CreatePatterns()
    {
        ProductionPattern             pattern;
        ProductionPatternAlternative  alt;

        pattern = new ProductionPattern((int) LogicalConstants.FORMULE,
                                        "FORMULE");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.NOT, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.FORALL, 1, 1);
        alt.AddToken((int) LogicalConstants.VAR, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EXISTS, 1, 1);
        alt.AddToken((int) LogicalConstants.VAR, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) LogicalConstants.PREDICAT, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE_PRED, 0, -1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE_BIN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.FORMULE_PRED,
                                        "FORMULE_PRED");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AND, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.OR, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.IMPLY, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.FORMULE_BIN,
                                        "FORMULE_BIN");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AND, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.OR, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.IMPLY, 1, 1);
        alt.AddProduction((int) LogicalConstants.FORMULE, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.ATOM,
                                        "ATOM");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.CSTE, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.VAR, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.PREDICAT,
                                        "PREDICAT");
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) LogicalConstants.PRED1, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) LogicalConstants.PRED2, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddProduction((int) LogicalConstants.PRED3, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.PRED1,
                                        "PRED1");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.ROSE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.PAQUERETTE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.TULIPE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_GRAND, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_MOYEN, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_PETIT, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_ROUGE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_ROSE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_BLANC, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.A_L_EST, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.A_L_OUEST, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AU_SUD, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AU_NORD, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.PRED2,
                                        "PRED2");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.A_L_EST_DE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.A_L_OUEST_DE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AU_SUD_DE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.AU_NORD_DE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.MEME_LONGITUDE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.MEME_LATITUDE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.PLUS_GRAND_QUE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.PLUS_PETIT_QUE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.MEME_TAILLE_QUE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.MEME_COULEUR_QUE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EGAL, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);

        pattern = new ProductionPattern((int) LogicalConstants.PRED3,
                                        "PRED3");
        alt = new ProductionPatternAlternative();
        alt.AddToken((int) LogicalConstants.EST_ENTRE, 1, 1);
        alt.AddToken((int) LogicalConstants.LEFT_PAREN, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.COMMA, 1, 1);
        alt.AddProduction((int) LogicalConstants.ATOM, 1, 1);
        alt.AddToken((int) LogicalConstants.RIGHT_PAREN, 1, 1);
        pattern.AddAlternative(alt);
        AddPattern(pattern);
    }