Esempio n. 1
0
        public class RuleRetDecl : RuleSequence {  //-> BASETYPE [S NAME ] (, BASETYPE [S NAME])*
            public RuleRetDecl(Rule Parent)
                : base(Parent)
            {
                RuleAlternative w = new RuleAlternative(this);
                RuleSequence    u = new RuleSequence(this);

                u.AddNode(new RuleBaseType(this));
                u.AddNode(new RuleSpace(this));
                u.AddNode(new RuleName(this));
                w.AddNode(u);
                u = new RuleSequence(this);
                u.AddNode(new RuleBaseType(this));
                w.AddNode(u);

                this.AddNode(new RuleRegex(this, "->" + s_ManyWhitespace, this));
                this.AddNode(w);
                RuleSequence x = new RuleSequence(this);

                x.AddNode(new RuleSeparator(this));
                x.AddNode(w);
                RuleMultiple y = new RuleMultiple(this, 0);

                y.AddNode(x);
                this.AddNode(y);
            }
Esempio n. 2
0
        public class RuleParams : RuleMultiple {   // NAME S (, S NAME S )*
            public RuleParams(Rule Parent)
                : base(Parent, 0)
            {
                RuleAlternative par = new RuleAlternative(m_Parent);

                par.AddNode(new RuleName(m_Parent));
                par.AddNode(new RuleNumber(m_Parent));
                par.AddNode(new RuleString(m_Parent));
                par.AddNode(new RuleBool(m_Parent));

                RuleSequence z = new RuleSequence(this);

                z.AddNode(par);
                RuleSequence x = new RuleSequence(this);

                x.AddNode(new RuleSeparator(this));
                x.AddNode(z);
                RuleMultiple y = new RuleMultiple(this, 0);

                y.AddNode(x);
                RuleSequence w = new RuleSequence(this);

                w.AddNode(z);
                w.AddNode(y);
                this.AddNode(w);
            }
Esempio n. 3
0
        public class RuleBoolExpr : RuleSequence {   //RuleBoolVarExpr (S ('||' / '&&') S RuleBoolVarExpr)*;
            public RuleBoolExpr(Rule Parent)
                : base(Parent)
            {
                this.AddNode(new RuleBoolVarExpr(Parent));
                RuleSequence x = new RuleSequence(Parent);

                x.AddNode(new RuleRegex(m_Parent, "(\\|\\||\\&\\&)", this));      //todo Number <= Number bool!=bool \\=\\=|\\>\\=|\\<\\=|\\>|\\<|\\!\\=
                x.AddNode(new RuleBoolVarExpr(Parent));
                RuleMultiple y = new RuleMultiple(Parent, 0);

                y.AddNode(x);
                this.AddNode(y);
            }
Esempio n. 4
0
        public class RuleMultExpr : RuleSequence {   //power_expression (S ('*' / '/') S power_expression)*;
            public RuleMultExpr(Rule Parent)
                : base(Parent)
            {
                this.AddNode(new RulePlusExpr(Parent));
                RuleSequence x = new RuleSequence(Parent);

                x.AddNode(new RuleRegex(m_Parent, "(\\*|/)", this));
                x.AddNode(new RulePlusExpr(Parent));
                RuleMultiple y = new RuleMultiple(Parent, 0);

                y.AddNode(x);
                this.AddNode(y);
            }
Esempio n. 5
0
        public class RuleExpr : RuleSequence {  //multiplicative_expression (S ('+' / '-') S multiplicative_expression)*
            public RuleExpr(Rule Parent)
                : base(Parent)
            {
                m_Parent = this;
                this.AddNode(new RuleSpaceOptional(m_Parent));
                this.AddNode(new RuleMultExpr(m_Parent));
                RuleSequence x = new RuleSequence(m_Parent);

                x.AddNode(new RuleRegex(m_Parent, "(\\+|\\-)", this));
                x.AddNode(new RuleMultExpr(m_Parent));
                RuleMultiple y = new RuleMultiple(m_Parent, 0);

                y.AddNode(x);
                this.AddNode(y);
            }
Esempio n. 6
0
        public class RuleReturns : RuleSequence {   //-> NAME (, NAME)*
            public RuleReturns(Rule Parent)
                : base(Parent)
            {
                RuleSequence u = new RuleSequence(this);

                u.AddNode(new RuleName(this));

                this.AddNode(new RuleRegex(this, "->" + s_ManyWhitespace, this));
                this.AddNode(u);
                RuleSequence x = new RuleSequence(this);

                x.AddNode(new RuleSeparator(this));
                x.AddNode(u);
                RuleMultiple y = new RuleMultiple(this, 0);

                y.AddNode(x);
                this.AddNode(y);
            }
Esempio n. 7
0
        public class RuleSwitch : RuleSequence { //'switch' S* '(' EXPRESSION ')' (COMMENT | EOL) '{' EOL
                                                 //('case ' VALUE ':' EOL
                                                 //    ...
                                                 //    BREAK )?
                                                 // 'default:' EOL
                                                 //    ...
                                                 //'}'
            public RuleSwitch(Rule Parent)
                : base(Parent)
            {
                m_Parent = this;
                this.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "\\bswitch\\b" + s_ManyWhitespace, this));
                this.AddNode(new RuleLPar(m_Parent));
                this.AddNode(new RuleName(m_Parent));
                this.AddNode(new RuleRPar(m_Parent));
                this.AddNode(new RuleEOLComment(m_Parent));
                this.AddNode(new RuleLCurlPar(m_Parent));
                RuleMultiple x = new RuleMultiple(m_Parent, 0);

                x.AddNode(new RuleSwitchCase(m_Parent));
                this.AddNode(x);
                RuleOption y = new RuleOption(m_Parent);

                y.AddNode(new RuleSwitchDefault(m_Parent));
                this.AddNode(y);
                this.AddNode(new RuleRCurlPar(m_Parent));
            }
Esempio n. 8
0
        public class RuleParamDecl : RuleMultiple {  // BASETYPE S NAME S (, BASETYPE S NAME S )*
            public RuleParamDecl(Rule Parent)
                : base(Parent, 0)
            {
                RuleSequence z = new RuleSequence(this);

                z.AddNode(new RuleBaseType(this));
                z.AddNode(new RuleSpace(this));
                z.AddNode(new RuleName(this));
                RuleSequence x = new RuleSequence(this);

                x.AddNode(new RuleSeparator(this));
                x.AddNode(z);
                RuleMultiple y = new RuleMultiple(this, 0);

                y.AddNode(x);
                RuleSequence w = new RuleSequence(this);

                w.AddNode(z);
                w.AddNode(y);
                this.AddNode(w);
            }