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


C# Modifiers.Add方法代码示例

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


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

示例1: ParseModifierList

 void ParseModifierList(Modifiers m)
 {
     while (StartOf(4)) {
     switch (la.kind) {
     case 46: {
         Get();
         m.Add(newMod);
         break;
     }
     case 55: {
         Get();
         m.Add(publicMod);
         break;
     }
     case 54: {
         Get();
         m.Add(protectedMod);
         break;
     }
     case 41: {
         Get();
         m.Add(internalMod);
         break;
     }
     case 53: {
         Get();
         m.Add(privateMod);
         break;
     }
     case 76: {
         Get();
         m.Add(unsafeMod);
         break;
     }
     case 64: {
         Get();
         m.Add(staticMod);
         break;
     }
     case 56: {
         Get();
         m.Add(readonlyMod);
         break;
     }
     case 81: {
         Get();
         m.Add(volatileMod);
         break;
     }
     case 79: {
         Get();
         m.Add(virtualMod);
         break;
     }
     case 60: {
         Get();
         m.Add(sealedMod);
         break;
     }
     case 51: {
         Get();
         m.Add(overrideMod);
         break;
     }
     case 6: {
         Get();
         m.Add(abstractMod);
         break;
     }
     case 28: {
         Get();
         m.Add(externMod);
         break;
     }
     }
     }
 }
开发者ID:vadimskipin,项目名称:coco-csharp,代码行数:77,代码来源:CSharp3.cs

