11 using System.Collections.Generic;
16 namespace Lextm.SharpSnmpLib.Mib
21 [
System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId =
"Mib")]
24 private readonly
string _name;
25 private readonly
Imports _imports;
26 private readonly
Exports _exports;
27 private readonly List<IElement> _tokens =
new List<IElement>();
34 [
System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId =
"lexer")]
39 throw new ArgumentNullException(
"lexer");
42 Symbol temp = symbols.NextNonEOLSymbol();
43 temp.AssertIsValidIdentifier();
44 _name = temp.
ToString().ToUpperInvariant();
46 temp = symbols.NextNonEOLSymbol();
49 temp = symbols.NextNonEOLSymbol();
52 temp = symbols.NextSymbol();
55 temp = symbols.NextNonEOLSymbol();
58 _imports = ParseDependents(symbols);
62 _exports = ParseExports(symbols);
69 ParseEntities(symbols);
84 get {
return _exports; }
89 get {
return _imports; }
92 public List<IElement> Tokens
94 get {
return this._tokens; }
100 public IList<IDeclaration> Declarations
104 IList<IDeclaration> result =
new List<IDeclaration>();
121 public IList<IEntity> Entities
125 IList<IEntity> result =
new List<IEntity>();
139 public IList<ITypeAssignment> Types
143 IList<ITypeAssignment> result =
new List<ITypeAssignment>();
159 #region Parsing of Symbols 163 return new Exports(
this, symbols);
168 return new Imports(
this, symbols);
173 Symbol temp = symbols.NextNonEOLSymbol();
180 ParseEntity(buffer, symbols);
183 temp = symbols.NextNonEOLSymbol();
188 temp = symbols.NextSymbol();
195 if ((preAssignSymbols == null) || (preAssignSymbols.Count == 0))
197 Symbol s = symbols.NextSymbol();
200 s.Assert(
false,
"Invalid Entitiy declaration");
209 preAssignSymbols[0].AssertIsValidIdentifier();
211 if (preAssignSymbols.Count == 1)
214 _tokens.Add(
Lexer.
ParseBasicTypeDef(
this, preAssignSymbols[0].ToString(), symbols, isMacroSyntax:
false));
219 preAssignSymbolsEnumerator.NextNonEOLSymbol();
220 Symbol type = preAssignSymbolsEnumerator.NextNonEOLSymbol();
225 Symbol next = preAssignSymbolsEnumerator.NextNonEOLSymbol();
232 else if (next != null)
234 preAssignSymbolsEnumerator.
PutBack(next);
244 _tokens.Add(
new ObjectType(
this, preAssignSymbols, symbols));
249 _tokens.Add(
new ObjectGroup(
this, preAssignSymbols, symbols));
274 _tokens.Add(
new Macro(
this, preAssignSymbols, symbols));
279 _tokens.Add(
new TrapType(
this, preAssignSymbols, symbols));
288 preAssignSymbols[1].Assert(
false,
"Unknown/Invalid declaration");
Description of NotificationGroupNode.
static readonly Symbol ModuleIdentity
static readonly Symbol Imports
static readonly Symbol ModuleCompliance
ISymbolEnumerator GetSymbolEnumerator()
static readonly Symbol Object
bool PutBack(Symbol item)
Description of MibException.
static readonly Symbol Definitions
The AGENT-CAPABILITIES construct is used to specify implementation characteristics of an SNMP agent s...
static readonly Symbol NotificationType
static readonly Symbol ObjectIdentity
MibModule(ISymbolEnumerator symbols)
Creates a MibModule with a specific Lexer.
static readonly Symbol ObjectType
static readonly Symbol Exports
Description of ObjectGroupNode.
static readonly Symbol Identifier
static readonly Symbol End
static readonly Symbol Macro
Lexer class that parses MIB files into symbol list.
static readonly Symbol AgentCapabilities
The IMPORTS construct is used to specify items used in the current MIB module which are defined in an...
static readonly Symbol ObjectGroup
static readonly Symbol Assign
static readonly Symbol NotificationGroup
Basic interface for all elements building up the MIB tree, thus having an OID as value.
static readonly Symbol TrapType
static ITypeAssignment ParseBasicTypeDef(IModule module, string name, ISymbolEnumerator symbols, bool isMacroSyntax=false)
Description of ModuleComplianceNode.
override string ToString()
Returns a String that represents this Symbol.
static readonly Symbol Begin