• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Mib.Lexer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Lexer类属于Lextm.SharpSnmpLib.Mib命名空间,在下文中一共展示了Lexer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ObjectType

 public ObjectType(string module, IList<Symbol> header, Lexer lexer)
 {
     _module = module;
     _name = header[0].ToString();
     _properties = ParseProperties(header);
     lexer.ParseOidValue(out _parent, out _value);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:7,代码来源:ObjectType.cs


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


示例3: TestParse3

 public void TestParse3()
 {
     const string test = "::=BEGIN";
     Lexer lexer = new Lexer();
     StringReader reader = new StringReader(test);
     lexer.Parse(reader);
     Assert.AreEqual("::=", lexer.NextSymbol.ToString());
     Assert.AreEqual("BEGIN", lexer.NextSymbol.ToString());
 }       
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:9,代码来源:TestLexer.cs


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


示例5: ObjectIdentity

 /// <summary>
 /// Creates a <see cref="ObjectIdentity"/>.
 /// </summary>
 /// <param name="module">Module name</param>
 /// <param name="header">Header</param>
 /// <param name="lexer">Lexer</param>
 public ObjectIdentity(string module, IList<Symbol> header, Lexer lexer)
 {
     _module = module;
     _name = header[0].ToString();
     lexer.ParseOidValue(out _parent, out _value);
     if (_parent == "0")
     {
         _parent = "ccitt";
     }
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:16,代码来源:ObjectIdentity.cs


示例6: TestMethod

 public void TestMethod()
 {
     Lexer lexer = new Lexer();
     lexer.Parse(new StringReader("{ iso org(3) dod(6) 1 }"));
     string parent;
     uint value;
     lexer.ParseOidValue(out parent, out value);
     Assert.AreEqual("iso.org(3).dod(6)", parent);
     Assert.AreEqual(1, value);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:10,代码来源:TestConstructHelper.cs


示例7: Macro

 public Macro(string module, IList<Symbol> header, Lexer lexer)
 {
     Symbol temp;
     while ((temp = lexer.NextSymbol) != Symbol.Begin)
     {                
     }
     
     while ((temp = lexer.NextSymbol) != Symbol.End)
     {
     }
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:11,代码来源:Macro.cs


示例8: MibDocument

        /// <summary>
        /// Initializes a new instance of the <see cref="MibDocument"/> class.
        /// </summary>
        /// <param name="lexer">The lexer.</param>
        public MibDocument(Lexer lexer)
        {
            ISymbolEnumerator symbols = lexer.GetEnumerator();

            Symbol current;
            while ((current = symbols.NextNonEOLSymbol()) != null)
            {
                symbols.PutBack(current);
                _modules.Add(new MibModule(symbols));                
            }
        }
开发者ID:plocklsh,项目名称:lwip,代码行数:15,代码来源:MibDocument.cs


示例9: TestParse

 public void TestParse()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.SNMPv2_SMI);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     Assert.AreEqual(909, lexer.SymbolCount);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:11,代码来源:TestLexer.cs


示例10: TestMethod1

        public void TestMethod1()
        {
            Lexer lexer = new Lexer();
            lexer.Parse(new StringReader("{ iso(1) std(0) iso8802(8802) ieee802dot1(1)" + Environment.NewLine +
"     ieee802dot1mibs(1) 1 }"));
            string parent;
            uint value;
            lexer.ParseOidValue(out parent, out value);
            Assert.AreEqual("iso(1).std(0).iso8802(8802).ieee802dot1(1).ieee802dot1mibs(1)", parent);
            Assert.AreEqual(1, value);
        }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:11,代码来源:TestConstructHelper.cs


示例11: TestException

        public void TestException()
        {
            Lexer lexer = new Lexer();
            MemoryStream m = new MemoryStream(Resources.fivevarbinds);
            using (StreamReader reader = new StreamReader(m))
            {
                lexer.Parse("temp.txt", reader);
                reader.Close();
            }

            new MibDocument(lexer);
        }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:12,代码来源:TestMibDocument.cs


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


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


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


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


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


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


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


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Security.UserRegistry类代码示例发布时间:2022-05-26
下一篇:
C# Lexer.Lexer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap