public Rule_If_Then_Else_End(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*

            <If_Statement>                  ::=   IF <Expression> THEN  <Statements>  END-IF
                                                | IF <Expression> THEN  <Statements>  END
            <If_Else_Statement>              ::=  IF <Expression> THEN  <Statements> <Else_If_Statement>  END-IF
                                                | IF <Expression> THEN  <Statements>  <Else_If_Statement>  END
                                                    IF <Expression> THEN <Statements> ELSE  <Statements>  END-IF
                                                | IF <Expression> THEN <Statements> ELSE  <Statements>  END
             */

            IfClause = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            ThenClause = EnterRule.BuildStatments(pContext, pToken.Tokens[3]);
            if (this.GetCommandElement(pToken.Tokens, 4).Equals("Else", StringComparison.OrdinalIgnoreCase))
            {
                ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[5]);
            }
                /*
            else
            {
                ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[4]);
            }*/
        }
Esempio n. 2
0
 public Rule_CheckCodeBlock(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     /* <CheckCodeBlock> ::=   <DefineVariables_Statement>
                         | <View_Checkcode_Statement>
                         | <Record_Checkcode_Statement>
             | <Page_Checkcode_Statement>
             | <Field_Checkcode_Statement>
             | <Subroutine_Statement>  */
     switch (pToken.Rule.Rhs[0].ToString())
     {
         case "<DefineVariables_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<View_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Record_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Page_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Field_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Subroutine_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
     }
 }
Esempio n. 3
0
 public Rule_Define_Group(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Define_Group_Statement> ::= DEFINE Identifier GROUPVAR <IdentifierList>
     this.Identifier = this.GetCommandElement(pToken.Tokens, 1);
     this.IdentifierList.AddRange(this.GetCommandElement(pToken.Tokens, 3).Split(' '));
 }
 public ReduceEventArgs(Rule rule, NonterminalToken token, State newState)
 {
     this.rule     = rule;
     this.token    = token;
     this.newState = newState;
     this.contin   = true;
 }
Esempio n. 5
0
        public Rule_CoxPH(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*
            <Simple_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' DecLiteral ')' <CoxOptList>
            <Boolean_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' Boolean ')' <CoxOptList>*/

            //!COXPH <time variable>= <covariate(s)>[: <time function>:]  *  <censor variable> (<value>) [TIMEUNIT="<time unit>"] [OUTTABLE=<tablename>] [GRAPHTYPE="<graph type>"] [WEIGHTVAR=<weight variable>] [STRATAVAR=<strata variable(s)>] [GRAPH=<graph variable(s)>]

            string[] saCensorArray;

            this.commandText = this.ExtractTokens(pToken.Tokens);
            this.time_variable = this.GetCommandElement(pToken.Tokens, 1).Trim(new char[] {'[',']'});

            saCensorArray = GetUncensoredVarVal(this.GetCommandElement(pToken.Tokens, 5));
            this.censor_variable = saCensorArray[0].Trim(new char[] { '[', ']' });
            this.censor_value = saCensorArray[1].Trim(new char[] { '[', ']' });

            this.SetTermList((NonterminalToken) pToken.Tokens[3]);

            if (pToken.Tokens.Length > 6)
            {
                this.SetOptionList((NonterminalToken)pToken.Tokens[6]);
            }
        }
Esempio n. 6
0
        public Rule_Statements(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Statements> ::= <Statements> <Statement> | <Statement>

               if (pToken.Tokens.Length > 1)
               {
               //NonterminalToken T;
               //T = (NonterminalToken)pToken.Tokens[0];
               //this.statements = new Rule_Statements(pContext, T);
               statements = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]);

               //T = ((NonterminalToken)pToken.Tokens[1]);
               //this.statement = new Rule_Statement(pContext, T);
               statement = AnalysisRule.BuildStatments(pContext, pToken.Tokens[1]);

               }
               else
               {
               //NonterminalToken T;
               //T = (NonterminalToken)pToken.Tokens[0];
               //this.statement = new Rule_Statement(pContext, T);
               statement = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]);
               }
        }
Esempio n. 7
0
		public ReduceEventArgs(Rule rule, NonterminalToken token, State newState)
		{
			this.rule = rule;
			this.token = token;
			this.newState = newState;
			this.contin = true;
		}
        public Rule_Autosearch_Function(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*<Auto_Search_Statement> ::= AUTOSEARCH <IdentifierList>
                                          |AUTOSEARCH <IdentifierList> Always
                                          |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList>
                                          |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList> Always*/

            this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).Split(' ');
            if (pToken.Tokens.Length > 2)
            {

                if (pToken.Tokens[2].ToString().Equals("Always",StringComparison.OrdinalIgnoreCase))
                {
                    this.AlwaysShow = true;
                }
                else
                {
                    this.DisplayList = this.GetCommandElement(pToken.Tokens, 3).Split(' ');
                }
            }

            if (pToken.Tokens.Length == 5)
            {
                this.AlwaysShow = true;
            }
        }
Esempio n. 9
0
        public Rule_Report(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Report_Display_Statement>   ::= REPORT File DISPLAY
            // <Report_File_Statement>      ::= REPORT File TO File
            // <Report_Print_Statement>     ::= REPORT File String

            epiReportExecutablePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            epiReportExecutablePath = Path.Combine(epiReportExecutablePath, "EpiReport.exe");

            templatePath = this.GetCommandElement(pToken.Tokens, 1);
            option = this.GetCommandElement(pToken.Tokens, 2);
            selectedPrinter = String.Empty;

            if (option.ToUpper() == CommandNames.TO.ToUpper())
            {
                reportHtmlPath = this.GetCommandElement(pToken.Tokens, 3);
            }
            else if (option.ToUpper() != CommandNames.DISPLAY.ToUpper())
            {
                selectedPrinter = this.GetCommandElement(pToken.Tokens, 2);
                option = "PRINT";
            }

            string commandLineArguments = string.Format(" /template:\"{0}\"", templatePath);
            commandlineString = epiReportExecutablePath + " " + commandLineArguments;
        }
Esempio n. 10
0
        public Rule_Assign(Rule_Context pContext, NonterminalToken pTokens)
            : base(pContext)
        {
            //ASSIGN <Qualified ID> '=' <Expression>
            //<Let_Statement> ::= LET Identifier '=' <Expression>
            //<Simple_Assign_Statement> ::= Identifier '=' <Expression>

            switch(pTokens.Rule.Lhs.ToString())
            {

                case "<Assign_Statement>":
                    //NonterminalToken T = (NonterminalToken)pTokens.Tokens[1];
                    //this.QualifiedId = T.Tokens[0].ToString();
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);

                    break;
                case "<Let_Statement>":
                    //this.QualifiedId = pTokens.Tokens[1].ToString();
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);
                    break;
                case "<Simple_Assign_Statement>":
                    //Identifier '=' <Expression>
                    //T = (NonterminalToken)pTokens.Tokens[1];
                    //this.QualifiedId = this.GetCommandElement(pTokens.Tokens, 0);
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[0]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[2]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[2]);
                    break;
            }
        }
Esempio n. 11
0
        public Rule_CompareExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Concat Exp> LIKE String
            // <Concat Exp> '=' <Compare Exp>
            // <Concat Exp> '<>' <Compare Exp>
            // <Concat Exp> '>' <Compare Exp>
            // <Concat Exp> '>=' <Compare Exp>
            // <Concat Exp> '<' <Compare Exp>
            // <Concat Exp> '<=' <Compare Exp>
            // <Concat Exp>

            //this.ConcatExp = new Rule_ConcatExp(pContext, (NonterminalToken)pToken.Tokens[0]);
            this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]));
            if (pToken.Tokens.Length > 1)
            {
                op = pToken.Tokens[1].ToString();

                if (pToken.Tokens[1].ToString().Equals("LIKE", StringComparison.OrdinalIgnoreCase))
                {
                    this.STRING = pToken.Tokens[2].ToString().Trim(new char[] {'"'});
                }
                else
                {
                    //this.CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[2]);
                    this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]));
                }
            }
        }
Esempio n. 12
0
 private void DoReleaseTokens(NonterminalToken token)
 {
     if ((StoreTokens == StoreTokensMode.Never) ||
         (StoreTokens == StoreTokensMode.NoUserObject && token.UserObject != null))
     {
         token.ClearTokens();
     }
 }
Esempio n. 13
0
 public Rule_Printout(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     if (pToken.Tokens.Length > 1)
     {
         file = this.GetCommandElement(pToken.Tokens, 1);
     }
 }
Esempio n. 14
0
        private string _getActualVarType(NonterminalToken token)
        {
            string assign_var_name = ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Text;
            string actual_var_type;

            _declarations.TryGetValue(assign_var_name, out actual_var_type);

            return(actual_var_type);
        }
Esempio n. 15
0
 public Rule_Program(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Program> ::= <CheckCodeBlocks> | !Eof
     if (pToken.Tokens.Length > 0)
     {
         CheckCodeBlocks = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
 }
Esempio n. 16
0
 public Rule_Geocode(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     // Geocode address_field_name, latitude_field_name, longitude_field_name
     //<Geocode_Statement> ::= Geocode Identifier ',' Identifier ',' Identifier
     this.address_field_name = this.GetCommandElement(pToken.Tokens, 1);
     this.latitude_field_name = this.GetCommandElement(pToken.Tokens, 3);
     this.longitude_field_name = this.GetCommandElement(pToken.Tokens, 5);
 }
Esempio n. 17
0
        public Rule_Help(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Help_Statement> ::= HELP file String
            // file = filepath
            // String = Anchor

            this.FileName = this.GetCommandElement(pToken.Tokens,1);
            this.AnchorString = this.GetCommandElement(pToken.Tokens, 2);
        }
 public Rule_Subroutine_Statement(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Subroutine_Statement> ::= Sub Identifier <Statements> End | Sub Identifier End
     this.Identifier = this.GetCommandElement(pToken.Tokens, 1);
     if (pToken.Tokens.Length > 3)
     {
         this.Statements = AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]);
     }
 }
Esempio n. 19
0
        public void Parse(string source)
        {
            NonterminalToken token = parser.Parse(source);

            if (token != null)
            {
                Object obj = CreateObject(token);
                //todo: Use your object any way you like
            }
        }
Esempio n. 20
0
        public Rule_PowExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /* 	::= <Negate Exp> '^' <Negate Exp>  | <Negate Exp> */

            this.NegateExp1 = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.NegateExp2 = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
Esempio n. 21
0
        private void DoReduce(Token token, ReduceAction action)
        {
            int reduceLength = action.Rule.Rhs.Length;

            State currentState;
            // Do not reduce if the rule is single nonterminal and TrimReductions is on
            bool skipReduce = ((TrimReductions) && (reduceLength == 1) && (action.Rule.Rhs[0] is SymbolNonterminal));

            if (skipReduce)
            {
                stateStack.Pop();
                currentState = stateStack.Peek();
            }
            else
            {
                Token[] tokens = new Token[reduceLength];
                for (int i = 0; i < reduceLength; i++)
                {
                    stateStack.Pop();
                    tokens[reduceLength - i - 1] = tokenStack.Pop();
                }
                NonterminalToken nttoken;
                if (reduceLength == 0)
                {
                    nttoken = new NonterminalToken(action.Rule, tokens, token.Location);
                }
                else
                {
                    nttoken = new NonterminalToken(action.Rule, tokens, tokens[reduceLength - 1].Location);
                }

                tokenStack.Push(nttoken);
                currentState = stateStack.Peek();

                if (OnReduce != null)
                {
                    ReduceEventArgs args = new ReduceEventArgs(action.Rule, nttoken, currentState);
                    OnReduce(this, args);
                    DoReleaseTokens(args.Token);

                    continueParsing = args.Continue;
                }
            }
            Action gotoAction = currentState.Actions.Get(action.Rule.Lhs);

            if (gotoAction is GotoAction)
            {
                DoGoto(token, (GotoAction)gotoAction);
            }
            else
            {
                throw new ParserException("Invalid action table in state");
            }
        }
Esempio n. 22
0
        public void Parse(string source)
        {
            NonterminalToken token = parser.Parse(source);

            if (token != null)
            {
                MainForm.mainForm.ClearShowInputError();
                Expression exp = (Expression)CreateObject(token);
                MainForm.mainForm.WriteResult(exp.Evaluate().ToString());
            }
        }
Esempio n. 23
0
 public Rule_Delete_File(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext, pToken)
 {
     string trimChars = "'";
     filePath = GetCommandElement(pToken.Tokens, 1).Trim(trimChars.ToCharArray());
     if (pToken.Tokens.Length > 2)
     {
         deleteOptions.AddRange(GetCommandElement(pToken.Tokens, 2).ToUpper().Split(StringLiterals.SPACE.ToCharArray()));
         runSilent = deleteOptions.Contains("RUNSILENT");
     }
 }
 public Rule_Begin_Before_Statement(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Begin_Before_statement> ::= Begin-Before <Statements> End | Begin-Before End |!Null
     if (pToken.Tokens.Length > 2)
     {
         //NonterminalToken T = (NonterminalToken)pToken.Tokens[1];
         //this.Statements = new Rule_Statements(pContext, T);
         this.Statements = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
     }
 }
        public Rule_Define_Statement_Group(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Define_Statement_Group> ::= <Define_Statement_Type> <Define_Statement_Group> | <Define_Statement_Type>

            Define_Statement_Type = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);

            if (pToken.Tokens.Length > 1)
            {
                Define_Statement_Group = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            }
        }
Esempio n. 26
0
        public Rule_Read(Rule_Context context, NonterminalToken nonterminal)
            : base(context)
        {
            switch (nonterminal.Rule.Lhs.ToString())
            {
                case "<Simple_Read_Statement>":
                    _isSimpleRead = true;
                    _readOptions = GetCommandElement(nonterminal.Tokens, 1);
                    if (nonterminal.Tokens[2] is NonterminalToken)
                    {
                        Identifier = SetQualifiedId(nonterminal.Tokens[2]);
                    }
                    else
                    {
                        Identifier = GetCommandElement(nonterminal.Tokens, 2).Trim(new char[] { '[', ']' });
                    }
                    break;
                case "<Read_Sql_Statement>":
                    if (nonterminal.Tokens.Length > 4)
                    {
                        File = GetCommandElement(nonterminal.Tokens, 2).Trim('"');
                        Identifier = SetQualifiedId(nonterminal.Tokens[4]);
                    }
                    else
                    {   File = GetCommandElement(nonterminal.Tokens, 1).Trim(new char[] { '{', '}' });

                        if (nonterminal.Tokens[3] is NonterminalToken)
                        {
                            Identifier = SetQualifiedId(nonterminal.Tokens[3]);
                        }
                        else
                        {
                            Identifier = GetCommandElement(nonterminal.Tokens, 3).Trim(new char[] { '[', ']' });
                        }
                    }
                    break;
                default:
                    File = GetCommandElement(nonterminal.Tokens, 1);
                    if (nonterminal.Tokens[3] is NonterminalToken)
                    {
                        Identifier = SetQualifiedId(nonterminal.Tokens[3]);
                    }
                    else
                    {
                        Identifier = GetCommandElement(nonterminal.Tokens, 3).Trim(new char[] { '[', ']' });
                    }
                    if (nonterminal.Tokens.Length > 4)
                    {
                        _linkName = GetCommandElement(nonterminal.Tokens, 4);
                    }
                    break;
            }
        }
Esempio n. 27
0
        public Rule_AndExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Not Exp> AND <And Exp>
            // <Not Exp>

            this.NotExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.AndExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
        public Rule_DefineVariables_Statement(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            this.TextField = this.ExtractTokensWithFormat(pToken.Tokens);

            //<DefineVariables_Statement> ::= DefineVariables <Define_Statement_Group> End-DefineVariables
            if (pToken.Tokens.Length > 2)
            {
                //define_Statements_Group = new Rule_Define_Statement_Group(pContext, (NonterminalToken)pToken.Tokens[1]);
                define_Statements_Group = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            }
        }
Esempio n. 29
0
        public Rule_ExprList(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*::= <Expression> ',' <Expr List> | <Expression> */

            this.Expression = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);

            if (pToken.Tokens.Length > 1)
            {
                this.ExprList = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
Esempio n. 30
0
        public Rule_PowExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /* 	::= <Negate Exp> '^' <Negate Exp>  | <Negate Exp> */

            //this.ParameterList[0] = new Rule_NegateExp(pContext, (NonterminalToken)pToken.Tokens[0]);
            this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]));
            if (pToken.Tokens.Length > 1)
            {
                //this.ParameterList[1] = new Rule_NegateExp(pContext, (NonterminalToken)pToken.Tokens[2]);
                this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]));
            }
        }
Esempio n. 31
0
        public Rule_ConcatExp(Rule_Context context, NonterminalToken token)
            : base(context)
        {
            //  ::= <Add Exp> '&' <Concat Exp> | <Add Exp>

            parameterList.Add(AnalysisRule.BuildStatments(context, token.Tokens[0]));

            if (token.Tokens.Length > 1)
            {
                operand = token.Tokens[1].ToString();
                parameterList.Add(AnalysisRule.BuildStatments(context, token.Tokens[2]));
            }
        }
Esempio n. 32
0
 public Rule_CheckCodeBlocks(Rule_Context pContext, NonterminalToken pToken)
 {
     //<CheckCodeBlocks> ::= <CheckCodeBlock> <CheckCodeBlocks> | <CheckCodeBlock>
     if (pToken.Tokens.Length > 1)
     {
         CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
         CheckCodeBlocks = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
     }
     else
     {
         CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
 }
Esempio n. 33
0
        /// <summary>
        /// Constructor - Rule_Display
        /// </summary>
        /// <param name="pToken">The token to be parsed.</param>
        /// <returns>void</returns>
        public Rule_Display(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            this.commandText = this.ExtractTokens(pToken.Tokens);

            // <Variables_Display_Statement>    ::= DISPLAY DBVARIABLES <DbVariablesOpt> <DisplayOpt>
            // <Views_Display_Statement> 		::= DISPLAY DBVIEWS <DbViewsOpt> <DisplayOpt>
            // <Tables_Display_Statement> 		::= DISPLAY TABLES <DbViewsOpt> <DisplayOpt>

            // <DbVariablesOpt> ::= DEFINE | FIELDVAR | LIST <IdentifierList> | <IdentifierList> | !Null
            // <DisplayOpt> ::= <DefaultDisplayOpt> | !Null
            // <DefaultDisplayOpt> ::= OUTTABLE '=' Identifier
            // <DbViewsOpt> ::= <DefaultDbViewsOpt> | !Null
            // <DefaultDbViewsOpt> ::= File

            this.displayType = this.GetCommandElement(pToken.Tokens, 1);

            switch (pToken.Rule.Lhs.ToString())
            {
                case "<Variables_Display_Statement>":
                    if (pToken.Tokens.Length > 2)
                    {
                        dbVariablesOpt = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '"' }).ToUpper();
                        if (dbVariablesOpt.ToUpper().StartsWith(CommandNames.LIST))
                        {
                            identifierList = dbVariablesOpt.Substring(4).Trim();
                        }
                    }
                    break;
                case "<Views_Display_Statement>":
                case "<Tables_Display_Statement>":
                    if (pToken.Tokens.Length > 2)
                    {
                        dbViewsOpt = this.GetCommandElement(pToken.Tokens, 2);
                    }
                    break;
            }

            if (pToken.Tokens.Length > 3)
            {
                if (!string.IsNullOrEmpty(this.GetCommandElement(pToken.Tokens, 3)))
                {
                    string tokenFour = this.GetCommandElement(pToken.Tokens, 3);
                    if (tokenFour.ToUpper().Contains("OUTTABLE"))
                    {
                        outTable = this.GetCommandElement(pToken.Tokens, 3);
                        outTable = outTable.Substring(outTable.LastIndexOf('=') + 1).Trim();
                    }
                }
            }
        }
Esempio n. 34
0
        public Rule_ConcatExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*::= <Add Exp> '&' <Concat Exp>
               						| <Add Exp>*/

            this.AddExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.op = pToken.Tokens[1].ToString();

                this.ConcatExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
