예제 #1
0
파일: Rule.cs 프로젝트: NALSS/epiinfo-82474
 /// <summary>
 /// Build a string composed of all tokens in tree.
 /// </summary>
 /// <param name="tokens">tokens</param>
 /// <returns>string</returns>
 protected string ExtractTokens(Token[] tokens)
 {
     int max = tokens.GetUpperBound(0);
     string tokensInTree = "";
     for (int i = tokens.GetLowerBound(0); i <= max; i++)
     {
         if (tokens[i] is NonterminalToken)
         {
             tokensInTree += ExtractTokens(((NonterminalToken)tokens[i]).Tokens);
         }
         else
         {
             tokensInTree += tokens[i].ToString() + " ";
         }
     }
     return tokensInTree;
 }
예제 #2
0
 protected string ExtractToken(Token[] tokens)
 {
     string tokensInTree = ""; int max = tokens.GetUpperBound(0);
     for (int i = tokens.GetLowerBound(0); i <= max; i++)
     {
         if (tokens[i] is NonterminalToken)
         {
             if (tokens[i].ToString().Contains("<Qualified ID>"))
                 tokensInTree += ExtractToken(((NonterminalToken)tokens[i]).Tokens);
         }
         else
         {
             if (((com.calitha.goldparser.TerminalToken)(tokens[i])).Symbol.ToString() == "Identifier")
             {
                 if (tokens[i].ToString() != "false" & tokens[i].ToString() != "true")
                     tokensInTree += tokens[i].ToString() + " ";
             }
         }
     }
     return tokensInTree;
 }