当前位置: 首页>>代码示例>>C#>>正文


C# ITokener.Commit方法代码示例

本文整理汇总了C#中ITokener.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# ITokener.Commit方法的具体用法?C# ITokener.Commit怎么用?C# ITokener.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITokener的用法示例。


在下文中一共展示了ITokener.Commit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseQuotedString

    public static int ParseQuotedString(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart, indexStart2, indexTemp, indexTemp2, state, state2, tx3;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        index = ParseCFWS(str, index, endIndex, tokener);
        if (index < endIndex && (str[index] == 34)) {
          ++index;
        } else {
          index = indexStart; break;
        }
        while (true) {
          state2 = (tokener != null) ? tokener.GetState() : 0;
          indexTemp2 = index;
          do {
            indexStart2 = index;
            index = ParseFWS(str, index, endIndex, tokener);
            tx3 = ParseQcontent(str, index, endIndex, tokener);
            if (tx3 == index) {
              index = indexStart2; break;
            } else {
              index = tx3;
            }
            indexTemp2 = index;
            index = indexStart2;
          } while (false);
          if (indexTemp2 != index) {
            index = indexTemp2;
          } else if (tokener != null) {
            tokener.RestoreState(state2); break;
          } else {
 break;
}
        }
        index = ParseFWS(str, index, endIndex, tokener);
        if (index < endIndex && (str[index] == 34)) {
          ++index;
        } else {
          index = indexStart; break;
        }
        index = ParseCFWS(str, index, endIndex, tokener);
        indexTemp = index;
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(7, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:57,代码来源:HeaderParser.cs

示例2: ParseCommentLax

    // Parses a comment using the obsolete syntax.
    internal static int ParseCommentLax(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart = index;
      var depth = 0;
      if (index < endIndex && (str[index] == 40)) {
        ++index;
      } else {
        return index;
      }
      int state = (tokener != null) ? tokener.GetState() : 0;
      do {
        while (true) {
          int indexTemp2;
          int state2 = (tokener != null) ? tokener.GetState() : 0;
          indexTemp2 = index;
          do {
            int indexStart2 = index;
            index = HeaderParser.ParseFWS(str, index, endIndex, null);
            do {
              int indexTemp3 = index;
              do {
                if (index < endIndex && ((str[index] >= 128 && str[index] <=
                  55295) || (str[index] >= 57344 && str[index] <= 65535))) {
                  ++indexTemp3; break;
                }
                if (index + 1 < endIndex && ((str[index] >= 55296 &&
                  str[index] <= 56319) && (str[index + 1] >= 56320 &&
                  str[index + 1] <= 57343))) {
                  indexTemp3 += 2; break;
                }
                int indexTemp4;
      indexTemp4 = HeaderParser.ParseQuotedPair(
str,
index,
endIndex,
null);
                if (indexTemp4 != index) {
                  indexTemp3 = indexTemp4; break;
                }
                if (index < endIndex && ((str[index] >= 1 && str[index] <=
                  8) || (str[index] >= 11 && str[index] <= 12) ||
                  (str[index] >= 14 && str[index] <= 31) || (str[index] ==
                  127))) {
                  ++indexTemp3; break;
                }
                if (index < endIndex && ((str[index] >= 93 && str[index] <=
                  126) || (str[index] >= 42 && str[index] <= 91) ||
                  (str[index] >= 33 && str[index] <= 39))) {
                  ++indexTemp3; break;
                }
              } while (false);
              if (indexTemp3 != index) {
                index = indexTemp3;
              } else {
                index = indexStart2; break;
              }
            } while (false);
            if (index == indexStart2) {
              break;
            }
            indexTemp2 = index;
            index = indexStart2;
          } while (false);
          if (indexTemp2 != index) {
            index = indexTemp2;
          } else if (tokener != null) {
            tokener.RestoreState(state2); break;
          } else {
            break;
          }
        }
        index = HeaderParser.ParseFWS(str, index, endIndex, null);
        if (index < endIndex && str[index] == 41) {
          // End of current comment
          ++index;
          if (depth == 0) {
            if (tokener != null) {
              tokener.Commit(TokenComment, indexStart, index);
            }
            return index;
          }
          --depth;
        } else if (index < endIndex && str[index] == 40) {
          // Start of nested comment
          ++index;
          ++depth;
        } else {
          if (tokener != null) {
            tokener.RestoreState(state);
          }
          return indexStart;
        }
      } while (true);
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:98,代码来源:HeaderParserUtility.cs

示例3: ParsePhraseAtom

    public static int ParsePhraseAtom(
string str,
int index,
int endIndex,
ITokener tokener) {
      int i, indexStart, indexTemp, indexTemp2, indexTemp3, state;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        for (i = 0; true; ++i) {
          indexTemp2 = index;
          do {
            if (index < endIndex && ((str[index] >= 65 && str[index] <=
              90) || (str[index] >= 97 && str[index] <= 122))) {
              ++indexTemp2; break;
            }
            if (index < endIndex && ((str[index] >= 48 && str[index] <= 57) ||
              (str[index] == 33) || (str[index] == 35) || (str[index] ==
              36) || (str[index] == 37) || (str[index] == 38) || (str[index]
              == 39) || (str[index] == 42) || (str[index] == 43) ||
              (str[index] == 45) || (str[index] == 47) || (str[index] == 61) ||
              (str[index] == 63) || (str[index] == 94) || (str[index] ==
              95) || (str[index] == 96) || (str[index] == 123) ||
              (str[index] == 124) || (str[index] == 125) || (str[index] ==
              126))) {
              ++indexTemp2; break;
            }
            indexTemp3 = index;
            do {
              if (index < endIndex && ((str[index] >= 128 && str[index] <=
                55295) || (str[index] >= 57344 && str[index] <= 65535))) {
                ++indexTemp3; break;
              }
              if (index + 1 < endIndex && ((str[index] >= 55296 &&
                str[index] <= 56319) && (str[index + 1] >= 56320 &&
                str[index + 1] <= 57343))) {
                indexTemp3 += 2; break;
              }
            } while (false);
            if (indexTemp3 != index) {
              indexTemp2 = indexTemp3; break;
            }
          } while (false);
          if (indexTemp2 != index) {
            index = indexTemp2;
          } else {
            if (i < 1) {
              index = indexStart;
            }
            break;
          }
        }
        if (index == indexStart) {
          break;
        }
        indexTemp = index;
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(3, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:67,代码来源:HeaderParser.cs

示例4: ParsePhraseAtomOrDot

    public static int ParsePhraseAtomOrDot(
string str,
int index,
int endIndex,
ITokener tokener) {
      int i, indexStart, indexTemp, indexTemp2, state;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        indexTemp2 = index;
        for (i = 0; true; ++i) {
          indexTemp2 = ParseAtext(str, index, endIndex, tokener);
          if (indexTemp2 == index) {
            if (i < 1) {
              indexTemp = indexStart;
            }
            break;
          } else {
 index = indexTemp2;
}
        }
        index = indexStart;
        if (indexTemp2 != indexStart) {
          indexTemp = indexTemp2; break;
        }
        if (index < endIndex && (str[index] == 46)) {
          ++indexTemp; break;
        }
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(4, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:39,代码来源:HeaderParser.cs

示例5: ParsePhrase

    public static int ParsePhrase(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart, indexTemp, indexTemp2, state, tx2;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        tx2 = ParsePhraseWord(str, index, endIndex, tokener);
        if (tx2 == index) {
          break;
        } else {
          index = tx2;
        }
        while (true) {
          indexTemp2 = ParsePhraseWordOrDot(str, index, endIndex, tokener);
          if (indexTemp2 != index) {
            index = indexTemp2;
          } else {
 break;
}
        }
        indexTemp = index;
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(1, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:35,代码来源:HeaderParser.cs

示例6: ParseMailbox

    public static int ParseMailbox(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart, indexTemp, indexTemp2, state;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        indexTemp2 = ParseNameAddr(str, index, endIndex, tokener);
        if (indexTemp2 != index) {
          indexTemp = indexTemp2; break;
        }
        indexTemp2 = ParseAddrSpec(str, index, endIndex, tokener);
        if (indexTemp2 != index) {
          indexTemp = indexTemp2; break;
        }
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(6, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:28,代码来源:HeaderParser.cs

示例7: ParseLocalPart

    public static int ParseLocalPart(
string str,
int index,
int endIndex,
ITokener tokener) {
   int indexStart, indexStart2, indexTemp, indexTemp2, state, state2, tx2,
        tx3;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        tx2 = ParseWord(str, index, endIndex, tokener);
        if (tx2 == index) {
          break;
        } else {
          index = tx2;
        }
        while (true) {
          state2 = (tokener != null) ? tokener.GetState() : 0;
          indexTemp2 = index;
          do {
            indexStart2 = index;
            if (index < endIndex && (str[index] == 46)) {
              ++index;
            } else {
              break;
            }
            tx3 = ParseWord(str, index, endIndex, tokener);
            if (tx3 == index) {
              index = indexStart2; break;
            } else {
              index = tx3;
            }
            indexTemp2 = index;
            index = indexStart2;
          } while (false);
          if (indexTemp2 != index) {
            index = indexTemp2;
          } else if (tokener != null) {
            tokener.RestoreState(state2); break;
          } else {
 break;
}
        }
        indexTemp = index;
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(8, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:55,代码来源:HeaderParser.cs

示例8: ParseGroup

    public static int ParseGroup(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart, indexTemp, state, tx2;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        tx2 = ParseDisplayName(str, index, endIndex, tokener);
        if (tx2 == index) {
          break;
        } else {
          index = tx2;
        }
        if (index < endIndex && (str[index] == 58)) {
          ++index;
        } else {
          index = indexStart; break;
        }
        index = ParseGroupList(str, index, endIndex, tokener);
        if (index < endIndex && (str[index] == 59)) {
          ++index;
        } else {
          index = indexStart; break;
        }
        index = ParseCFWS(str, index, endIndex, tokener);
        indexTemp = index;
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(5, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:39,代码来源:HeaderParser.cs

示例9: ParseDomain

    public static int ParseDomain(
string str,
int index,
int endIndex,
ITokener tokener) {
      int indexStart, indexStart2, indexStart3, indexTemp, indexTemp2,
        indexTemp3, state, state2, state3, tx3, tx4;
      indexStart = index;
      state = (tokener != null) ? tokener.GetState() : 0;
      indexTemp = index;
      do {
        indexTemp2 = ParseDomainLiteral(str, index, endIndex, tokener);
        if (indexTemp2 != index) {
          indexTemp = indexTemp2; break;
        }
        state2 = (tokener != null) ? tokener.GetState() : 0;
        indexTemp2 = index;
        do {
          indexStart2 = index;
          tx3 = ParseAtom(str, index, endIndex, tokener);
          if (tx3 == index) {
            break;
          } else {
            index = tx3;
          }
          while (true) {
            state3 = (tokener != null) ? tokener.GetState() : 0;
            indexTemp3 = index;
            do {
              indexStart3 = index;
              if (index < endIndex && (str[index] == 46)) {
                ++index;
              } else {
                break;
              }
              tx4 = ParseAtom(str, index, endIndex, tokener);
              if (tx4 == index) {
                index = indexStart3; break;
              } else {
                index = tx4;
              }
              indexTemp3 = index;
              index = indexStart3;
            } while (false);
            if (indexTemp3 != index) {
              index = indexTemp3;
            } else if (tokener != null) {
              tokener.RestoreState(state3); break;
            } else {
 break;
}
          }
          indexTemp2 = index;
          index = indexStart2;
        } while (false);
        if (indexTemp2 != index) {
          indexTemp = indexTemp2; break;
        }
        if (tokener != null) {
 tokener.RestoreState(state2);
}
      } while (false);
      if (tokener != null) {
        if (indexTemp == indexStart) {
 tokener.RestoreState(state);
} else {
 tokener.Commit(9, indexStart, indexTemp);
}
      }
      return indexTemp;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:71,代码来源:HeaderParser.cs


注:本文中的ITokener.Commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。