Esempio n. 35
0
 public Rule_NotExp(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Not Exp> ::= NOT <Compare Exp> | <Compare Exp>
     if (pToken.Tokens.Length == 1)
     {
         CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
     else
     {
         CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
         this.isNotStatement = true;
     }
 }
        public Rule_Assign_DLL_Statement(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Assign_DLL_Statement>  ::= ASSIGN <Qualified ID> '=' identifier'!'Identifier '(' <FunctionParameterList> ')'

            this.QualifiedId = this.GetCommandElement(pToken.Tokens, 1);
            this.ClassName = this.GetCommandElement(pToken.Tokens, 3);
            this.MethodName  = this.GetCommandElement(pToken.Tokens, 5);
            this.ParameterList = new Rule_FunctionParameterList(pContext, (NonterminalToken)pToken.Tokens[7]);
            if (!this.Context.AssignVariableCheck.ContainsKey(this.QualifiedId.ToLower()))
            {
                this.Context.AssignVariableCheck.Add(this.QualifiedId.ToLower(), this.QualifiedId.ToLower());
            }
        }
Esempio n. 37
0
        public static Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_EXPRESSION_PLUS:
                return(new AddExpression(
                           (Expression)token.Tokens[0].UserObject,
                           (Expression)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_EXPRESSION_MINUS:
                return(new SubtractExpression(
                           (Expression)token.Tokens[0].UserObject,
                           (Expression)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_EXPRESSION:
                return((Expression)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_MULTEXP_TIMES:
                return(new MultiplyExpression(
                           (Expression)token.Tokens[0].UserObject,
                           (Expression)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_MULTEXP_DIV:
                return(new DivideExpression(
                           (Expression)token.Tokens[0].UserObject,
                           (Expression)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_MULTEXP:
                return((Expression)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_NEGATEEXP_MINUS:
                return(new NegateExpression(
                           (Expression)token.Tokens[1].UserObject));

            case (int)RuleConstants.RULE_NEGATEEXP:
                return((Expression)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_VALUE_INTEGER:
                return((Expression)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_VALUE_FLOAT:
                return((Expression)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_VALUE_LPARAN_RPARAN:
                return((Expression)token.Tokens[1].UserObject);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 38
0
        public Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_ID__ID:
                //<id> ::= '_Id'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STRINGCONSTANT__STRING:
                //<string-constant> ::= '_String'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EMPTY:
                //<empty> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NATURALCONSTANT__DIGITS:
                //<natural-constant> ::= <digits>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IDTYPELIST_COLON:
            //<id-type-list> ::= <id> ':' <type> <empty>
            //todo: Create a new object using the stored user objects.

            // return null;

            case (int)RuleConstants.RULE_IDTYPELIST_COLON_COMMA:
                //<id-type-list> ::= <id> ':' <type> ',' <id-type-list>
                //todo: Create a new object using the stored user objects.

                string decl_var_name = ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Text;
                string decl_var_type = ((TerminalToken)((NonterminalToken)token.Tokens[2]).Tokens[0]).Text;

                _declarations.Add(decl_var_name, decl_var_type + "-constant");
                return(null);

            case (int)RuleConstants.RULE_DECLS_DECLARE_SEMI:
                //<decls> ::= declare <id-type-list> ';'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_TYPE_NATURAL:
                //<type> ::= natural
                //todo: Create a new object using the stored user objects.
                //_declarations.Add(token.Tokens[0].ToString(), "natural-constant");
                return(null);

            case (int)RuleConstants.RULE_TYPE_STRING:
                //<type> ::= string
                //todo: Create a new object using the stored user objects.
                //_declarations.Add(token.Tokens[0].ToString(), "string-constant");
                return(null);

            case (int)RuleConstants.RULE_SERIES:
                //<series> ::= <empty>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SERIES2:
                //<series> ::= <stat> <empty>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SERIES_SEMI:
                //<series> ::= <stat> ';' <series>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT:
                //<stat> ::= <assign>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT2:
                //<stat> ::= <if>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT3:
                //<stat> ::= <while>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT4:
                //<stat> ::= <for>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ASSIGN_COLONEQ:
                //<assign> ::= <id> ':=' <exp>
                //todo: Create a new object using the stored user objects.
                string actual_var_type = _getActualVarType(token);
                if (actual_var_type == null)
                {
                    String   file_name         = _mainForm.getFileName();
                    String   error_type        = "Syntax error";
                    Location error_location    = ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Location;
                    String   line_number       = (error_location.LineNr + 1).ToString();
                    String   col_number        = error_location.ColumnNr.ToString();
                    String   error_description = "Undeclared variable '" + ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Text + "'.";
                    _insertError(file_name, error_type, line_number, col_number, error_description);
                }

                else if (!_isTypeValid(token, actual_var_type))
                {
                    String   file_name         = _mainForm.getFileName();
                    String   error_type        = "Syntax error";
                    Location error_location    = ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Location;
                    String   line_number       = (error_location.LineNr + 1).ToString();
                    String   col_number        = error_location.ColumnNr.ToString();
                    String   error_description = "Invalid data type of assigned value to variable '" + ((TerminalToken)((NonterminalToken)token.Tokens[0]).Tokens[0]).Text + "'.";
                    _insertError(file_name, error_type, line_number, col_number, error_description);
                }

                return(null);

            case (int)RuleConstants.RULE_EXP:
                //<exp> ::= <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP2:
                //<exp> ::= <plus>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP3:
                //<exp> ::= <minus>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP4:
                //<exp> ::= <conc>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY:
                //<primary> ::= <id>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY2:
                //<primary> ::= <natural-constant>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY3:
                //<primary> ::= <string-constant>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY_LPAREN_RPAREN:
                //<primary> ::= '(' <exp> ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PLUS_PLUS:
                //<plus> ::= <exp> '+' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_MINUS_MINUS:
                //<minus> ::= <exp> '-' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CONC_PIPEPIPE:
                //<conc> ::= <exp> '||' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IF_FI:
                //<if> ::= <if-compact> fi
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IF_ELSE_FI:
                //<if> ::= <if-compact> else <series> fi
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IFCOMPACT_IF_THEN:
                //<if-compact> ::= if <exp> then <series>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_WHILE_WHILE_DO_OD:
                //<while> ::= while <exp> do <series> od
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FORHEAD_SEMI_SEMI:
                //<for-head> ::= <assign> ';' <exp> ';' <assign>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FOR_FOR_DO_OD:
                //<for> ::= for <for-head> do <series> od
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PICOPROGRAM_BEGIN_END:
                //<pico-program> ::= begin <decls> <series> end
                //todo: Create a new object using the stored user objects.
                _parseTree(token);
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 39
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_PROG_LBRACE_RBRACE:
                //<prog> ::= '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMTLIST_SEMI:
                //<stmt-list> ::= <stmt> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMTLIST_SEMI2:
                //<stmt-list> ::= <stmt> ';' <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT:
                //<stmt> ::= <assign>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT2:
                //<stmt> ::= <if-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT3:
                //<stmt> ::= <switch-case>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT4:
                //<stmt> ::= <for-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT5:
                //<stmt> ::= <while-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT6:
                //<stmt> ::= <fun-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT7:
                //<stmt> ::= <class-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ASSIGN_IDENTIFIER_EQ:
                //<assign> ::= Identifier '=' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR_PLUS:
                //<expr> ::= <term> '+' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR_MINUS:
                //<expr> ::= <term> '-' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR:
                //<expr> ::= <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_TIMES:
                //<term> ::= <factor> '*' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_DIV:
                //<term> ::= <factor> '/' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_PERCENT:
                //<term> ::= <factor> '%' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM:
                //<term> ::= <factor>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_LPAREN_RPAREN:
                //<factor> ::= '(' <expr> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_IDENTIFIER:
                //<factor> ::= Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_NUM:
                //<factor> ::= Num
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LOGICEXPR:
                //<logic-expr> ::= <expr> <op> <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_LT:
                //<op> ::= '<'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_GT:
                //<op> ::= '>'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_LTEQ:
                //<op> ::= '<='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_GTEQ:
                //<op> ::= '>='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_EQEQ:
                //<op> ::= '=='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_EXCLAMEQ:
                //<op> ::= '!='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_LPAREN_RPAREN_THEN_LBRACE_RBRACE:
                //<if-stmt> ::= if '(' <logic-expr> ')' then '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_LPAREN_RPAREN_THEN_LBRACE_RBRACE_ELSE_LBRACE_RBRACE:
                //<if-stmt> ::= if '(' <logic-expr> ')' then '{' <stmt-list> '}' else '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SWITCHCASE_SWITCH_LPAREN_IDENTIFIER_RPAREN_LBRACE_DEFAULT_COLON_RBRACE:
                //<switch-case> ::= switch '(' Identifier ')' '{' <cases> default ':' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CASES_CASE_COLON_BREAK_SEMI:
                //<cases> ::= case <literal> ':' <stmt-list> break ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CASES_CASE_COLON_BREAK_SEMI2:
                //<cases> ::= case <literal> ':' <stmt-list> break ';' <cases>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_IDENTIFIER:
                //<literal> ::= Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_NUM:
                //<literal> ::= Num
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FORSTMT_FOR_LPAREN_SEMI_SEMI_RPAREN_LBRACE_RBRACE:
                //<for-stmt> ::= for '(' <types> <assign> ';' <logic-expr> ';' <inc> ')' '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_INT:
                //<types> ::= int
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_DOUBLE:
                //<types> ::= double
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_STRING:
                //<types> ::= string
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_CHAR:
                //<types> ::= char
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INC_IDENTIFIER_PLUSPLUS:
                //<inc> ::= Identifier '++'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INC_IDENTIFIER_MINUSMINUS:
                //<inc> ::= Identifier '--'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_WHILESTMT_DO_LPAREN_RPAREN_WHILE_LPAREN_RPAREN:
                //<while-stmt> ::= do '(' <stmt-list> ')' while '(' <logic-expr> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_WHILESTMT_WHILE_LPAREN_RPAREN_THEN:
                //<while-stmt> ::= while '(' <logic-expr> ')' then <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNSTMT_IDENTIFIER_LPAREN_RPAREN_LBRACE_RETURN_RBRACE:
                //<fun-stmt> ::= <acces-mod> <types> Identifier '(' <parm> ')' '{' return <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNSTMT_IDENTIFIER_LPAREN_RPAREN_LBRACE_RETURN_RBRACE2:
                //<fun-stmt> ::= <acces-mod> <types> Identifier '(' ')' '{' return <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNSTMT_VOID_IDENTIFIER_LPAREN_RPAREN_LBRACE_RBRACE:
                //<fun-stmt> ::= <acces-mod> void Identifier '(' ')' '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNSTMT_VOID_IDENTIFIER_LPAREN_RPAREN_LBRACE_RBRACE2:
                //<fun-stmt> ::= <acces-mod> void Identifier '(' <parm> ')' '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ACCESMOD_PUBLIC:
                //<acces-mod> ::= public
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ACCESMOD_PRIVATE:
                //<acces-mod> ::= private
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PARM_IDENTIFIER:
                //<parm> ::= <types> Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PARM_IDENTIFIER_COMMA:
                //<parm> ::= <types> Identifier ',' <parm>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTMT_CLASS_IDENTIFIER_LPAREN_RPAREN_LBRACE_RBRACE:
                //<class-stmt> ::= <acces-mod> class Identifier '(' ')' '{' <body> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BODY:
                //<body> ::= <variable> <const> <fun-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BODY2:
                //<body> ::= <variable> <fun-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BODY3:
                //<body> ::= <variable>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BODY4:
                //<body> ::= <fun-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VARIABLE_IDENTIFIER_SEMI:
                //<variable> ::= <types> Identifier ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CONST_PUBLIC_IDENTIFIER_LPAREN_RPAREN_LBRACE_RBRACE:
                //<const> ::= public Identifier '(' <parm> ')' '{' <assign> '}'
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 40
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_NL_NEWLINE:
                //<nl> ::= NewLine <nl>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NL_NEWLINE2:
                //<nl> ::= NewLine
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NLOPT_NEWLINE:
                //<nl Opt> ::= NewLine <nl Opt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NLOPT:
                //<nl Opt> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_START:
                //<Start> ::= <nl Opt> <CommandExp> <nl Opt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP:
                //<CommandExp> ::= <ImportExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP2:
                //<CommandExp> ::= <CloneExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP3:
                //<CommandExp> ::= <RemoveExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP4:
                //<CommandExp> ::= <LoadExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP5:
                //<CommandExp> ::= <TableExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP6:
                //<CommandExp> ::= <RelateExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP7:
                //<CommandExp> ::= <UnrelateExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP8:
                //<CommandExp> ::= <ExportExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP9:
                //<CommandExp> ::= <BackExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP10:
                //<CommandExp> ::= <RootExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP11:
                //<CommandExp> ::= <TablesExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP12:
                //<CommandExp> ::= <ColumnsExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COMMANDEXP13:
                //<CommandExp> ::= <TopnExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IMPORTEXP_IMPORT:
                //<ImportExp> ::= import <CatalogExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IMPORTEXP_IMPORT2:
                //<ImportExp> ::= import <CatalogExp> <UserExp> <PasswordExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IMPORTEXP_IMPORT3:
                //<ImportExp> ::= import <CatalogExp> <ServerExp> <UserExp> <PasswordExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLONEEXP_CLONE:
                //<CloneExp> ::= clone
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLONEEXP_CLONE2:
                //<CloneExp> ::= clone <CatalogExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLONEEXP_CLONE3:
                //<CloneExp> ::= clone <AsExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLONEEXP_CLONE4:
                //<CloneExp> ::= clone <CatalogExp> <AsExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_REMOVEEXP_REMOVE:
                //<RemoveExp> ::= remove
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_REMOVEEXP_REMOVE2:
                //<RemoveExp> ::= remove <CatalogExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LOADEXP_LOAD:
                //<LoadExp> ::= load
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LOADEXP_LOAD2:
                //<LoadExp> ::= load <CatalogExp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLEEXP_TABLE:
                //<TableExp> ::= table
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLEEXP_TABLE_IDENTIFIER:
                //<TableExp> ::= table Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLEEXP_TABLE_IDENTIFIER_DEFAULT:
                //<TableExp> ::= table Identifier default
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLEEXP_TABLE_IDENTIFIER_DEFAULT_WHERE:
                //<TableExp> ::= table Identifier default where <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLEEXP_TABLE_IDENTIFIER_WHERE:
                //<TableExp> ::= table Identifier where <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RELATEEXP_RELATE_TO_IDENTIFIER_ON_IDENTIFIER_EQ_IDENTIFIER:
                //<RelateExp> ::= relate to Identifier on Identifier '=' Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RELATEEXP_RELATE_IDENTIFIER_TO_IDENTIFIER_ON_IDENTIFIER_EQ_IDENTIFIER:
                //<RelateExp> ::= relate Identifier to Identifier on Identifier '=' Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_UNRELATEEXP_UNRELATE_TO_IDENTIFIER:
                //<UnrelateExp> ::= unrelate to Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_UNRELATEEXP_UNRELATE_IDENTIFIER_TO_IDENTIFIER:
                //<UnrelateExp> ::= unrelate Identifier to Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_AS_SQL:
                //<ExportExp> ::= export as sql
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_AS_HTML:
                //<ExportExp> ::= export as html
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_AS_JSON:
                //<ExportExp> ::= export as json
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_AS_XML:
                //<ExportExp> ::= export as xml
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_IDENTIFIER_AS_SQL:
                //<ExportExp> ::= export Identifier as sql
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_IDENTIFIER_AS_HTML:
                //<ExportExp> ::= export Identifier as html
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_IDENTIFIER_AS_JSON:
                //<ExportExp> ::= export Identifier as json
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPORTEXP_EXPORT_IDENTIFIER_AS_XML:
                //<ExportExp> ::= export Identifier as xml
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BACKEXP_BACK:
                //<BackExp> ::= back
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ROOTEXP_ROOT:
                //<RootExp> ::= root
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLESEXP_TABLES:
                //<TablesExp> ::= tables
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TABLESEXP_TABLES_INTEGER:
                //<TablesExp> ::= tables Integer
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COLUMNSEXP_COLUMNS:
                //<ColumnsExp> ::= columns
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COLUMNSEXP_COLUMNS_INTEGER:
                //<ColumnsExp> ::= columns Integer
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TOPNEXP_TOP_INTEGER:
                //<TopnExp> ::= top Integer
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CATALOGEXP_CATALOG_IDENTIFIER:
                //<CatalogExp> ::= catalog Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_USEREXP_USER_IDENTIFIER:
                //<UserExp> ::= user Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PASSWORDEXP_PASSWORD_IDENTIFIER:
                //<PasswordExp> ::= password Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SERVEREXP_SERVER_IDENTIFIER:
                //<ServerExp> ::= server Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ASEXP_AS_IDENTIFIER:
                //<AsExp> ::= as Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_GT:
                //<Expression> ::= <Expression> '>' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LT:
                //<Expression> ::= <Expression> '<' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LTEQ:
                //<Expression> ::= <Expression> '<=' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_GTEQ:
                //<Expression> ::= <Expression> '>=' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_EQ:
                //<Expression> ::= <Expression> '=' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LTGT:
                //<Expression> ::= <Expression> '<>' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_IS:
                //<Expression> ::= <Expression> is <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_BETWEEN_AND:
                //<Expression> ::= <Expression> between <Negate Exp> and <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LIKE_STRINGLITERAL:
                //<Expression> ::= <Expression> like StringLiteral
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION:
                //<Expression> ::= <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP_MINUS:
                //<Negate Exp> ::= '-' <Value>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP_NOT:
                //<Negate Exp> ::= not <Value>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP:
                //<Negate Exp> ::= <Value>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_IDENTIFIER:
                //<Value> ::= Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_LPAREN_RPAREN:
                //<Value> ::= '(' <Expression> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_NULL:
                //<Value> ::= null
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_INTEGER:
                //<Value> ::= Integer
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_DECIMAL:
                //<Value> ::= Decimal
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_STRINGLITERAL:
                //<Value> ::= StringLiteral
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 41
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_PROGRAM_LBRACE_RBRACE:
                //<program> ::= '{' <statements> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENTS_DOT:
                //<statements> ::= <statement> '.'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENTS_DOT2:
                //<statements> ::= <statement> '.' <statements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_DOT:
                //<statement> ::= <assign> '.'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_LBRACERBRACE:
                //<statement> ::= <if-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_LBRACERBRACE2:
                //<statement> ::= <for-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_LBRACERBRACE3:
                //<statement> ::= <While-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_LBRACERBRACE4:
                //<statement> ::= <function-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STATEMENT_LBRACERBRACE5:
                //<statement> ::= <class-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ASSIGN_ID_EQ:
                //<assign> ::= id '=' <expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_PLUS:
                //<expression> ::= <term> '+' <expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_MINUS:
                //<expression> ::= <term> '-' <expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION:
                //<expression> ::= <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_TIMES:
                //<term> ::= <factor> '*' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_DIV:
                //<term> ::= <factor> '/' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_PERCENT:
                //<term> ::= <factor> '%' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM:
                //<term> ::= <factor>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_LPAREN_RPAREN:
                //<factor> ::= '(' <expression> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_ID:
                //<factor> ::= id
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_NUMBER:
                //<factor> ::= number
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_REAL:
                //<factor> ::= real
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTATEMENT_IF_GTGT:
                //<if-statement> ::= if <condition> '>>' <statements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTATEMENT_IF_GTGT_ELSE:
                //<if-statement> ::= if <condition> '>>' <statements> else <statements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CONDITION:
                //<condition> ::= <expression> <operation> <expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_LT:
                //<operation> ::= '<'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_GT:
                //<operation> ::= '>'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_EQEQ:
                //<operation> ::= '=='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_LTEQ:
                //<operation> ::= '<='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_GTEQ:
                //<operation> ::= '>='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OPERATION_EXCLAMEQ:
                //<operation> ::= '!='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FORSTATEMENT_FOR_COMMA_COMMA_LBRACE_RBRACE:
                //<for-statement> ::= for <types> <assign> ',' <condition> ',' <counter> '{' <statements> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_INTEGER:
                //<types> ::= integer
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_DECIMAL:
                //<types> ::= decimal
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_STRING:
                //<types> ::= String
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_CHAR:
                //<types> ::= char
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COUNTER_ID_PLUSPLUS:
                //<counter> ::= id '++'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_COUNTER_ID_MINUSMINUS:
                //<counter> ::= id '--'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_WHILESTATEMENT_WHILE_LPAREN_RPAREN_DO_LPAREN_RPAREN:
                //<While-statement> ::= while '(' <expression> ')' do '(' <statements> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTATEMENT_FUNCTION_ID_LPAREN_RPAREN_DOT:
                //<function-statement> ::= function <return-value> id '(' <initial-list> ')' '.' <function-stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RETURNVALUE:
                //<return-value> ::= <types>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RETURNVALUE_VOID:
                //<return-value> ::= void
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INITIALLIST_ID_COMMA:
                //<initial-list> ::= <types> id ',' <initial-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INITIALLIST_ID:
                //<initial-list> ::= <types> id
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMTLIST:
                //<function-stmt-list> ::= <function-statement>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMTLIST2:
                //<function-stmt-list> ::= <function-statement> <function-stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMT_DOT:
                //<function-stmt> ::= <assign> '.'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMT_LBRACERBRACE:
                //<function-stmt> ::= <if-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMT_LBRACERBRACE2:
                //<function-stmt> ::= <for-statement> '{}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMT_DOT2:
                //<function-stmt> ::= <counter> '.'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONSTMT_DOT3:
                //<function-stmt> ::= <types> <assign> '.'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCTIONCALL_ID_LPAREN_RPAREN:
                //<function-call> ::= id '(' <arguments> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ARGUMENTS_COMMA:
                //<arguments> ::= <factor> ',' <arguments>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ARGUMENTS:
                //<arguments> ::= <factor>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTATEMENT_CLASS_ID_COLON:
                //<class-statement> ::= Class id ':' <class-stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTMTLIST:
                //<class-stmt-list> ::= <class-member> <class-stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTMTLIST2:
                //<class-stmt-list> ::= <class-member-method> <class-stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTMTLIST3:
                //<class-stmt-list> ::= <class-member>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSSTMTLIST4:
                //<class-stmt-list> ::= <class-member-method>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBER_SEMI:
                //<class-member> ::= <class-member-type> <types> <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBERMETHOD_COLONT:
                //<class-member-method> ::= <class-member-type> <function-stmt> ':t'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBERTYPE_PUBLIC:
                //<class-member-type> ::= Public
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBERTYPE_PRIVATE:
                //<class-member-type> ::= Private
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBERTYPE_PROTECTED:
                //<class-member-type> ::= Protected
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASSMEMBERTYPE_STATIC:
                //<class-member-type> ::= static
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 42
0
        public static Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_NL_NEWLINE:
                //<nl> ::= NewLine <nl>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NL_NEWLINE2:
                //<nl> ::= NewLine
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NLOPT_NEWLINE:
                //<nl Opt> ::= NewLine <nl Opt>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NLOPT:
                //<nl Opt> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_START:
                //<Start> ::= <nl Opt> <Program>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[1].UserObject);

            case (int)RuleConstants.RULE_PROGRAM:
                //<Program> ::= <Sentence>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.Program((OpeLang.NonTerminal.Sentence)token.Tokens[0].UserObject));

            case (int)RuleConstants.RULE_PROGRAM2:
                //<Program> ::= <Program> <Sentence>
                //todo: Create a new object using the stored user objects.
                ((OpeLang.NonTerminal.Program)token.Tokens[0].UserObject).Add((OpeLang.NonTerminal.Sentence)token.Tokens[1].UserObject);
                return((OpeLang.NonTerminal.Program)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_SENTENCE:
                //<Sentence> ::= <nl>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SENTENCE2:
                //<Sentence> ::= <Ope> <nl>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_SENTENCE3:
                //<Sentence> ::= <IfStatment>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_OPE_IDENTIFIER_LPAREN_RPAREN:
                //<Ope> ::= Identifier '(' <Args> ')'
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.Ope(
                           token.Tokens[0].ToString(),
                           (OpeLang.NonTerminal.Args)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_ARGS:
                //<Args> ::= <Expression>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.Args((OpeLang.NonTerminal.Expression)token.Tokens[0].UserObject));

            case (int)RuleConstants.RULE_ARGS_COMMA:
                //<Args> ::= <Args> ',' <Expression>
                //todo: Create a new object using the stored user objects.
                ((OpeLang.NonTerminal.Args)token.Tokens[0].UserObject).Add((OpeLang.NonTerminal.Expression)token.Tokens[2].UserObject);
                return((OpeLang.NonTerminal.Args)token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_ARGS2:
                //<Args> ::=
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.Args());

            case (int)RuleConstants.RULE_IFSTATMENT_IF_THEN_ENDIF:
                //<IfStatment> ::= if <Condition> then <Program> <ElseIf> endif
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.IfStatement(
                           (OpeLang.NonTerminal.Condition)token.Tokens[1].UserObject,
                           (OpeLang.NonTerminal.Program)token.Tokens[3].UserObject,
                           (List <OpeLang.NonTerminal.ElsIfSection>)token.Tokens[4].UserObject));

            case (int)RuleConstants.RULE_IFSTATMENT_IF_THEN_ELSE_ENDIF:
                //<IfStatment> ::= if <Condition> then <Program> <ElseIf> else <Program> endif
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.IfStatement(
                           (OpeLang.NonTerminal.Condition)token.Tokens[1].UserObject,
                           (OpeLang.NonTerminal.Program)token.Tokens[3].UserObject,
                           (OpeLang.NonTerminal.Program)token.Tokens[5].UserObject,
                           (List <OpeLang.NonTerminal.ElsIfSection>)token.Tokens[4].UserObject));

            case (int)RuleConstants.RULE_ELSEIF_ELSIF_THEN:
                //<ElseIf> ::= elsif <Condition> then <Program>
                //todo: Create a new object using the stored user objects.
                return(new List <OpeLang.NonTerminal.ElsIfSection>()
                {
                    new OpeLang.NonTerminal.ElsIfSection((OpeLang.NonTerminal.Condition)token.Tokens[1].UserObject,
                                                         (OpeLang.NonTerminal.Program)token.Tokens[3].UserObject)
                });

            case (int)RuleConstants.RULE_ELSEIF_ELSIF_THEN2:
                //<ElseIf> ::= <ElseIf> elsif <Condition> then <Program>
                //todo: Create a new object using the stored user objects.
                ((List <OpeLang.NonTerminal.ElsIfSection>)token.Tokens[0].UserObject).Add(
                    new OpeLang.NonTerminal.ElsIfSection(
                        (OpeLang.NonTerminal.Condition)token.Tokens[2].UserObject,
                        (OpeLang.NonTerminal.Program)token.Tokens[4].UserObject));
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_ELSEIF:
                //<ElseIf> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CONDITION_EQEQ:
            case (int)RuleConstants.RULE_CONDITION_EXCLAMEQ:
            case (int)RuleConstants.RULE_CONDITION_GTEQ:
            case (int)RuleConstants.RULE_CONDITION_LTEQ:
            case (int)RuleConstants.RULE_CONDITION_GT:
            case (int)RuleConstants.RULE_CONDITION_LT:
                //<Condition> ::= <Expression> '<' <Expression>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.BinaryCondition(
                           (OpeLang.NonTerminal.Expression)token.Tokens[0].UserObject,
                           (OpeLang.NonTerminal.Expression)token.Tokens[2].UserObject,
                           (string)token.Tokens[1].ToString()));

            case (int)RuleConstants.RULE_EXPRESSION_PLUS:
                //<Expression> ::= <Expression> '+' <Term>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.AddExpression(
                           (OpeLang.NonTerminal.Expression)token.Tokens[0].UserObject,
                           (OpeLang.NonTerminal.Term)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_EXPRESSION_MINUS:
                //<Expression> ::= <Expression> '-' <Term>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.SubExpression(
                           (OpeLang.NonTerminal.Expression)token.Tokens[0].UserObject,
                           (OpeLang.NonTerminal.Term)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_EXPRESSION:
                //<Expression> ::= <Term>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_TERM_TIMES:
                //<Term> ::= <Term> '*' <Num>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.MulTerm(
                           (OpeLang.NonTerminal.Term)token.Tokens[0].UserObject,
                           (OpeLang.NonTerminal.Num)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_TERM_DIV:
                //<Term> ::= <Term> '/' <Num>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.DivTerm(
                           (OpeLang.NonTerminal.Term)token.Tokens[0].UserObject,
                           (OpeLang.NonTerminal.Num)token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_TERM:
                //<Term> ::= <Num>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_NUM_MINUS:
                //<Num> ::= '-' <PositiveNum>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.NegativeNum(token.Tokens[1].UserObject));

            case (int)RuleConstants.RULE_NUM:
                //<Num> ::= <PositiveNum>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.PositiveNum(token.Tokens[0].UserObject));

            case (int)RuleConstants.RULE_NUM_MINUS2:
                //<Num> ::= '-' <Ope>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.NonVoidOpe(token.Tokens[0].UserObject, true /* isNegative */));

            case (int)RuleConstants.RULE_NUM2:
                //<Num> ::= <Ope>
                //todo: Create a new object using the stored user objects.
                return(new OpeLang.NonTerminal.NonVoidOpe(token.Tokens[0].UserObject, false /* isNegative */));

            case (int)RuleConstants.RULE_POSITIVENUM_UINTEGER:
                //<PositiveNum> ::= UInteger
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_POSITIVENUM_DOUBLE:
                //<PositiveNum> ::= Double
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 43
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_NL_NEWLINE:
                //<nl> ::= NewLine <nl>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NL_NEWLINE2:
                //<nl> ::= NewLine
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NLOPT_NEWLINE:
                //<nl Opt> ::= NewLine <nl Opt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NLOPT:
                //<nl Opt> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_START:
                //<Start> ::= <nl Opt> <Program>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PROGRAM:
                //<Program> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_0:
                //<Num> ::= '0'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_1:
                //<Num> ::= '1'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_2:
                //<Num> ::= '2'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_3:
                //<Num> ::= '3'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_4:
                //<Num> ::= '4'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_5:
                //<Num> ::= '5'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_6:
                //<Num> ::= '6'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_7:
                //<Num> ::= '7'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_8:
                //<Num> ::= '8'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NUM_9:
                //<Num> ::= '9'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CHAR_A:
                //<Char> ::= a
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CHAR_B:
                //<Char> ::= b
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CHAR_Z:
                //<Char> ::= z
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VAR:
                //<Var> ::= <Char>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VAR2:
                //<Var> ::= <Char> <Mix>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MIX:
                //<Mix> ::= <Num>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MIX2:
                //<Mix> ::= <Char>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MIX3:
                //<Mix> ::= <Num> <Mix>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MIX4:
                //<Mix> ::= <Char> <Mix>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INT:
                //<Int> ::= <Num>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INT2:
                //<Int> ::= <Num> <Int>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FLOAT:
                //<float> ::= <Int>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FLOAT_DOT:
                //<float> ::= <Int> '.' <Int>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPE:
                //<type> ::= <Int>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPE2:
                //<type> ::= <Char>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPE3:
                //<type> ::= <float>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPE_VAR:
                //<type> ::= var
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_PLUS:
                //<Expression> ::= <Expression> '+' <Mult Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_MINUS:
                //<Expression> ::= <Expression> '-' <Mult Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION:
                //<Expression> ::= <Mult Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_TIMES:
                //<Mult Exp> ::= <Mult Exp> '*' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_DIV:
                //<Mult Exp> ::= <Mult Exp> '/' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_LT:
                //<Mult Exp> ::= <Mult Exp> '<' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_GT:
                //<Mult Exp> ::= <Mult Exp> '>' <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP:
                //<Mult Exp> ::= <Negate Exp>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_IDENTIFIER:
                //<Value> ::= Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_VALUE_LPAREN_RPAREN:
                //<Value> ::= '(' <Expression> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP_MINUS:
                //<Negate Exp> ::= '-' <Value>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP:
                //<Negate Exp> ::= <Value>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_THEN:
                //<if-stmt> ::= if <logical-Expr> then <stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_THEN_ELSE:
                //<if-stmt> ::= if <logical-Expr> then <stmt> else <stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LOGICALEXPR:
                //<logical-Expr> ::= <Char>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT:
                //<stmt> ::= <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT2:
                //<stmt> ::= <Expression> <if-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMTLIST:
                //<stmt-list> ::= <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SWITCHSTMT_SWITCH_LPAREN_RPAREN_LBRACECASE_THEN_LBRACE_CASE_THEN_RBRACE:
                //<switch-stmt> ::= Switch '(' <Expression> ')' '{case' <Var> then <stmt-list> '{' case <Var> then <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SWITCHSTMT_LBRACKETDEFAULT_RBRACKET_RBRACE:
                //<switch-stmt> ::= '[default' <stmt-list> ']' '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FORSTMT_FOR_LPAREN_EQ_SEMI_SEMI_RPAREN:
                //<for-stmt> ::= for '(' <Var> '=' <Num> ';' <expr-Condtion> ';' <expr-op> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_DO_DO_BEGIN_WHILE_LBRACE_RBRACE_ENDDO:
                //<Do> ::= do begin <code> while '{' <Expression> '}' endDo
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CODE_LPAREN_RPAREN:
                //<code> ::= '(' ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CODE_LBRACE_RBRACE:
                //<code> ::= '{' <stmt-list> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPRCONDTION:
                //<expr-Condtion> ::= <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPROP:
                //<expr-op> ::= <Expression>
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 44
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_PROGRAM_START_END:
                //<program> ::= Start <stmt-list> End
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMTLIST:
                //<stmt-list> ::= <stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMTLIST2:
                //<stmt-list> ::= <stmt> <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_SEMI:
                //<stmt> ::= <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_COLONCOLON:
                //<stmt> ::= <if-stmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_COLONCOLON2:
                //<stmt> ::= <for-stmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_SEMI2:
                //<stmt> ::= <inc> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_SEMI3:
                //<stmt> ::= <types> <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_COLONCOLON3:
                //<stmt> ::= <fstmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_SEMI4:
                //<stmt> ::= <fcall> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_STMT_COLONCOLON4:
                //<stmt> ::= <class> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ASSIGN_IDENTIFIER_EQ:
                //<assign> ::= Identifier '=' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR_PLUS:
                //<expr> ::= <term> '+' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR_MINUS:
                //<expr> ::= <term> '-' <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_EXPR:
                //<expr> ::= <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_TIMES:
                //<term> ::= <factor> '*' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_DIV:
                //<term> ::= <factor> '/' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM_PERCENT:
                //<term> ::= <factor> '%' <term>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TERM:
                //<term> ::= <factor>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_LPAREN_RPAREN:
                //<factor> ::= '(' <expr> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_IDENTIFIER:
                //<factor> ::= Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_NUM:
                //<factor> ::= Num
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FACTOR_FLOAT:
                //<factor> ::= Float
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_COLON:
                //<if-stmt> ::= if <logic-expr> ':' <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_IFSTMT_IF_COLON_ELSE:
                //<if-stmt> ::= if <logic-expr> ':' <stmt-list> else <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LOGICEXPR:
                //<logic-expr> ::= <expr> <op> <expr>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_LT:
                //<op> ::= '<'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_GT:
                //<op> ::= '>'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_LTEQ:
                //<op> ::= '<='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_GTEQ:
                //<op> ::= '>='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_EQEQ:
                //<op> ::= '=='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_OP_EXCLAMEQ:
                //<op> ::= '!='
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FORSTMT_FROM_TO_COLON:
                //<for-stmt> ::= from <types> <assign> to <logic-expr> ':' <stmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FSTMT_FUNCTION_IDENTIFIER_LPAREN_RPAREN_COLON:
                //<fstmt> ::= function <return> Identifier '(' <init-list> ')' ':' <fstmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RETURN:
                //<return> ::= <types>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_RETURN_VOID:
                //<return> ::= void
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INITLIST_IDENTIFIER_COMMA:
                //<init-list> ::= <types> Identifier ',' <init-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INITLIST_IDENTIFIER:
                //<init-list> ::= <types> Identifier
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FSTMTLIST:
                //<fstmt-list> ::= <func-stmt>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FSTMTLIST2:
                //<fstmt-list> ::= <func-stmt> <fstmt-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCSTMT_SEMI:
                //<func-stmt> ::= <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCSTMT_COLONCOLON:
                //<func-stmt> ::= <if-stmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCSTMT_COLONCOLON2:
                //<func-stmt> ::= <for-stmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCSTMT_SEMI2:
                //<func-stmt> ::= <inc> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FUNCSTMT_SEMI3:
                //<func-stmt> ::= <types> <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FCALL_IDENTIFIER_LPAREN_RPAREN:
                //<fcall> ::= Identifier '(' <args> ')'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ARGS_COMMA:
                //<args> ::= <factor> ',' <args>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ARGS:
                //<args> ::= <factor>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLASS_CLASS_IDENTIFIER_COLON:
                //<class> ::= Class Identifier ':' <c-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLIST:
                //<c-list> ::= <c-elemet> <c-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLIST2:
                //<c-list> ::= <c-method> <c-list>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLIST3:
                //<c-list> ::= <c-elemet>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CLIST4:
                //<c-list> ::= <c-method>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CELEMET_SEMI:
                //<c-elemet> ::= <c-type> <types> <assign> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CMETHOD_COLONCOLON:
                //<c-method> ::= <c-type> <fstmt> '::'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CTYPE_PUBLIC:
                //<c-type> ::= Public
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CTYPE_PRIVATE:
                //<c-type> ::= Private
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CTYPE_PROTECTED:
                //<c-type> ::= Protected
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_CTYPE_STATIC:
                //<c-type> ::= static
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_INT:
                //<types> ::= int
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_REAL:
                //<types> ::= real
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_STRING:
                //<types> ::= string
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPES_CHAR:
                //<types> ::= char
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INC_IDENTIFIER_PLUSPLUS:
                //<inc> ::= Identifier '++'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_INC_IDENTIFIER_MINUSMINUS:
                //<inc> ::= Identifier '--'
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 45
0
        public static Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_ID__ID:
                //<id> ::= '_Id'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LETTER__LETTER:
                //<letter> ::= '_Letter'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DIGITS__DIGITS:
                //<digits> ::= '_Digits'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SPACE__SPACE:
                //<space> ::= '_Space'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_QUOTE__QUOTE:
                //<quote> ::= '_Quote'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EMPTY:
                //<empty> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_LPAREN:
                //<literal> ::= '('
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_RPAREN:
                //<literal> ::= ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_PLUS:
                //<literal> ::= '+'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_MINUS:
                //<literal> ::= '-'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_SEMI:
                //<literal> ::= ';'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_PIPEPIPE:
                //<literal> ::= '||'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_COLON:
                //<literal> ::= ':'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LITERAL_COLONEQ:
                //<literal> ::= ':='
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NATURALCONSTANT:
                //<natural-constant> ::= <digits>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_LAYOUT:
                //<layout> ::= <space>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ANYCHARBUTQUOTE:
                //<any-char-but-quote> ::= <letter>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ANYCHARBUTQUOTE2:
                //<any-char-but-quote> ::= <digits>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ANYCHARBUTQUOTE3:
                //<any-char-but-quote> ::= <literal>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ANYCHARBUTQUOTE4:
                //<any-char-but-quote> ::= <layout>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STRINGTAIL:
                //<string-tail> ::= <any-char-but-quote> <string-tail>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STRINGTAIL2:
                //<string-tail> ::= <quote>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STRINGCONSTANT:
                //<string-constant> ::= <quote> <string-tail>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IDTYPELIST_COLON:
                //<id-type-list> ::= <id> ':' <type> <empty>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IDTYPELIST_COLON_COMMA:
                //<id-type-list> ::= <id> ':' <type> ',' <id-type-list>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DECLS_DECLARE_SEMI:
                //<decls> ::= declare <id-type-list> ';'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_TYPE_NATURAL:
                //<type> ::= natural
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_TYPE_STRING:
                //<type> ::= string
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SERIES:
                //<series> ::= <empty>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SERIES2:
                //<series> ::= <stat> <empty>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SERIES_SEMI:
                //<series> ::= <stat> ';' <series>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT:
                //<stat> ::= <assign>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT2:
                //<stat> ::= <if>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT3:
                //<stat> ::= <while>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_STAT4:
                //<stat> ::= <for>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ASSIGN_COLONEQ:
                //<assign> ::= <id> ':=' <exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP:
                //<exp> ::= <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP2:
                //<exp> ::= <plus>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP3:
                //<exp> ::= <minus>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXP4:
                //<exp> ::= <conc>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY:
                //<primary> ::= <id>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY2:
                //<primary> ::= <natural-constant>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY3:
                //<primary> ::= <string-constant>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRIMARY_LPAREN_RPAREN:
                //<primary> ::= '(' <exp> ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PLUS_PLUS:
                //<plus> ::= <exp> '+' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_MINUS_MINUS:
                //<minus> ::= <exp> '-' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CONC_PIPEPIPE:
                //<conc> ::= <exp> '||' <primary>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IF_FI:
                //<if> ::= <if-compact> fi
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IF_ELSE_FI:
                //<if> ::= <if-compact> else <series> fi
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_IFCOMPACT_IF_THEN:
                //<if-compact> ::= if <exp> then <series>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_WHILE_WHILE_DO_OD:
                //<while> ::= while <exp> do <series> od
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FORHEAD_SEMI_SEMI:
                //<for-head> ::= <assign> ';' <exp> ';' <assign>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FOR_FOR_DO_OD:
                //<for> ::= for <for-head> do <series> od
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PICOPROGRAM_BEGIN_END:
                //<pico-program> ::= begin <decls> <series> end
                //todo: Create a new object using the stored user objects.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 46
0
        public Object CreateObjectFromNonterminal(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_SCHEMA:
                //<Schema> ::= <SchemaNameElement> <SchemaElements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMANAMEELEMENT_NAME_SEMI:
                //<SchemaNameElement> ::= Name <SchemaName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMANAME_NAME:
                //<SchemaName> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMAELEMENTS:
                //<SchemaElements> ::= <Type> <SchemaElements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMAELEMENTS2:
                //<SchemaElements> ::= <Enum> <SchemaElements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMAELEMENTS3:
                //<SchemaElements> ::= <Hint> <SchemaElements>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SCHEMAELEMENTS4:
                //<SchemaElements> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BASETYPE_COLON:
                //<BaseType> ::= ':' <BaseTypeName>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BASETYPE:
                //<BaseType> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_BASETYPENAME_NAME:
                //<BaseTypeName> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPE_TYPE_LPAREN_RPAREN_LBRACE_RBRACE:
                //<Type> ::= type '(' <TypeId> ')' <TypeName> <BaseType> '{' <TypeHints> <TypeFields> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPENAME_NAME:
                //<TypeName> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEID_TYPEID:
                //<TypeId> ::= TypeId
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEID:
                //<TypeId> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEHINTS:
                //<TypeHints> ::= <Hint> <TypeHints>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEHINTS2:
                //<TypeHints> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELDS:
                //<TypeFields> ::= <TypeField> <TypeFields>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELDS2:
                //<TypeFields> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELD:
                //<TypeField> ::= <PrimitiveField>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELD2:
                //<TypeField> ::= <ReferenceField>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELD3:
                //<TypeField> ::= <ListField>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELD4:
                //<TypeField> ::= <SetField>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_TYPEFIELD5:
                //<TypeField> ::= <MapField>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PRIMITIVEFIELD_SEMI:
                //<PrimitiveField> ::= <PrimitiveFieldType> <FieldName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_PRIMITIVEFIELDTYPE_PRIMITIVE:
                //<PrimitiveFieldType> ::= Primitive
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_REFERENCEFIELD_SEMI:
                //<ReferenceField> ::= <ReferenceFieldType> <FieldName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_REFERENCEFIELDTYPE_NAME:
                //<ReferenceFieldType> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_FIELDNAME_NAME:
                //<FieldName> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_LISTFIELD_LIST_LT_GT_SEMI:
                //<ListField> ::= list '<' <AggregateArg> '>' <FieldName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_SETFIELD_SET_LT_GT_SEMI:
                //<SetField> ::= set '<' <AggregateArg> '>' <FieldName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_MAPFIELD_MAP_LT_COMMA_GT_SEMI:
                //<MapField> ::= map '<' <AggregateArg> ',' <AggregateArg> '>' <FieldName> ';'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_AGGREGATEARG:
                //<AggregateArg> ::= <PrimitiveFieldType>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_AGGREGATEARG2:
                //<AggregateArg> ::= <ReferenceFieldType>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUM_ENUM_LBRACE_RBRACE:
                //<Enum> ::= enum <EnumName> '{' <EnumHints> <EnumValues> '}'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMNAME_NAME:
                //<EnumName> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMHINTS:
                //<EnumHints> ::= <Hint> <EnumHints>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMHINTS2:
                //<EnumHints> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMVALUES:
                //<EnumValues> ::= <EnumValue>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMVALUES_COMMA:
                //<EnumValues> ::= <EnumValue> ',' <EnumValues>
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMVALUES2:
                //<EnumValues> ::=
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_ENUMVALUE_NAME:
                //<EnumValue> ::= Name
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_HINT_LBRACKET_EQ_RBRACKET:
                //<Hint> ::= '[' <HintName> '=' <HintValue> ']'
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_HINTNAME_HINTNAME:
                //<HintName> ::= HintName
                //todo: Create a new object using the stored tokens.
                return(null);

            case (int)RuleConstants.RULE_HINTVALUE_STRING:
                //<HintValue> ::= String
                //todo: Create a new object using the stored tokens.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }
Esempio n. 47
0
        public static Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_E_PLUS:
                //<E> ::= <E> '+' <T>
                //todo: Create a new object using the stored user objects.
                return(Convert.ToDouble(token.Tokens[0].UserObject) + Convert.ToDouble(token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_E_MINUS:
                //<E> ::= <E> '-' <T>
                //todo: Create a new object using the stored user objects.
                return(Convert.ToDouble(token.Tokens[0].UserObject) - Convert.ToDouble(token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_E:
                //<E> ::= <T>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_T_TIMES:
                //<T> ::= <T> '*' <F>
                //todo: Create a new object using the stored user objects.
                return(Convert.ToDouble(token.Tokens[0].UserObject) * Convert.ToDouble(token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_T_DIV:
                //<T> ::= <T> '/' <F>
                //todo: Create a new object using the stored user objects.
                return(Convert.ToDouble(token.Tokens[0].UserObject) / Convert.ToDouble(token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_T:
                //<T> ::= <F>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_F_CARET:
                //<F> ::= <F> '^' <K>
                //todo: Create a new object using the stored user objects.
                return(Convert.ToInt32(token.Tokens[0].UserObject) ^ Convert.ToInt32(token.Tokens[2].UserObject));

            case (int)RuleConstants.RULE_F:
                //<F> ::= <K>
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_K_LPAREN_RPAREN:
                //<K> ::= '(' <E> ')'
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[1].UserObject);

            case (int)RuleConstants.RULE_K_NUMERO:
                //<K> ::= Numero
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);

            case (int)RuleConstants.RULE_K_REAL:
                //<K> ::= Real
                //todo: Create a new object using the stored user objects.
                return(token.Tokens[0].UserObject);
            }
            throw new RuleException("Unknown rule");
        }
 public AcceptEventArgs(NonterminalToken token)
 {
     this.token = token;
 }
Esempio n. 49
0
        public static Object CreateObject(NonterminalToken token)
        {
            switch (token.Rule.Id)
            {
            case (int)RuleConstants.RULE_PRO:
                //<Pro> ::= <nl Opt> <Predicate> <nl Opt> <Clauses> <nl Opt> <Goal> <nl Opt>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NL_NEWLINE:
                //<nl> ::= NewLine <nl>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NL_NEWLINE2:
                //<nl> ::= NewLine
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NLOPT_NEWLINE:
                //<nl Opt> ::= NewLine <nl Opt>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NLOPT:
                //<nl Opt> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PREDICATE_PREDICATES:
                //<Predicate> ::= predicates <nl Opt> <prestat>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRESTAT_NONDETERM:
                //<prestat> ::= nondeterm <Rule> <nl> <prestat>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRESTAT:
                //<prestat> ::= <Rule> <nl> <prestat>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PRESTAT2:
                //<prestat> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_RULE_PRERULE_LPAREN_RPARENDOT:
                //<Rule> ::= preRule '(' <datatype> <commaP> ').'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_RULE_PRERULE_DOT:
                //<Rule> ::= preRule '.'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DATATYPE_INTEGER:
                //<datatype> ::= integer
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DATATYPE_SYMBOL:
                //<datatype> ::= symbol
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DATATYPE_STRING:
                //<datatype> ::= string
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DATATYPE_CHAR:
                //<datatype> ::= char
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DATATYPE_REAL:
                //<datatype> ::= real
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAP_COMMA:
                //<commaP> ::= ',' <datatype> <commaP>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAP:
                //<commaP> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CLAUSES_CLAUSES:
                //<Clauses> ::= clauses <nl> <FactOrRule>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FIRSTRULE_PRERULE_LPAREN_RPAREN:
                //<firstRule> ::= preRule '(' <switch> <commaC> ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FIRSTRULE_PRERULE:
                //<firstRule> ::= preRule
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FACTORRULE:
                //<FactOrRule> ::= <GeneralRule> <CluRules> <nl> <FactOrRule>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_FACTORRULE2:
                //<FactOrRule> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAC_COMMA:
                //<commaC> ::= ',' <nl Opt> <switch> <commaC>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAC:
                //<commaC> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CLURULES:
                //<CluRules> ::= <switch dot>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_CLURULES_COLONMINUS:
                //<CluRules> ::= ':-' <switchbody> <commab> <switch dot>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHBODY:
                //<switchbody> ::= <GeneralRule>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHBODY2:
                //<switchbody> ::= <Expression>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHBODY_EXCLAM:
                //<switchbody> ::= '!'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAB_COMMA:
                //<commab> ::= ',' <nl Opt> <switchbody> <commab>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAB_SEMI:
                //<commab> ::= ';' <nl Opt> <switchbody> <commab>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_COMMAB:
                //<commab> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_GENERALRULE_PRERULE_LPAREN:
                //<GeneralRule> ::= preRule '(' <switch> <commaC>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_GENERALRULE:
                //<GeneralRule> ::= <firstRule>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PARAMETERS_INT:
                //<Parameters> ::= Int
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PARAMETERS_SINGLE:
                //<Parameters> ::= single <Or> <sing>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PARAMETERS_DOUBLE:
                //<Parameters> ::= double <Or> <dob>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PARAMETERS_REL:
                //<Parameters> ::= rel
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_PARAMETERS_PRERULE:
                //<Parameters> ::= preRule
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SING_SINGLE:
                //<sing> ::= single
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SING:
                //<sing> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DOB_DOUBLE:
                //<dob> ::= double
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_DOB:
                //<dob> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_IDENTIFIER:
                //<Or> ::= Identifier <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_PRERULE:
                //<Or> ::= preRule <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_INT:
                //<Or> ::= Int <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_SINGLE:
                //<Or> ::= single <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_DOUBLE:
                //<Or> ::= double <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_MINUS:
                //<Or> ::= '-' <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR_COLON:
                //<Or> ::= ':' <Or>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_OR:
                //<Or> ::=
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCH_IDENTIFIER:
                //<switch> ::= Identifier
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCH:
                //<switch> ::= <Parameters>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHDOT_RPAREN:
                //<switch dot> ::= ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHDOT_RPARENDOT:
                //<switch dot> ::= ').'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_SWITCHDOT_DOT:
                //<switch dot> ::= '.'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_GT:
                //<Expression> ::= <Expression> '>' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LT:
                //<Expression> ::= <Expression> '<' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LTEQ:
                //<Expression> ::= <Expression> '<=' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_GTEQ:
                //<Expression> ::= <Expression> '>=' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_EQ:
                //<Expression> ::= <Expression> '=' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION_LTGT:
                //<Expression> ::= <Expression> '<>' <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_EXPRESSION:
                //<Expression> ::= <Add Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ADDEXP_PLUS:
                //<Add Exp> ::= <Add Exp> '+' <Mult Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ADDEXP_MINUS:
                //<Add Exp> ::= <Add Exp> '-' <Mult Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_ADDEXP:
                //<Add Exp> ::= <Mult Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_TIMES:
                //<Mult Exp> ::= <Mult Exp> '*' <Negate Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP_DIV:
                //<Mult Exp> ::= <Mult Exp> '/' <Negate Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_MULTEXP:
                //<Mult Exp> ::= <Negate Exp>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP_MINUS:
                //<Negate Exp> ::= '-' <Value>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_NEGATEEXP:
                //<Negate Exp> ::= <Value>
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_VALUE_IDENTIFIER:
                //<Value> ::= Identifier
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_VALUE_REL:
                //<Value> ::= rel
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_VALUE_INT:
                //<Value> ::= Int
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_VALUE_LPAREN_RPAREN:
                //<Value> ::= '(' <Add Exp> ')'
                //todo: Create a new object using the stored user objects.
                return(null);

            case (int)RuleConstants.RULE_GOAL_GOAL:
                //<Goal> ::= goal <nl> <GeneralRule> <switch dot>
                //todo: Create a new object using the stored user objects.
                return(null);
            }
            throw new RuleException("Unknown rule");
        }