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


C# Lexer.GetNextNonEOLSymbol方法代码示例

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


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

示例1: MibModule

        public MibModule(string name, Lexer lexer)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            
            if (lexer == null)
            {
                throw new ArgumentNullException("lexer");
            }
            
            _name = name.ToUpperInvariant(); // all module name are uppercase.
            Symbol temp = lexer.GetNextNonEOLSymbol();
            temp.Expect(Symbol.Definitions);
            temp = lexer.GetNextNonEOLSymbol();
            temp.Expect(Symbol.Assign);
            temp = lexer.GetNextSymbol();
            temp.Expect(Symbol.Begin);
            temp = lexer.GetNextNonEOLSymbol();
            if (temp == Symbol.Imports)
            {
                _imports = ParseDependents(lexer);
            }
            else if (temp == Symbol.Exports)
            {
                _exports = ParseExports(lexer);
            }
            else if (temp == Symbol.End)
            {
                return;
            }

            ParseEntities(_tokens, temp, _name, lexer);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:35,代码来源:MibModule.cs

示例2: IntegerType

        public IntegerType(string module, string name, Lexer lexer)
        {
            _name = name;

            Symbol temp = lexer.CheckNextNonEOLSymbol();
            if (temp == Symbol.OpenBracket)
            {
                lexer.GetNextNonEOLSymbol();
                _isEnumeration = true;
                _map = DecodeEnumerations(lexer);
            }
            else if (temp == Symbol.OpenParentheses)
            {
                lexer.GetNextNonEOLSymbol();
                _isEnumeration = false;
                _ranges = DecodeRanges(lexer);
            }
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:18,代码来源:IntegerType.cs

示例3: MibDocument

 /// <summary>
 /// Creates a <see cref="MibDocument"/> instance.
 /// </summary>
 /// <param name="lexer"></param>
 public MibDocument(Lexer lexer)
 {
     Symbol temp;
     while ((temp = lexer.GetNextNonEOLSymbol()) != null)
     {
         temp.ValidateIdentifier();
         _modules.Add(new MibModule(temp.ToString(), lexer));                
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:13,代码来源:MibDocument.cs

示例4: Sequence

 public Sequence(string module, string name, Lexer lexer)
 {
     _name = name;
     // parse between ( )
     Symbol temp = lexer.GetNextNonEOLSymbol(); 
     int bracketSection = 0;
     temp.Expect(Symbol.OpenBracket);
     bracketSection++;
     while (bracketSection > 0)
     {
         temp = lexer.GetNextNonEOLSymbol();
         if (temp == Symbol.OpenBracket)
         {
             bracketSection++;
         }
         else if (temp == Symbol.CloseBracket)
         {
             bracketSection--;
         }
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:21,代码来源:Sequence.cs

示例5: UnsignedType

        public UnsignedType(string module, string name, Lexer lexer)
        {
            _module = module;
            _name = name;

            Symbol temp = lexer.CheckNextNonEOLSymbol();
            if (temp == Symbol.OpenParentheses)
            {
                lexer.GetNextNonEOLSymbol();
                _ranges = DecodeRanges(lexer);
            }
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:UnsignedType.cs

示例6: ParseOthers

        private static IConstruct ParseOthers(string module, IList<Symbol> header, Lexer lexer)
        {
            Symbol current = lexer.GetNextNonEOLSymbol();
            
            if (current == Symbol.Sequence)
            {
                return new Sequence(module, header[0].ToString(), lexer);
            }

            if (current == Symbol.Choice)
            {
                return new Choice(module, header[0].ToString(), lexer);
            }

            if (current == Symbol.Integer)
            {
                return new IntegerType(module, header[0].ToString(), lexer);
            }

            if (current == Symbol.TextualConvention)
            {
                return new TextualConvention(module, header[0].ToString(), lexer);
            }

            return new TypeAssignment(module, header[0].ToString(), current, lexer);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:26,代码来源:MibModule.cs

示例7: TextualConvention

        public TextualConvention(string module, string name, Lexer lexer)
        {
            _name = name;

            Symbol temp = lexer.GetNextNonEOLSymbol();

            if (temp == Symbol.DisplayHint)
            {
                // TODO: this needs decoding to a useful format.
                _displayHint = new DisplayHint(lexer.GetNextNonEOLSymbol().ToString().Trim(new[] { '"' }));
                temp = lexer.GetNextNonEOLSymbol();
            }

            temp.Expect(Symbol.Status);
            try
            {
                _status = StatusHelper.CreateStatus(lexer.GetNextNonEOLSymbol().ToString());
                temp = lexer.GetNextNonEOLSymbol();
            }
            catch (ArgumentException)
            {
                temp.Throw("Invalid status");
            }

            temp.Expect(Symbol.Description);
            _description = lexer.GetNextNonEOLSymbol().ToString().Trim(new[] { '"' });
            temp = lexer.GetNextNonEOLSymbol();

            if (temp == Symbol.Reference)
            {
                _reference = lexer.GetNextNonEOLSymbol().ToString();
                temp = lexer.GetNextNonEOLSymbol();
            }

            temp.Expect(Symbol.Syntax);

            /* 
             * RFC2579 definition:
             *       Syntax ::=   -- Must be one of the following:
             *                    -- a base type (or its refinement), or
             *                    -- a BITS pseudo-type
             *               type
             *             | "BITS" "{" NamedBits "}"
             *
             * From section 3.5:
             *      The data structure must be one of the alternatives defined
             *      in the ObjectSyntax CHOICE or the BITS construct.  Note
             *      that this means that the SYNTAX clause of a Textual
             *      Convention can not refer to a previously defined Textual
             *      Convention.
             *      
             *      The SYNTAX clause of a TEXTUAL CONVENTION macro may be
             *      sub-typed in the same way as the SYNTAX clause of an
             *      OBJECT-TYPE macro.
             * 
             * Therefore the possible values are (grouped by underlying type):
             *      INTEGER, Integer32
             *      OCTET STRING, Opaque
             *      OBJECT IDENTIFIER
             *      IpAddress
             *      Counter64
             *      Unsigned32, Counter32, Gauge32, TimeTicks
             *      BITS
             * With appropriate sub-typing.
             */

            temp = lexer.GetNextNonEOLSymbol();
            if (temp == Symbol.Bits)
            {
                _syntax = new BitsType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Integer || temp == Symbol.Integer32)
            {
                _syntax = new IntegerType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Octet)
            {
                temp = lexer.GetNextSymbol();
                temp.Expect(Symbol.String);
                _syntax = new OctetStringType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Opaque)
            {
                _syntax = new OctetStringType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.IpAddress)
            {
                _syntax = new IpAddressType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Counter64)
            {
                _syntax = new Counter64Type(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Unsigned32 || temp == Symbol.Counter32 || temp == Symbol.Gauge32 || temp == Symbol.TimeTicks)
            {
                _syntax = new UnsignedType(module, string.Empty, lexer);
            }
            else if (temp == Symbol.Object)
            {
                temp = lexer.GetNextSymbol();
//.........这里部分代码省略.........
开发者ID:xxjeng,项目名称:nuxleus,代码行数:101,代码来源:TextualConvention.cs


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