コード例 #1
0
 /// <summary>
 ///		Obtiene un token a partir de una palabra clave de longitud fija
 /// </summary>
 private void CheckRuleWordFixed(RuleWordFixed rule, TokenCollection tokens, ref bool found)
 {
     foreach (string word in rule.Words)
     {
         if (!found && CharSeparator.LookAtChar(word.Length).EqualsIgnoreCase(word))
         {
             // Añade el token
             tokens.Add(GetToken(rule, word, true));
             // Indica que se ha encontrado
             found = true;
         }
     }
 }
コード例 #2
0
 /// <summary>
 ///		Obtiene la cadena de inicio que coincide con la regla
 /// </summary>
 private string GetStartRule(string[] starts)
 {
     // Busca la palabra de inicio que coincide con la regla
     if (starts?.Length > 0)
     {
         foreach (string start in starts)
         {
             if (CharSeparator.LookAtChar(start.Length).EqualsIgnoreCase(start))
             {
                 return(start);
             }
         }
     }
     // Si ha llegado hasta aquí es porque no se corresponde con la regla
     return("");
 }
コード例 #3
0
 /// <summary>
 ///		Comprueba una regla de palabra reservada
 /// </summary>
 private void CheckRuleWord(RuleWord rule, TokenCollection tokens, ref bool found)
 {
     foreach (string word in rule.Words)
     {
         if (!found && CharSeparator.LookAtChar(word.Length).Equals(word, StringComparison.CurrentCultureIgnoreCase))
         {
             if (rule.ToFirstSpace && CharSeparator.CheckIsSpace(CharSeparator.LookAtChars(word.Length, 1)))
             {
                 // Añade el token
                 tokens.Add(GetToken(rule, word, true));
                 // Indica que se ha encontrado
                 found = true;
             }
         }
     }
 }