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


C# IdentifierTerminal.AddKeywordList方法代码示例

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


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

示例1: CreateCSharpIdentifier

        public static IdentifierTerminal CreateCSharpIdentifier(string name)
        {
            IdentifierTerminal id = new IdentifierTerminal(name);
              id.SetOption(TermOptions.CanStartWithEscape);
              string strKeywords =
            "abstract as base bool break byte case catch char checked " +
            "class	const	continue decimal default delegate  do double else enum event explicit extern false finally " +
            "fixed float for foreach goto if implicit in int interface internal is lock long namespace " +
            "new null object operator out override params private protected public " +
            "readonly ref return sbyte sealed short sizeof stackalloc static string " +
            "struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void " +
            "volatile while";
              id.AddKeywordList(strKeywords);

              id.AddPrefixFlag("@", ScanFlags.IsNotKeyword | ScanFlags.DisableEscapes);
              //From spec:
              //Start char is "_" or letter-character, which is a Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl
              id.StartCharCategories.AddRange(new UnicodeCategory[] {
             UnicodeCategory.UppercaseLetter, //Ul
             UnicodeCategory.LowercaseLetter, //Ll
             UnicodeCategory.TitlecaseLetter, //Lt
             UnicodeCategory.ModifierLetter,  //Lm
             UnicodeCategory.OtherLetter,     //Lo
             UnicodeCategory.LetterNumber     //Nl
              });
              //Internal chars
              /* From spec:
              identifier-part-character: letter-character | decimal-digit-character | connecting-character |  combining-character |
              formatting-character
            */
              id.CharCategories.AddRange(id.StartCharCategories); //letter-character categories
              id.CharCategories.AddRange(new UnicodeCategory[] {
            UnicodeCategory.DecimalDigitNumber, //Nd
            UnicodeCategory.ConnectorPunctuation, //Pc
            UnicodeCategory.SpacingCombiningMark, //Mc
            UnicodeCategory.NonSpacingMark,       //Mn
            UnicodeCategory.Format                //Cf
              });
              //Chars to remove from final identifier
              id.CharsToRemoveCategories.Add(UnicodeCategory.Format);
              return id;
        }
开发者ID:Temperament,项目名称:FiestaShark,代码行数:42,代码来源:TerminalFactory.cs


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