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


C# Lexer.GetNextSymbol方法代码示例

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


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

示例1: Test

        public void Test()
        {
            const string test = "SomeIp ::= IpAddress";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.IpAddress);

            IpAddressType i = new IpAddressType("module", "name", lexer);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:TestIpAddressType.cs

示例2: TestOverlappingRanges3

        public void TestOverlappingRanges3()
        {
            const string test = "SomeEnum ::= INTEGER (8 | 8 | 31 .. 60 )";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Integer);

            Assert.Throws<MibException>(() => new IntegerType("module", "name", lexer));
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:12,代码来源:TestIntegerType.cs

示例3: Macro

 public Macro(string module, IList<Symbol> header, Lexer lexer)
 {
     _name = header[0].ToString();
     Symbol temp;
     while ((temp = lexer.GetNextSymbol()) != Symbol.Begin)
     {                
     }
     
     while ((temp = lexer.GetNextSymbol()) != Symbol.End)
     {
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:Macro.cs

示例4: TestEnumerable

        public void TestEnumerable()
        {
            const string test = "SomeEnum ::= Counter64";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Counter64);

            Counter64Type i = new Counter64Type("module", "name", lexer);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:TestCounter64Type.cs

示例5: TestNegative

        public void TestNegative()
        {
            const string test = "SomeEnum ::= OCTET STRING ( SIZE (8 | -5 .. 20 | 31 .. 60 ))";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Octet);
            lexer.GetNextSymbol().Expect(Symbol.String);

            Assert.Throws<MibException>(delegate { new OctetStringType("module", "name", lexer); });
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:13,代码来源:TestOctetStringType.cs

示例6: Test

        public void Test()
        {
            const string test = "SomeEnum ::= BITS {first(1), second(2)}";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Bits);

            BitsType i = new BitsType("module", "name", lexer);
            Assert.AreEqual("first(1)", i[1]);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:13,代码来源:TestBitsType.cs

示例7: TestEnumerable

        public void TestEnumerable()
        {
            const string test = "SomeEnum ::= INTEGER {first(1), second(2)}";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Integer);

            IntegerType i = new IntegerType("module", "name", lexer);
            Assert.IsTrue(i.IsEnumeration);
            Assert.AreEqual("first(1)", i[1]);
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:14,代码来源:TestIntegerType.cs

示例8: 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

示例9: TrapType

 public TrapType(string module, IList<Symbol> header, Lexer lexer)
 {
     _module = module;
     _name = header[0].ToString();
     Symbol temp;
     while ((temp = lexer.GetNextSymbol()) == Symbol.EOL)
     {
     }
     
     bool succeeded = int.TryParse(temp.ToString(), out _value);
     temp.Assert(succeeded, "not a decimal");
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:TrapType.cs

示例10: ImportsFrom

 public ImportsFrom(Symbol last, Lexer lexer)
 {
     Symbol previous = last;
     Symbol temp;
     while ((temp = lexer.GetNextSymbol()) != Symbol.From)
     {
         if (temp == Symbol.EOL) 
         {
             continue;
         }
         
         if (temp == Symbol.Comma)
         {
             previous.ValidateIdentifier();
             _types.Add(previous.ToString());
         }
         
         previous = temp;
     }
     
     _module = lexer.GetNextSymbol().ToString().ToUpperInvariant(); // module names are uppercase
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:22,代码来源:ImportsFrom.cs

示例11: Imports

 /// <summary>
 /// Creates an <see cref="Imports"/> instance.
 /// </summary>
 /// <param name="lexer"></param>
 public Imports(Lexer lexer)
 {
     Symbol temp;
     while ((temp = lexer.GetNextSymbol()) != Symbol.Semicolon)
     {
         if (temp == Symbol.EOL)
         {
             continue;
         }
         
         _dependents.Add(new ImportsFrom(temp, lexer).Module);
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:17,代码来源:Imports.cs

示例12: TestRanges

        public void TestRanges()
        {
            const string test = "SomeEnum ::= INTEGER (8 |10 ..20| 31..60 )";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Integer);

            IntegerType i = new IntegerType("module", "name", lexer);
            Assert.IsFalse(i.IsEnumeration);
            Assert.IsTrue(i.Contains(8));
            Assert.IsTrue(i.Contains(10));
            Assert.IsTrue(i.Contains(15));
            Assert.IsTrue(i.Contains(20));
            Assert.IsTrue(i.Contains(35));
            Assert.IsFalse(i.Contains(4));
            Assert.IsFalse(i.Contains(-9));
            Assert.IsFalse(i.Contains(25));
            Assert.IsFalse(i.Contains(61));
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:22,代码来源:TestIntegerType.cs

示例13: OctetStringType

        public OctetStringType(string module, string name, Lexer lexer)
        {
            _module = module;
            _name = name;
            _size = new List<ValueRange>();

            Symbol temp = lexer.GetNextSymbol();
            if (temp == Symbol.OpenParentheses)
            {
                _size = DecodeRanges(lexer);
            }

        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:13,代码来源:OctetStringType.cs

示例14: TestRanges

        public void TestRanges()
        {
            const string test = "SomeEnum ::= OCTET STRING ( SIZE (5 | 8 .. 20 | 31 .. 60 ))";
            Lexer lexer = new Lexer();
            StringReader reader = new StringReader(test);
            lexer.Parse(reader);
            string name = lexer.GetNextSymbol().ToString();
            lexer.GetNextSymbol().Expect(Symbol.Assign);
            lexer.GetNextSymbol().Expect(Symbol.Octet);
            lexer.GetNextSymbol().Expect(Symbol.String);

            OctetStringType i = new OctetStringType("module", "name", lexer);
            Assert.IsTrue(i.Contains(8));
            Assert.IsTrue(i.Contains(5));
            Assert.IsTrue(i.Contains(15));
            Assert.IsTrue(i.Contains(20));
            Assert.IsTrue(i.Contains(35));
            Assert.IsFalse(i.Contains(4));
            Assert.IsFalse(i.Contains(-9));
            Assert.IsFalse(i.Contains(25));
            Assert.IsFalse(i.Contains(61));
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:22,代码来源:TestOctetStringType.cs

示例15: Exports

 public Exports(Lexer lexer)
 {
     Symbol previous = null;
     Symbol temp;
     while ((temp = lexer.GetNextSymbol()) != Symbol.Semicolon) 
     {
         if (temp == Symbol.EOL) 
         {
             continue;
         }
         
         if (temp == Symbol.Comma && previous != null) 
         {
             previous.ValidateIdentifier();
             _types.Add(previous.ToString());
         }
         
         previous = temp;
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:20,代码来源:Exports.cs


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