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


C# GetMemberOptions.StatementKeywords方法代码示例

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


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

示例1: GetKeywordMembers

        private IEnumerable<MemberResult> GetKeywordMembers(GetMemberOptions options, EnvironmentRecord scope) {
            IEnumerable<string> keywords = null;
            if (options.ExpressionKeywords()) {
                // keywords available in any context
                keywords = _exprKeywords;
            } else {
                keywords = Enumerable.Empty<string>();
            }

            if (options.StatementKeywords()) {
                keywords = keywords.Union(_stmtKeywords);
            }

            return keywords.Select(kw => new MemberResult(name: kw, documentation: kw, type: JsMemberType.Keyword));
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:15,代码来源:ModuleAnalysis.cs

示例2: GetKeywordMembers

        private IEnumerable<MemberResult> GetKeywordMembers(GetMemberOptions options, InterpreterScope scope)
        {
            IEnumerable<string> keywords = null;

            if (options.ExpressionKeywords()) {
                // keywords available in any context
                keywords = PythonKeywords.Expression(ProjectState.LanguageVersion);
            } else {
                keywords = Enumerable.Empty<string>();
            }

            if (options.StatementKeywords()) {
                keywords = keywords.Union(PythonKeywords.Statement(ProjectState.LanguageVersion));
            }

            if (!(scope is FunctionScope)) {
                keywords = keywords.Except(PythonKeywords.InvalidOutsideFunction(ProjectState.LanguageVersion));
            }

            return keywords.Select(kw => new MemberResult(kw, PythonMemberType.Keyword));
        }
开发者ID:,项目名称:,代码行数:21,代码来源:

示例3: GetKeywordMembers

        private IEnumerable<MemberResult> GetKeywordMembers(GetMemberOptions options, InterpreterScope scope)
        {
            if (options.ExpressionKeywords()) {
                // keywords available in any context
                yield return new MemberResult("and", JMemberType.Keyword);
                yield return new MemberResult("as", JMemberType.Keyword);
                yield return new MemberResult("else", JMemberType.Keyword);
                yield return new MemberResult("for", JMemberType.Keyword);
                yield return new MemberResult("if", JMemberType.Keyword);
                yield return new MemberResult("in", JMemberType.Keyword);
                yield return new MemberResult("is", JMemberType.Keyword);
                yield return new MemberResult("lambda", JMemberType.Keyword);
                yield return new MemberResult("not", JMemberType.Keyword);
                yield return new MemberResult("or", JMemberType.Keyword);
            }

            bool isStmtContext = options.StatementKeywords();

            // and now the keywords...
            if (scope is FunctionScope) {
                if (isStmtContext) {
                    yield return new MemberResult("return", JMemberType.Keyword);
                }

                // yield is always available as an expression in 2.5+
                yield return new MemberResult("yield", JMemberType.Keyword);
            }

            if (isStmtContext) {
                // statement context only
                yield return new MemberResult("assert", JMemberType.Keyword);
                yield return new MemberResult("break", JMemberType.Keyword);
                yield return new MemberResult("continue", JMemberType.Keyword);
                yield return new MemberResult("class", JMemberType.Keyword);
                yield return new MemberResult("def", JMemberType.Keyword);
                yield return new MemberResult("del", JMemberType.Keyword);
                yield return new MemberResult("elif", JMemberType.Keyword);
                yield return new MemberResult("except", JMemberType.Keyword);
                yield return new MemberResult("finally", JMemberType.Keyword);
                yield return new MemberResult("from", JMemberType.Keyword);
                yield return new MemberResult("global", JMemberType.Keyword);
                yield return new MemberResult("import", JMemberType.Keyword);
                yield return new MemberResult("pass", JMemberType.Keyword);
                yield return new MemberResult("raise", JMemberType.Keyword);
                yield return new MemberResult("try", JMemberType.Keyword);
                yield return new MemberResult("while", JMemberType.Keyword);
                yield return new MemberResult("with", JMemberType.Keyword);
            }

            if (ProjectState.LanguageVersion.Is7x()) {
                yield return new MemberResult("False", JMemberType.Keyword);
                yield return new MemberResult("None", JMemberType.Keyword);
                yield return new MemberResult("True", JMemberType.Keyword);

                // statement context only
                if (isStmtContext) {
                    yield return new MemberResult("nonlocal", JMemberType.Keyword);
                }
            }

            if (ProjectState.LanguageVersion.Is6x() && isStmtContext) {
                // statement context only
                yield return new MemberResult("exec", JMemberType.Keyword);
                yield return new MemberResult("print", JMemberType.Keyword);
            }
        }
开发者ID:borota,项目名称:JTVS,代码行数:66,代码来源:ModuleAnalysis.cs


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