示例2: ParseFunctionParameterList

        private void ParseFunctionParameterList(ScriptFunction func)
        {
            Modifiers modifiers;
            bool atEndOfParameterList = false;

            while ((!atEndOfParameterList) &&
                   (!_source.NextIsKeyword(PredefinedSymbol.CloseParenthesis)))
            {
                modifiers = new Modifiers();

                while (_source.PeekNextToken() is ModifierToken)
                {
                    modifiers.Add((ModifierToken)_source.ReadNextToken());
                }

                if (_source.NextIsKeyword(PredefinedSymbol.VariableArguments))
                {
                    func.VariableArguments = true;
                    _source.ExpectKeyword(PredefinedSymbol.CloseParenthesis, "Variable arguments must be the last parameter");
                    break;
                }

                Token parameterType = _source.ReadNextAsVariableType();
                Token parameterName = null;
                _source.IgnoreAsteriskIfPresent();

                CompilerUtils.VerifyModifiersAgainstType(ModifierTargets.FunctionParameter, modifiers);

                VerifyParameterTypeValidForFunction(parameterType);

                if (!_source.PeekNextToken().Defined)
                {
                    parameterName = _source.ReadNextTokenAndThrowIfAlreadyDefined();
                }
                else
                {
                    func.IsPrototypeOnly = true;
                }

                FunctionParameter parameter = new FunctionParameter(parameterType, parameterName);
                parameter.Modifiers = modifiers;

                if (_source.NextIsKeyword(PredefinedSymbol.SetEqual))
                {
                    parameter.DefaultValue = _source.ReadNextAsConstInt();
                }
                
                if (_source.NextIsKeyword(PredefinedSymbol.CloseParenthesis))
                {
                    atEndOfParameterList = true;
                }
                else
                {
                    _source.ExpectKeyword(PredefinedSymbol.Comma);
                }

                func.Parameters.Add(parameter);
            }
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:59,代码来源:ScriptCompiler.cs

示例3: ParseInterfaceMemberDeclaration

        void ParseInterfaceMemberDeclaration()
        {
            Modifiers m = new Modifiers(this);
            // every interface member is public
            m.Add(Parser.publicMod);
            TypeKind dummy;
            bool newSet = false;

            while (la.kind == 98) {
            ParseAttributes();
            }
            if (la.kind == 46) {
            Get();
            m.Add(Parser.newMod); newSet = true;
            }
            if (StartOf(11)) {
            if (la.kind == 76) {
                Get();
                m.Add(Parser.unsafeMod);
            }
            if (la.kind == 46) {
                Get();
                if (newSet) Error("duplicate operand 'new'"); m.Add(Parser.newMod);
            }
            ParseType(out dummy, true);
            if (la.kind == 1) {
                Get();
                if (la.kind == 99 || la.kind == 101) {
                    if (la.kind == 101) {
                        ParseTypeParameterList();
                    }
                    Expect(99);
                    if (StartOf(7)) {
                        ParseFormalParameterList();
                    }
                    Expect(115);
                    while (la.kind == 1) {
                        ParseTypeParameterConstraintsClause();
                    }
                    Expect(116);
                } else if (la.kind == 97) {
                    Get();
                    ParseInterfaceAccessors(m);
                    Expect(113);
                } else SynErr(148);
            } else if (la.kind == 68) {
                Get();
                Expect(98);
                ParseFormalParameterList();
                Expect(114);
                Expect(97);
                ParseInterfaceAccessors(m);
                Expect(113);
            } else SynErr(149);
            } else if (la.kind == 26) {
            Get();
            ParseType(out dummy, false);
            Expect(1);
            Expect(116);
            } else SynErr(150);
        }
开发者ID:vadimskipin,项目名称:coco-csharp,代码行数:61,代码来源:CSharp3.cs

示例4: TypeModifier

        private void TypeModifier(Modifiers m)
        {
            switch (this.la.kind)
            {
                case 0x53:
                    base.lexer.NextToken();
                    m.Add(Modifier.Internal, this.t.Location);
                    return;

                case 0x58:
                    base.lexer.NextToken();
                    m.Add(Modifier.VBInterfaceEnums, this.t.Location);
                    return;

                case 1:
                    base.lexer.NextToken();
                    if (!(this.t.val == "partial"))
                    {
                        break;
                    }
                    m.Add(Modifier.Partial, this.t.Location);
                    return;

                case 0x30:
                    base.lexer.NextToken();
                    m.Add(Modifier.Dim, this.t.Location);
                    return;

                case 0x5f:
                    base.lexer.NextToken();
                    m.Add(Modifier.Private, this.t.Location);
                    return;

                case 0x60:
                    base.lexer.NextToken();
                    m.Add(Modifier.Protected, this.t.Location);
                    return;

                case 0x61:
                    base.lexer.NextToken();
                    m.Add(Modifier.Public, this.t.Location);
                    return;

                case 0x66:
                    base.lexer.NextToken();
                    m.Add(Modifier.Sealed, this.t.Location);
                    return;

                case 0x6a:
                    base.lexer.NextToken();
                    m.Add(Modifier.Static, this.t.Location);
                    return;

                case 0x76:
                    base.lexer.NextToken();
                    m.Add(Modifier.Unsafe, this.t.Location);
                    return;

                default:
                    base.SynErr(130);
                    break;
            }
        }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:63,代码来源:Parser.cs

示例5: AccessorModifiers

 private void AccessorModifiers(out Modifiers m)
 {
     m = new Modifiers();
     if (this.la.kind == 0x5f)
     {
         base.lexer.NextToken();
         m.Add(Modifier.Private, this.t.Location);
     }
     else if (this.la.kind == 0x60)
     {
         base.lexer.NextToken();
         m.Add(Modifier.Protected, this.t.Location);
         if (this.la.kind == 0x53)
         {
             base.lexer.NextToken();
             m.Add(Modifier.Internal, this.t.Location);
         }
     }
     else if (this.la.kind == 0x53)
     {
         base.lexer.NextToken();
         m.Add(Modifier.Internal, this.t.Location);
         if (this.la.kind == 0x60)
         {
             base.lexer.NextToken();
             m.Add(Modifier.Protected, this.t.Location);
         }
     }
     else
     {
         base.SynErr(0x9e);
     }
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:33,代码来源:Parser.cs

示例6: MemberModifier

        private void MemberModifier(Modifiers m)
        {
            switch (this.la.kind)
            {
                case 0x58:
                    base.lexer.NextToken();
                    m.Add(Modifier.VBInterfaceEnums, this.t.Location);
                    return;

                case 0x5d:
                    base.lexer.NextToken();
                    m.Add(Modifier.Override, this.t.Location);
                    return;

                case 0x5f:
                    base.lexer.NextToken();
                    m.Add(Modifier.Private, this.t.Location);
                    return;

                case 0x60:
                    base.lexer.NextToken();
                    m.Add(Modifier.Protected, this.t.Location);
                    return;

                case 0x61:
                    base.lexer.NextToken();
                    m.Add(Modifier.Public, this.t.Location);
                    return;

                case 0x62:
                    base.lexer.NextToken();
                    m.Add(Modifier.ReadOnly, this.t.Location);
                    return;

                case 0x53:
                    base.lexer.NextToken();
                    m.Add(Modifier.Internal, this.t.Location);
                    return;

                case 0x30:
                    base.lexer.NextToken();
                    m.Add(Modifier.Dim, this.t.Location);
                    return;

                case 70:
                    base.lexer.NextToken();
                    m.Add(Modifier.Extern, this.t.Location);
                    return;

                case 0x66:
                    base.lexer.NextToken();
                    m.Add(Modifier.Sealed, this.t.Location);
                    return;

                case 0x6a:
                    base.lexer.NextToken();
                    m.Add(Modifier.Static, this.t.Location);
                    return;

                case 0x79:
                    base.lexer.NextToken();
                    m.Add(Modifier.Virtual, this.t.Location);
                    return;

                case 0x7b:
                    base.lexer.NextToken();
                    m.Add(Modifier.Volatile, this.t.Location);
                    return;

                case 0x76:
                    base.lexer.NextToken();
                    m.Add(Modifier.Unsafe, this.t.Location);
                    return;
            }
            base.SynErr(0x89);
        }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:76,代码来源:Parser.cs

示例7: ParseMods

 private Modifiers ParseMods()
 {
     var mods = new Modifiers();
     while (HasCurrent)
     {
         switch (Current.type)
         {
             case PUB: case PRIV: case EXTERN: case INTERN:
                 var mod = Current;
                 Advance();
                 Spanned<string> optArg = null;
                 if (Check(STR))
                 {
                     optArg = Current.Image.Spanned(Current.span);
                     Advance();
                 }
                 mods.Add(mod, optArg);
                 break;
             default: return mods;
         }
     }
     return mods;
 }
开发者ID:YourLocalFax,项目名称:OLD-Score,代码行数:23,代码来源:Parser.cs


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