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]); } }
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; } }
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; } }
private void SetFrequencyOption(NonterminalToken pToken) { switch (pToken.Rule.Rhs[0].ToString()) { case "STRATAVAR": this.StratvarList.AddRange(AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 2).Trim())); break; case "WEIGHTVAR": this.WeightVar = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "OUTTABLE": this.OutTable = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "PSUVAR": this.PSUVar = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "NOWRAP": this.NoWrap = "NOWRAP"; break; case "COLUMNSIZE": this.ColumnSize = this.GetCommandElement(pToken.Tokens, 2); break; } }
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])); } } }
private void SetFreqOpt(NonterminalToken pT) { /* <FreqOpt> ::= <WeightOpt> | <FreqOptStrata> | <OutTableOpt> | <SetClause> | <FreqOptNoWrap> | <FreqOptColumnSize> | <FreqOptPsuvar> | | <WeightOpt> ::= WEIGHTVAR '=' Identifier | <FreqOptStrata> ::= STRATAVAR '=' <IdentifierList> | <FreqOptNoWrap> ::= NOWRAP | <FreqOptColumnSize> ::= COLUMNSIZE '=' DecLiteral | <FreqOptPsuvar> ::= PSUVAR '=' Identifier*/ switch (pT.Rule.Rhs[0].Name.ToString()) { case "WEIGHTVAR": this.WeightVar = this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' }); //inputVariableList.Add("WEIGHTVAR", this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' })); break; case "STRATAVAR": //this.Stratvar = this.GetCommandElement(pT.Tokens, 2); this.Stratvar = AnalysisRule.SpliIdentifierList(this.GetCommandElement(pT.Tokens, 2)); //StringBuilder temp2 = new StringBuilder(); break; case "STATISTICS": if (this.GetCommandElement(pT.Tokens, 2).Equals("NONE")) { this.tablesShowStatistics = false; } break; case "OUTTABLE": this.OutTable = this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' }); //inputVariableList.Add("OUTTABLE", this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' })); break; case "<SetClause>": break; case "<FreqOptNoWrap>": //this.op break; case "<FreqOptColumnSize>": break; case "PSUVAR": this.PSUVar = this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' }); //inputVariableList.Add("PSUVAR", this.GetCommandElement(pT.Tokens, 2).Trim(new char[] { '[', ']' })); break; } }
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]); } }
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]); } }
public Rule_ExprList(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /*::= <Expression> ',' <Expr List> | <Expression> */ this.Expression = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]); if (pToken.Tokens.Length > 1) { this.ExprList = AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]); } }
public Rule_ExprList(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /*::= <Expression> ',' <Expr List> | <Expression> */ this.Expression = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]); if (pToken.Tokens.Length > 1) { this.ExprList = AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]); } }
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])); } }
public Rule_AndExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { // <Not Exp> AND <And Exp> // <Not Exp> //this.NotExp = new Rule_NotExp(pContext, (NonterminalToken)pToken.Tokens[0]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0])); if (pToken.Tokens.Length > 1) { //this.AndExp = new Rule_AndExp(pContext, (NonterminalToken)pToken.Tokens[2]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2])); } }
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])); } }
private void SetOption(NonterminalToken pToken) { /* * <CoxOpt> ::= WEIGHTVAR '=' Identifier | TIMEUNIT '=' String | GRAPHTYPE '=' String | OUTTABLE '=' Identifier | STRATAVAR '=' <IdentifierList> | GRAPH '=' <IdentifierList> | DIALOG | SHOWOBSERVED | PVALUE '=' Percentage | PVALUE '=' RealLiteral */ switch (pToken.Rule.Rhs[0].ToString()) { case "WEIGHTVAR": this.weightvar = this.GetCommandElement(pToken.Tokens, 2).Trim('"').Trim(new char[] { '[', ']' }); break; case "TIMEUNIT": this.time_unit = this.GetCommandElement(pToken.Tokens, 2).Trim('"').Trim(new char[] { '[', ']' }); break; case "GRAPHTYPE": this.graph_type = this.GetCommandElement(pToken.Tokens, 2).Trim('"').Trim(new char[] { '[', ']' }); break; case "OUTTABLE": this.out_table = this.GetCommandElement(pToken.Tokens, 2).Trim('"').Trim(new char[] { '[', ']' }); break; case "STRATAVAR": this.StrataVarList.AddRange(AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 2))); break; case "GRAPH": this.GraphVariableList.AddRange(AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 2))); break; case "DIALOG": case "SHOWOBSERVED": case "PVALUE": this.p_value = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; default: // do nothing break; } }
public Rule_NotExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //<Not Exp> ::= NOT <Compare Exp> | <Compare Exp> if (pToken.Tokens.Length == 1) { //CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[0]); CompareExp = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[0]); } else { //CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[1]); CompareExp = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); this.isNotStatement = true; } }
public Rule_If_Then_Else_End(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /* <If_Statement> ::= IF <Expression> THEN <Statements> END <If_Else_Statement> ::= IF <Expression> THEN <Statements> ELSE <Statements> END */ IfClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); ThenClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[3]); if (pToken.Tokens.Length > 5) { ElseClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[5]); } }
public Rule_MultipleFunctionParameterList(Rule_Context pContext, NonterminalToken pToken, Stack <AnalysisRule> pList) : base(pContext) { //<MultipleFunctionParameterList> ::= <NonEmptyFunctionParameterList> ',' <Expression> NonterminalToken nonEmptyToken = (NonterminalToken)pToken.Tokens[0]; NonterminalToken ExpressionToken = (NonterminalToken)pToken.Tokens[2]; // nonEmptyList = new Rule_NonEmptyFunctionParameterList(pContext, nonEmptyToken, pList); //this.Expression = new Rule_Expression(pContext, ExpressionToken); pList.Push(AnalysisRule.BuildStatments(pContext, nonEmptyToken)); pList.Push(AnalysisRule.BuildStatments(pContext, ExpressionToken)); //pList.Push(this.Expression); }
public Rule_If_Then_Else_End(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /* * <If_Statement> ::= IF <Expression> THEN <Statements> END * <If_Else_Statement> ::= IF <Expression> THEN <Statements> ELSE <Statements> END */ IfClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); ThenClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[3]); if (pToken.Tokens.Length > 5) { ElseClause = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[5]); } }
public Rule_AddExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /*::= <Mult Exp> '+' <Add Exp> | <Mult Exp> '-' <Add Exp> | <Mult Exp>*/ //this.MultExp = new Rule_MultExp(pContext, (NonterminalToken)pToken.Tokens[0]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0])); if (pToken.Tokens.Length > 1) { operation = pToken.Tokens[1].ToString(); //this.AddExp = new Rule_AddExp(pContext, (NonterminalToken)pToken.Tokens[2]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2])); } }
public Rule_NotExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //<Not Exp> ::= NOT <Compare Exp> | <Compare Exp> if (pToken.Tokens.Length == 1) { //CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[0]); CompareExp = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[0]); } else { //CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[1]); CompareExp = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); this.isNotStatement = true; } }
public Rule_Expression(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /*::= <And Exp> OR <Expression> | <And Exp> XOR <Expression> | <And Exp> */ this.CommandText = this.ExtractTokens(pToken.Tokens); //And_Exp = new Rule_AndExp(pContext, (NonterminalToken)pTokens.Tokens[0]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0])); if (pToken.Tokens.Length > 1) { op = pToken.Tokens[1].ToString().ToUpperInvariant(); //Expression = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[2]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2])); } }
public Rule_MultExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /*::= <Pow Exp> '*' <Mult Exp> | <Pow Exp> '/' <Mult Exp> | <Pow Exp> MOD <Mult Exp> | <Pow Exp> '%' <Mult Exp> | <Pow Exp>*/ //this.PowExp = new Rule_PowExp(pContext, (NonterminalToken)pToken.Tokens[0]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0])); if (pToken.Tokens.Length > 1) { this.op = pToken.Tokens[1].ToString(); //this.MultExp = new Rule_MultExp(pContext, (NonterminalToken)pToken.Tokens[2]); this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2])); } }
public Rule_NegateExp(Rule_Context pContext, NonterminalToken pTokens) : base(pContext) { //<Negate Exp> ::= '-' <Value> // or //<Negate Exp> ::= <Value> if (pTokens.Tokens.Length > 1) { this.op = this.GetCommandElement(pTokens.Tokens, 0); //this.Value = new Rule_Value(pContext, pTokens.Tokens[1]); this.Value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[1]); } else { //this.Value = new Rule_Value(pContext, pTokens.Tokens[0]); this.Value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[0]); } }
public Rule_NegateExp(Rule_Context pContext, NonterminalToken pTokens) : base(pContext) { //<Negate Exp> ::= '-' <Value> // or //<Negate Exp> ::= <Value> if(pTokens.Tokens.Length > 1) { this.op = this.GetCommandElement(pTokens.Tokens,0); //this.Value = new Rule_Value(pContext, pTokens.Tokens[1]); this.Value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[1]); } else { //this.Value = new Rule_Value(pContext, pTokens.Tokens[0]); this.Value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[0]); } }
public Rule_Write(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { // <Write_All_Statement> ::= WRITE <WriteMode> <FileDataFormat> <OutTarget> '*' // <Write_Some_Statement> ::= WRITE <WriteMode> <FileDataFormat> <OutTarget> <IdentifierList> // <Write_Except_Statement> ::= WRITE <WriteMode> <FileDataFormat> <OutTarget> '*' EXCEPT <IdentifierList> // <WriteMode> ::= APPEND| REPLACE | !Null // <FileDataFormat> ::= '"Epi7"' // | '"Epi2000"' // | '"Epi 2000"' // | '"Excel 8.0"' // | '"Text"' // <OutTarget> ::= Identifier | File ':' Identifier | File | BraceString ':' Identifier this.WriteMode = this.GetCommandElement(pToken.Tokens, 1); this.FileDataFormat = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '"' }); NonterminalToken T = (NonterminalToken)pToken.Tokens[3]; GetOutTarget(pToken.Tokens[3]); /* * this.OutTarget = this.GetCommandElement(pToken.Tokens, 3).Trim(new char[] { '{','}' }); * * if (((TerminalToken)T.Tokens[0]).Symbol.ToString() == "BraceString") * { * this.OutTarget = this.OutTarget.Replace("}",""); * isConnectionString = true; * }*/ if (pToken.Tokens.Length <= 5) { //this.IdentifierList = this.GetCommandElement(pToken.Tokens, 4).Replace(" . ", ".").Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); //this.IdentifierListRule = AnalysisRule.BuildStatments(pContext, pToken.Tokens[4]); this.IdentifierList = AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 4)); } else { //this.IdentifierList = this.GetCommandElement(pToken.Tokens, 6).Replace(" . ", ".").Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); //this.IdentifierListRule = AnalysisRule.BuildStatments(pContext, pToken.Tokens[6]); this.IdentifierList = AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 6)); isExceptionList = true; } }
/// <summary> /// Reduction to calculate the difference between two dates. /// </summary> /// <param name="pToken">The token to use to build the reduction.</param> /// <param name="interval">The date interval to use for calculating the difference (seconds, hours, days, months, years)</param> public Rule_DateDiff(Rule_Context pContext, NonterminalToken pToken, FunctionUtils.DateInterval interval) : base(pContext) { currentInterval = interval; this.ParameterList = AnalysisRule.GetFunctionParameters(pContext, pToken); /* * NonterminalToken T = (NonterminalToken)pToken.Tokens[0]; * string type = pToken.Rule.Lhs.ToString(); * switch (type) * { * case "<FunctionParameterList>": * this.ParamList = new Rule_FunctionParameterList(pContext, pToken); * break; * case "<FunctionCall>": * this.functionCall = new Rule_FunctionCall(pContext, T); * break; * default: * break; * }*/ }
/// <summary> /// Constructor for Rule_Select /// </summary> /// <param name="pToken">The token used to build the reduction.</param> public Rule_Select(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //<Select_Statement> ::= SELECT <Expression> | // | CANCEL SELECT | Select if (pToken.Tokens.Length == 1) { this.CancelExpresson = true; } else { if (pToken.Tokens[0].ToString().ToUpperInvariant() == "CANCEL") { this.CancelExpresson = true; } else { fieldnames.Append(this.GetFieldnames(pToken.Tokens, 1)); this.Expression = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); this.SelectString = this.GetCommandElement(pToken.Tokens, 1); } } }
private void SetTableOptions(NonterminalToken pToken) { for (int i = 0; i < pToken.Tokens.Length; i++) { NonterminalToken T = (NonterminalToken)pToken.Tokens[i]; switch (T.Rule.Rhs[0].ToString()) { case "<FreqOpts>": case "<WeightOpt>": case "<FreqOpt>": for (int j = 0; j < T.Tokens.Length; j++) { string temp = this.ExtractTokens(((NonterminalToken)T.Tokens[j]).Tokens); string[] tmp = temp.Split('='); switch (tmp[0].ToUpperInvariant().Trim()) { case "STRATAVAR": this.Stratvar = AnalysisRule.SpliIdentifierList(tmp[1].Trim()); break; case "WEIGHTVAR": this.WeightVar = tmp[1].Trim(); break; } } break; case "<OutTableOpt>": this.OutTable = this.GetCommandElement(T.Tokens, 2); break; case "<FreqOptPsuvar>": this.PSUVar = this.GetCommandElement(T.Tokens, 2); break; } } }
public Rule_Define(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //DEFINE Identifier <Variable_Scope> <VariableTypeIndicator> <Define_Prompt> //DEFINE Identifier '=' <Expression> Identifier = GetCommandElement(pToken.Tokens, 1); Context.DefineVarList.Add(Identifier.ToUpperInvariant()); if (GetCommandElement(pToken.Tokens, 2) == "=") { this.Expression = new Rule_Expression(pContext, (NonterminalToken)pToken.Tokens[3]); // set some defaults Variable_Scope = "STANDARD"; VariableTypeIndicator = ""; Define_Prompt = ""; } else { Variable_Scope = GetCommandElement(pToken.Tokens, 2);//STANDARD | GLOBAL | PERMANENT |!NULL VariableTypeIndicator = GetCommandElement(pToken.Tokens, 3); Define_Prompt = GetCommandElement(pToken.Tokens, 4); } }
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]); } }
/// <summary> /// Constructor for Rule_Select /// </summary> /// <param name="pToken">The token used to build the reduction.</param> public Rule_Select(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //<Select_Statement> ::= SELECT <Expression> | // | CANCEL SELECT | Select if(pToken.Tokens.Length == 1) { this.CancelExpresson = true; } else { if(pToken.Tokens[0].ToString().ToUpper() == "CANCEL") { this.CancelExpresson = true; } else { fieldnames.Append(this.GetFieldnames(pToken.Tokens, 1)); this.Expression = AnalysisRule.BuildStatments(pContext, (NonterminalToken)pToken.Tokens[1]); this.SelectString = this.GetCommandElement(pToken.Tokens, 1); } } }
public Rule_UnDelete(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /* <Undelete_All_Statement> ::= UNDELETE '*' | UNDELETE '*' RUNSILENT | UNDELETE <Compare Exp> | UNDELETE <Compare Exp> RUNSILENT */ CommandText = this.ExtractTokens(pToken.Tokens); if (pToken.Tokens[1] is NonterminalToken) { this.CompareExpression = AnalysisRule.BuildStatments(pContext, pToken.Tokens[1]); } else { this.CompareExpression = new Rule_Value("true"); } if (pToken.Tokens.Length > 2) { this.isRunSilent = true; } }
public Rule_Define(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { //DEFINE Identifier <Variable_Scope> <VariableTypeIndicator> <Define_Prompt> //DEFINE Identifier '=' <Expression> Identifier = GetCommandElement(pToken.Tokens, 1); Context.DefineVarList.Add(Identifier.ToUpper()); if (GetCommandElement(pToken.Tokens, 2) == "=") { this.Expression = new Rule_Expression(pContext, (NonterminalToken)pToken.Tokens[3]); // set some defaults Variable_Scope = "STANDARD"; VariableTypeIndicator = ""; Define_Prompt = ""; } else { Variable_Scope = GetCommandElement(pToken.Tokens, 2);//STANDARD | GLOBAL | PERMANENT |!NULL VariableTypeIndicator = GetCommandElement(pToken.Tokens, 3); Define_Prompt = GetCommandElement(pToken.Tokens, 4); } }
public Rule_UnDelete(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { /* * <Undelete_All_Statement> ::= UNDELETE '*' | UNDELETE '*' RUNSILENT | UNDELETE <Compare Exp> | UNDELETE <Compare Exp> RUNSILENT */ CommandText = this.ExtractTokens(pToken.Tokens); if (pToken.Tokens[1] is NonterminalToken) { this.CompareExpression = AnalysisRule.BuildStatments(pContext, pToken.Tokens[1]); } else { this.CompareExpression = new Rule_Value("true"); } if (pToken.Tokens.Length > 2) { this.isRunSilent = true; } }
private void SetFrequencyOption(NonterminalToken pToken) { /* * WEIGHTVAR '=' Identifier | STRATAVAR '=' <Freq_Variable_List> |NOWRAP |COLUMNSIZE '=' DecLiteral |PSUVAR '=' Identifier | OUTTABLE '=' Identifier | <SetClause> */ switch (pToken.Rule.Rhs[0].ToString()) { case "STRATAVAR": this.StratvarList = AnalysisRule.SpliIdentifierList(this.GetCommandElement(pToken.Tokens, 2).Trim()); break; case "WEIGHTVAR": this.WeightVar = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "OUTTABLE": this.OutTable = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "PSUVAR": this.PSUVar = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '[', ']' }); break; case "<SetClause>": this.SetSetClause((NonterminalToken)pToken.Tokens[0]); break; } }
public Rule_FileDate(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { this.ParameterList = AnalysisRule.GetFunctionParameters(pContext, pToken); }
internal AnalysisRuleVerifier(AnalysisRule rule) { this.rule = rule; }
public Rule_Dialog(Rule_Context pContext, NonterminalToken token) : base(pContext) { switch (token.Rule.Lhs.ToString()) { case "<Simple_Dialog_Statement>": this.Dialog = new Rule_Simple_Dialog_Statement(pContext, token); break; case "<Numeric_Dialog_Implicit_Statement>": this.Dialog = new Rule_Numeric_Dialog_Implicit_Statement(pContext, token); break; case "<TextBox_Dialog_Statement>": this.Dialog = new Rule_TextBox_Dialog_Statement(pContext, token); break; case "<Numeric_Dialog_Explicit_Statement>": this.Dialog = new Rule_Numeric_Dialog_Explicit_Statement(pContext, token); break; case "<Db_Values_Dialog_Statement>": this.Dialog = new Rule_Db_Values_Dialog_Statement(pContext, token); break; case "<YN_Dialog_Statement>": this.Dialog = new Rule_YN_Dialog_Statement(pContext, token); break; case "<Db_Views_Dialog_Statement>": this.Dialog = new Rule_Db_Views_Dialog_Statement(pContext, token); break; case "<Databases_Dialog_Statement>": this.Dialog = new Rule_Databases_Dialog_Statement(pContext, token); break; case "<Db_Variables_Dialog_Statement>": this.Dialog = new Rule_Db_Variables_Dialog_Statement(pContext, token); break; case "<Multiple_Choice_Dialog_Statement>": this.Dialog = new Rule_Multiple_Choice_Dialog_Statement(pContext, token); break; case "<Dialog_Read_Statement>": this.Dialog = new Rule_Dialog_Read_Statement(pContext, token); break; case "<Dialog_Write_Statement>": this.Dialog = new Rule_Dialog_Write_Statement(pContext, token); break; case "<Dialog_Read_Filter_Statement>": this.Dialog = new Rule_Dialog_Read_Filter_Statement(pContext, token); break; case "<Dialog_Write_Filter_Statement>": this.Dialog = new Rule_Dialog_Write_Filter_Statement(pContext, token); break; case "<Dialog_Date_Statement>": this.Dialog = new Rule_Dialog_Date_Statement(pContext, token); break; case "<Dialog_Date_Mask_Statement>": this.Dialog = new Rule_Dialog_Date_Mask_Statement(pContext, token); break; default: this.Dialog = new Rule_TextBox_Dialog_Statement(pContext, token); break; } }
public Rule_Always(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { // ALWAYS <Statements> END this.statements = new Rule_Statements(pContext, (NonterminalToken)pToken.Tokens[1]); }
public Rule_Months(Rule_Context pContext, NonterminalToken pToken) : base(pContext, pToken, FunctionUtils.DateInterval.Year) { this.ParameterList = AnalysisRule.GetFunctionParameters(pContext, pToken); }
public Rule_Statement(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { if (pToken.Tokens[0] is TerminalToken) { return; } NonterminalToken T = (NonterminalToken) pToken.Tokens[0]; if (!this.Context.RunOneCommand) { this.Context.ProgramText.Append(pToken.Tokens[0].ToString()); } else { if (!this.Context.IsFirstStatement) { this.Context.ProgramText.Length = 0; this.Context.ProgramText.Append(this.ExtractTokens(pToken.Tokens)); this.Context.IsFirstStatement = true; } } // with trim reductions on this should never execute // but just in case this is left to ensure proper statement build this.reduction = AnalysisRule.BuildStatments(pContext, T); // switch (pToken.Rule.Rhs[0].ToString()) // { // case "<Always_Statement>": // this.reduction = new Rule_Always(pContext, T); // break; // case "<Simple_Assign_Statement>": // case "<Let_Statement>": // case "<Assign_Statement>": // this.reduction = new Rule_Assign(pContext, T); // break; // case "<Assign_DLL_Statement>": // this.reduction = new Rule_Assign_DLL_Statement(pContext, T); // break; // case "<If_Statement>": // case "<If_Else_Statement>": // this.reduction = new Rule_If_Then_Else_End(pContext, T); // break; // case "<Define_Variable_Statement>": // this.reduction = new Rule_Define(pContext, T); // break; // case "<FunctionCall>": // this.reduction = new Rule_FunctionCall(pContext, T); // break; // case "<Simple_Dialog_Statement>": // case "<Numeric_Dialog_Implicit_Statement>": // case "<Numeric_Dialog_Explicit_Statement>": // case "<TextBox_Dialog_Statement>": // case "<Db_Values_Dialog_Statement>": // case "<YN_Dialog_Statement>": // case "<Db_Views_Dialog_Statement>": // case "<Databases_Dialog_Statement>": // case "<Db_Variables_Dialog_Statement>": // case "<Multiple_Choice_Dialog_Statement>": // case "<Dialog_Read_Statement>": // case "<Dialog_Write_Statement>": // case "<Dialog_Read_Filter_Statement>": // case "<Dialog_Write_Filter_Statement>": // case "<Dialog_Date_Statement>": // case "<Dialog_Date_Mask_Statement>": // this.reduction = new Rule_Dialog(pContext, T); // break; // case "<Read_Epi_Statement>": // case "<Simple_Read_Statement>": // case "<Read_Epi_File_Spec_Statement>": // case "<Read_Sql_Statement>": // case "<Read_Excel_File_Statement>": // case "<Read_Db_Table_Statement>": // this.reduction = new Rule_Read(pContext, T); // break; // case "<Merge_Table_Statement>": // case "<Merge_Db_Table_Statement>": // case "<Merge_File_Statement>": // case "<Merge_Excel_File_Statement>": // this.reduction = new Rule_Merge(pContext, T); // break; // case "<Write_All_Statement>": // case "<Write_Some_Statement>": // case "<Write_Except_Statement>": // this.reduction = new Rule_Write(pContext, T); // break; // case "<Select_Statement>": // case "<Cancel_Select_By_Selecting_Statement>": // case "<Cancel_Select_Statement>": // this.reduction = new Rule_Select(pContext, T); // break; // case "<Recode_Statement>": // this.reduction = new Rule_Recode(pContext, T); // break; // case "<Comment_Line>": // this.reduction = new Rule_CommentLine(pContext, T); // break; // case "<Execute_Statement>": // this.reduction = new Rule_Execute(pContext, T); // break; // case "<Report_Display_Statement>": // case "<Report_File_Statement>": // case "<Report_Print_Statement>": // this.reduction = new Rule_Report(pContext, T); // break; // case "<List_Statement>": // this.reduction = new Rule_List(pContext, T); // break; // case "<Simple_Tables_Statement>": // case "<Tables_One_Variable_Statement>": // case "<Row_All_Tables_Statement>": // case "<Row_Except_Tables_Statement>": // case "<Column_All_Tables_Statement>": // case "<Column_Except_Tables_Statement>": // case "<Row_Column_Tables_Statement>": // this.reduction = new Rule_Tables(pContext, T); // break; // case "<Freq_All_Statement>": // case "<Freq_Columns_Statement>": // case "<Freq_All_Except_Statement>": // this.reduction = new Rule_Freq(pContext, T); // break; // case "<Cancel_Sort_By_Sorting_Statement>": // case "<Cancel_Sort_Statement>": // case "<Sort_Statement>": // this.reduction = new Rule_Sort(pContext, T); // break; // case "<Means_Statement>": // this.reduction = new Rule_Means(pContext, T); // break; // case "<Relate_Epi_Table_Statement>": // case "<Relate_Table_Statement>": // case "<Relate_Db_Table_With_Identifier_Statement>": // case "<Relate_Db_Table_Statement>": // case "<Relate_File_Statement>": // case "<Relate_Excel_File_Statement>": // this.reduction = new Rule_Relate(pContext, T); // break; // case "<Beep_Statement>": // this.reduction = new Rule_Beep(pContext, T); // break; // case "<Quit_Statement>": // this.reduction = new Rule_Quit(pContext, T); // break; // case "<Delete_Table_Long_Statement>": // this.reduction = new Rule_Delete_Table_Long(pContext, T); // break; // case "<Delete_File_Statement>": // this.reduction = new Rule_Delete_File(pContext, T); // break; // case "<Delete_Table_Statement>": // this.reduction = new Rule_Delete_Table(pContext, T); // break; // case "<Type_Out_String_Statement>": // case "<Type_Out_File_Statement>": // case "<Type_Out_String_With_Font_Statement>": // case "<Type_Out_File_With_Font_Statement>": // this.reduction = new Rule_Typeout(pContext, T); // break; // case "<Simple_Routeout_Statement>": // case "<Replace_Routeout_Statement>": // case "<Append_Routeout_Statement>": // this.reduction = new Rule_RouteOut(pContext, T); // break; // case "<Close_Out_Statement>": // this.reduction = new Rule_CloseOut(pContext, T); // break; // case "<Variables_Display_Statement>": // case "<Views_Display_Statement>": // case "<Tables_Display_Statement>": // this.reduction = new Rule_Display(pContext, T); // break; // case "<Header_Title_String_Statement>": // case "<Header_Title_Font_Statement>": // case "<Header_Title_String_And_Font_Statement>": // this.reduction = new Rule_Header(pContext, T); // break; // case "<Simple_Undefine_Statement>": // this.reduction = new Rule_Undefine(pContext, T); // break; // case "<Run_File_PGM_Statement>": // this.reduction = new Rule_Run_File_PGM_Statement(pContext, T); // break; // case "<Run_String_Statement>": // this.reduction = new Rule_Run_String_Statement(pContext, T); // break; // case "<Run_PGM_In_Db_Statement>": // this.reduction = new Rule_Run_PGM_In_Db_Statement(pContext, T); // break; // case "<Delete_Records_All_Statement>": // this.reduction = new Rule_Delete_Records_All_Statement(pContext, T); // break; // case "<Delete_Records_Selected_Statement>": // this.reduction = new Rule_Delete_Records_Selected_Statement(pContext, T); // break; // case "<Simple_Print_Out_Statement>": // case "<File_Print_Out_Statement>": // this.reduction = new Rule_Printout(pContext, T); // break; // case "<SQL_Execute_Command>": // this.reduction = new Rule_SQLExec(pContext, T); // break; // case "<RecordSet_Command>": // this.reduction = new Rule_RecordSet(pContext, T); // break; // case "<Define_Connection_Command>": // this.reduction = new Rule_Define_Connection(pContext, T); // break; // case "<Regress_Statement>": // this.reduction = new Rule_LinearRegression(pContext, T); // break; // case "<Logistic_Statement>": // this.reduction = new Rule_LogisticRegression(pContext, T); // break; // case "<CoxPH_Statement>": // this.reduction = new Rule_CoxPH(pContext, T); // break; // case "<KM_Survival_Statement>": // this.reduction = new Rule_KMSurvival(pContext, T); // break; // case "<Define_Dll_Statement>": // this.reduction = new Rule_DLL_Statement(pContext, T); // break; // case "<Define_Group_Statement>": // this.reduction = new Rule_Define_Group(pContext, T); // break; // case "<Summarize_Statement>": // this.reduction = new Rule_Summarize(pContext, T); // break; // case "<Set_Statement>": // this.reduction = new Rule_Set(pContext, T); // break; // case "<Match_Row_All_Statement>": // case "<Match_Row_Except_Statement>": // case "<Match_Column_All_Statement>": // case "<Match_Column_Except_Statement>": // case "<Match_Row_Column_Statement>": // this.reduction = new Rule_Match(pContext, T); // break; // case "<Graph_Statement>": // case "<Simple_Graph_Statement>": // case "<Strata_Var_Graph_Statement>": // case "<Weight_Var_Graph_Statement>": // case "<Stra_Wei_Var_Graph_Statement>": // case "<Graph_Opt_1_Statement>": // case "<Graph_Opt_2_Statement>": // case "<Graph_Opt_3_Statement>": // case "<Graph_Opt_4_Statement>": // case "<Graph_Opt_5_Statement>": // case "<Graph_Generic_Opt_Statement>": // this.reduction = new Rule_Graph(pContext, T); // break; // //**these are not yet implemented; move up when completed // //**these are not yet implemented; move up when completed // //**these are not yet implemented; move up when completed // //**these are not yet implemented; move up when completed // //**these are not yet implemented; move up when completed // case "<Simple_Run_Statement>": // case "<Undelete_All_Statement>": // case "<Undelete_Selected_Statement>": // // Build 6 // case "<About_Statement>": // case "<Browser_Statement>": // case "<Browser_Size_Statement>": // case "<Button_Offset_Size_1_Statement>": // case "<Button_Offset_Size_2_Statement>": // case "<Button_Offset_1_Statement>": // case "<Button_Offset_2_Statement>": // case "<Call_Statement>": // case "<Simple_CMD_Statement>": // case "<CMD_Line_Statement>": // case "<Delete_Table_Short_Statement>": // case "<Exit_Statement>": // case "<File_Dialog_Statement>": // case "<Get_Path_Statement>": // case "<Help_File_Statement>": // case "<Simple_Help_Statement>": // case "<Link_Statement>": // case "<Link_Remove_Statement>": // case "<Map_AVG_Statement>": // case "<Map_Case_Statement>": // case "<Map_Sum_Statement>": // case "<Map_Count_Statement>": // case "<Map_Min_Statement>": // case "<Map_Max_Statement>": // case "<Map_Opt_1_Statement>": // case "<Map_Opt_2_Statement>": // case "<Map_Opt_3_Statement>": // case "<Map_Opt_4_Statement>": // case "<Map_Opt_5_Statement>": // case "<Menu_Statement>": // case "<Menu_Command_Statement>": // case "<Menu_Dialog_Statement>": // case "<Menu_Execute_Statement>": ////! case "<Menu_Help_Statement>": ////! case "<Menu_If_Statement>": // case "<Menu_Item_Block_Name_Statement>": // case "<Menu_Item_Separator_Statement>": // case "<Menu_Replace_Statement>": // case "<Move_Buttons_Statement>": // case "<New_Page_Statement>": // case "<On_Browser_Exit_Block>": // case "<Picture_Statement>": // case "<Picture_Size_Statement>": // case "<Popup_Statement>": // case "<Repeat_Statement>": ////! case "<Replace_Statement>": // case "<Screen_Text_Statement>": // case "<Set_Buttons_Statement>": // case "<Set_DB_Version_Statement>": // case "<Set_DOS_Win_Statement>": // case "<Set_Import_Year_Statement>": // case "<Set_Ini_Dir_Statement>": // case "<Set_Language_Statement>": // case "<Set_Picture_Statement>": // case "<Set_Work_Dir_Statement>": // case "<ShutDown_Block>": // case "<Startup_Block>": // case "<Sys_Info_Statement>": // case "<All_Standard_Undefine_Statement>": // case "<All_Global_Undefine_Statement>": // case "<Wait_For_Statement>": // case "<Wait_For_Exit_Statement>": // case "<Wait_For_File_Exists_Statement>": // case "<Command_Block>": // case "<On_Browser_Exit_Empty_Block>": // case "<Startup_Empty_Block>": // case "<ShutDown_Empty_Block>": // case "<Menu_Empty_Block>": // case "<Popup_Empty_Block>": // case "<Empty_Command_Block>": // default: // break; // } }
public Rule_Freq(Rule_Context pContext, NonterminalToken pToken) : base(pContext) { this.IdentifierList = new List <string>(); /*<Freq_Variable_List> ::= Identifier | Identifier <Freq_Variable_List> * * <Freq_All_Statement> ::= FREQ '*' | FREQ '*' <FreqOpts> | FREQ <Freq_Variable_List> | FREQ <Freq_Variable_List> <FreqOpts> | FREQ '*' EXCEPT <Freq_Variable_List> | FREQ '*' EXCEPT <Freq_Variable_List> <FreqOpts> | | <FreqOpts> ::= <FreqOpts> <FreqOpt> | <FreqOpt> | | <FreqOpt> ::= WEIGHTVAR '=' Identifier | STRATAVAR '=' <Freq_Variable_List> |NOWRAP |COLUMNSIZE '=' DecLiteral |PSUVAR '=' Identifier | OUTTABLE '=' Identifier | <SetClause> */ commandText = this.ExtractTokens(pToken.Tokens); foreach (Token T in pToken.Tokens) { if (T is NonterminalToken) { NonterminalToken NT = (NonterminalToken)T; switch (NT.Symbol.ToString()) { case "<Freq_Variable_List>": this.IdentifierList.AddRange(AnalysisRule.SpliIdentifierList(this.ExtractTokens(NT.Tokens).Trim())); break; case "<FreqOpts>": this.SetFrequencyOptions(NT); break; case "<FreqOpt>": this.SetFrequencyOption(NT); break; } } else { TerminalToken TT = (TerminalToken)T; switch (TT.Symbol.ToString()) { case "*": this.IdentifierList.AddRange("*".Split(' ')); break; case "EXCEPT": this.isExceptionList = true; break; } } } /* * if (pToken.Tokens.Length == 2) * { * this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).Split(' '); * } * else if (pToken.Tokens.Length <= 3) * { * this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).Split(' '); * NonterminalToken T = (NonterminalToken)pToken.Tokens[2]; * * this.SetFrequencyOptions(T); * * } * else * { * this.IdentifierList = this.GetCommandElement(pToken.Tokens, 3).Split(' '); * //this.isExceptionList = true; * this.SetFrequencyOptions((NonterminalToken)pToken.Tokens[4]); * }*/ //<OutTableOpt> ::= OUTTABLE '=' Identifier <KeyVarList> //<KeyVarList> ::= KEYVARS '=' <IdentifierList> /* * !*** Freq Statement ***! * <Freq_All_Statement> ::= FREQ '*' <FreqOpts> * <Freq_Columns_Statement> ::= FREQ <IdentifierList> <FreqOpts> * <Freq_All_Except_Statement> ::= FREQ '*' EXCEPT <IdentifierList> <FreqOpts> * * <FreqOpts> ::= <FreqOpts> <FreqOpt> | <FreqOpt> | !Null * * <FreqOpt> ::= <WeightOpt> | <FreqOptStrata> | <OutTableOpt> | <SetClause> | <FreqOptNoWrap> | <FreqOptColumnSize> | <FreqOptPsuvar> | | <WeightOpt> ::= WEIGHTVAR '=' Identifier | <FreqOptStrata> ::= STRATAVAR '=' <IdentifierList> | <FreqOptNoWrap> ::= NOWRAP | <FreqOptColumnSize> ::= COLUMNSIZE '=' DecLiteral | <FreqOptPsuvar> ::= PSUVAR '=' Identifier | | !*** End ***! */ }
public Rule_Value(Rule_Context pContext, Token pToken) : base(pContext) { /* ::= Identifier | <Literal> | Boolean | '(' <Expr List> ')' */ if (pToken is NonterminalToken) { NonterminalToken T = (NonterminalToken)pToken; if (T.Tokens.Length == 1) { DateTime dateTime_temp; switch (T.Rule.Rhs[0].ToString()) { case "<Qualified ID>": this.Id = this.SetQualifiedId(T.Tokens[0]); break; case "Identifier": this.Id = this.GetCommandElement(T.Tokens, 0).Trim(new char[] {'[',']'}); break; case "(": case "<FunctionCall>": this.value = new Rule_FunctionCall(pContext, (NonterminalToken)T.Tokens[1]); break; case "<Literal>": this.value = this.GetCommandElement(T.Tokens, 0).Trim('"'); break; case "<Literal_String>": case "String": this.value = this.GetCommandElement(T.Tokens, 0).Trim('"'); break; case "<Literal_Char>": case "CharLiteral": this.value = this.GetCommandElement(T.Tokens, 0).Trim('\''); break; case "Boolean": string string_temp = this.GetCommandElement(T.Tokens, 0); if (string_temp == "(+)" || string_temp.ToLowerInvariant() == "true" || string_temp.ToLowerInvariant() == "yes") { this.value = true; } else if (string_temp == "(-)" || string_temp.ToLowerInvariant() == "false" || string_temp.ToLowerInvariant() == "no") { this.value = false; } else if (string_temp == "(.)") { this.value = null; } break; case "<Decimal_Number>": case "<Number>": case "<Real_Number>": case "<Hex_Number>": case "DecLiteral": case "RealLiteral": case "HexLiteral": double Decimal_temp; if (double.TryParse(this.GetCommandElement(T.Tokens, 0), out Decimal_temp)) { this.value = Decimal_temp; } break; case "<Literal_Date>": case "Date": if (DateTime.TryParse(this.GetCommandElement(T.Tokens, 0), out dateTime_temp)) { DateTime dt = new DateTime(dateTime_temp.Year, dateTime_temp.Month, dateTime_temp.Day); this.value = dt; } else { this.value = null; } break; case "<Literal_Time>": case "<Literal_Date_Time>": case "Time": case "Date Time": if (DateTime.TryParse(this.GetCommandElement(T.Tokens, 0), out dateTime_temp)) { this.value = dateTime_temp; } break; case "<Value>": this.value = new Rule_Value(this.Context, T.Tokens[0]); break; default: this.value = this.GetCommandElement(T.Tokens, 0).Trim('"');; break; } } else { //this.value = new Rule_ExprList(pContext, (NonterminalToken)T.Tokens[1]); //this.value = AnalysisRule.BuildStatments(pContext, T.Tokens[1]); if (T.Tokens.Length == 0) { this.value = AnalysisRule.BuildStatments(pContext, T); } else { this.value = AnalysisRule.BuildStatments(pContext, T.Tokens[1]); } } } else { TerminalToken TT = (TerminalToken)pToken; DateTime dateTime_temp; switch (TT.Symbol.ToString()) { case "Identifier": this.Id = TT.Text; break; case "<Literal>": this.value = TT.Text.Trim('"'); break; case "<Literal_String>": case "String": this.value = TT.Text.Trim('"'); break; case "<Literal_Char>": case "CharLiteral": this.value = TT.Text.Trim('\''); break; case "Boolean": string string_temp = TT.Text; if (string_temp == "(+)" || string_temp.ToLowerInvariant() == "true" || string_temp.ToLowerInvariant() == "yes") { this.value = true; } else if (string_temp == "(-)" || string_temp.ToLowerInvariant() == "false" || string_temp.ToLowerInvariant() == "no") { this.value = false; } else if (string_temp == "(.)") { this.value = null; } break; case "<Decimal_Number>": case "<Number>": case "<Real_Number>": case "<Hex_Number>": case "DecLiteral": case "RealLiteral": case "HexLiteral": double Decimal_temp; if (double.TryParse(TT.Text, out Decimal_temp)) { this.value = Decimal_temp; } break; case "<Literal_Date>": case "Date": if (DateTime.TryParse(TT.Text, out dateTime_temp)) { DateTime dt = new DateTime(dateTime_temp.Year, dateTime_temp.Month, dateTime_temp.Day); this.value = dt; } else { this.value = null; } break; case "<Literal_Time>": case "<Literal_Date_Time>": case "Time": case "Date Time": if (DateTime.TryParse(TT.Text, out dateTime_temp)) { this.value = dateTime_temp; } break; default: this.value = TT.Text.Trim('"');; break; } } if (this.Id == null && this.value == null) { } }