#[repr(u8)]pub enum TokenKind {
Show 107 variants
Error = 0,
Eof = 1,
ForbiddenKeyword = 2,
Comment = 3,
UppercaseIdent = 4,
LowercaseIdent = 5,
Number = 6,
NegativeNumber = 7,
QuotedString = 8,
HexString = 9,
BinString = 10,
LBracket = 11,
RBracket = 12,
LBrace = 13,
RBrace = 14,
LParen = 15,
RParen = 16,
Colon = 17,
Semicolon = 18,
Comma = 19,
Dot = 20,
Pipe = 21,
Minus = 22,
DotDot = 23,
ColonColonEqual = 24,
KwDefinitions = 25,
KwBegin = 26,
KwEnd = 27,
KwImports = 28,
KwExports = 29,
KwFrom = 30,
KwObject = 31,
KwIdentifier = 32,
KwSequence = 33,
KwOf = 34,
KwChoice = 35,
KwMacro = 36,
KwSyntax = 37,
KwMaxAccess = 38,
KwMinAccess = 39,
KwAccess = 40,
KwStatus = 41,
KwDescription = 42,
KwReference = 43,
KwIndex = 44,
KwDefval = 45,
KwAugments = 46,
KwUnits = 47,
KwDisplayHint = 48,
KwObjects = 49,
KwNotifications = 50,
KwModule = 51,
KwMandatoryGroups = 52,
KwGroup = 53,
KwWriteSyntax = 54,
KwProductRelease = 55,
KwSupports = 56,
KwIncludes = 57,
KwVariation = 58,
KwCreationRequires = 59,
KwRevision = 60,
KwLastUpdated = 61,
KwOrganization = 62,
KwContactInfo = 63,
KwImplied = 64,
KwSize = 65,
KwEnterprise = 66,
KwVariables = 67,
KwModuleIdentity = 68,
KwModuleCompliance = 69,
KwObjectGroup = 70,
KwNotificationGroup = 71,
KwAgentCapabilities = 72,
KwObjectType = 73,
KwObjectIdentity = 74,
KwNotificationType = 75,
KwTextualConvention = 76,
KwTrapType = 77,
KwInteger = 78,
KwUnsigned32 = 79,
KwCounter32 = 80,
KwCounter64 = 81,
KwGauge32 = 82,
KwIpAddress = 83,
KwOpaque = 84,
KwTimeTicks = 85,
KwBits = 86,
KwOctet = 87,
KwString = 88,
KwCounter = 89,
KwGauge = 90,
KwNetworkAddress = 91,
KwApplication = 92,
KwImplicit = 93,
KwUniversal = 94,
KwCurrent = 95,
KwDeprecated = 96,
KwObsolete = 97,
KwMandatory = 98,
KwOptional = 99,
KwReadOnly = 100,
KwReadWrite = 101,
KwReadCreate = 102,
KwWriteOnly = 103,
KwNotAccessible = 104,
KwAccessibleForNotify = 105,
KwNotImplemented = 106,
}Expand description
Classification of a Token.
Variants are grouped into special tokens, identifiers, literals, punctuation, and several keyword categories (structural, clause, macro, type, tag, status/access).
Variants§
Error = 0
Unrecognized or malformed input.
Eof = 1
End of input. Always the last token in a stream.
ForbiddenKeyword = 2
A reserved ASN.1 keyword (e.g. TRUE, FALSE, NULL) that must
not appear as an identifier in MIB files.
Comment = 3
An ---delimited comment.
UppercaseIdent = 4
An identifier starting with an uppercase letter (type or module name).
LowercaseIdent = 5
An identifier starting with a lowercase letter (value reference).
Number = 6
A non-negative decimal integer, e.g. 42.
NegativeNumber = 7
A negative decimal integer, e.g. -1.
QuotedString = 8
A double-quoted string literal, e.g. "hello".
HexString = 9
A hex string literal, e.g. '0A1B'H.
BinString = 10
A binary string literal, e.g. '01010101'B.
LBracket = 11
[
RBracket = 12
]
LBrace = 13
{
RBrace = 14
}
LParen = 15
(
RParen = 16
)
Colon = 17
:
Semicolon = 18
;
Comma = 19
,
Dot = 20
.
Pipe = 21
|
Minus = 22
- (standalone, not part of a negative number)
DotDot = 23
.. (range separator in SIZE/value constraints)
ColonColonEqual = 24
::= (assignment operator)
KwDefinitions = 25
DEFINITIONS
KwBegin = 26
BEGIN
KwEnd = 27
END
KwImports = 28
IMPORTS
KwExports = 29
EXPORTS - triggers body-skipping in the lexer.
KwFrom = 30
FROM
KwObject = 31
OBJECT
KwIdentifier = 32
IDENTIFIER
KwSequence = 33
SEQUENCE
KwOf = 34
OF
KwChoice = 35
CHOICE
KwMacro = 36
MACRO - triggers body-skipping in the lexer.
KwSyntax = 37
SYNTAX
KwMaxAccess = 38
MAX-ACCESS
KwMinAccess = 39
MIN-ACCESS
KwAccess = 40
ACCESS (SMIv1)
KwStatus = 41
STATUS
KwDescription = 42
DESCRIPTION
KwReference = 43
REFERENCE
KwIndex = 44
INDEX
KwDefval = 45
DEFVAL
KwAugments = 46
AUGMENTS
KwUnits = 47
UNITS
KwDisplayHint = 48
DISPLAY-HINT
KwObjects = 49
OBJECTS
KwNotifications = 50
NOTIFICATIONS
KwModule = 51
MODULE
KwMandatoryGroups = 52
MANDATORY-GROUPS
KwGroup = 53
GROUP
KwWriteSyntax = 54
WRITE-SYNTAX
KwProductRelease = 55
PRODUCT-RELEASE
KwSupports = 56
SUPPORTS
KwIncludes = 57
INCLUDES
KwVariation = 58
VARIATION
KwCreationRequires = 59
CREATION-REQUIRES
KwRevision = 60
REVISION
KwLastUpdated = 61
LAST-UPDATED
KwOrganization = 62
ORGANIZATION
KwContactInfo = 63
CONTACT-INFO
KwImplied = 64
IMPLIED
KwSize = 65
SIZE
KwEnterprise = 66
ENTERPRISE (SMIv1 TRAP-TYPE)
KwVariables = 67
VARIABLES (SMIv1 TRAP-TYPE)
KwModuleIdentity = 68
MODULE-IDENTITY (SMIv2)
KwModuleCompliance = 69
MODULE-COMPLIANCE (SMIv2)
KwObjectGroup = 70
OBJECT-GROUP (SMIv2)
KwNotificationGroup = 71
NOTIFICATION-GROUP (SMIv2)
KwAgentCapabilities = 72
AGENT-CAPABILITIES (SMIv2)
KwObjectType = 73
OBJECT-TYPE (SMIv1/v2)
KwObjectIdentity = 74
OBJECT-IDENTITY (SMIv2)
KwNotificationType = 75
NOTIFICATION-TYPE (SMIv2)
KwTextualConvention = 76
TEXTUAL-CONVENTION (SMIv2)
KwTrapType = 77
TRAP-TYPE (SMIv1)
KwInteger = 78
INTEGER or Integer
KwUnsigned32 = 79
Unsigned32
KwCounter32 = 80
Counter32
KwCounter64 = 81
Counter64
KwGauge32 = 82
Gauge32
KwIpAddress = 83
IpAddress
KwOpaque = 84
Opaque
KwTimeTicks = 85
TimeTicks
KwBits = 86
BITS
KwOctet = 87
OCTET (first half of OCTET STRING)
KwString = 88
STRING (second half of OCTET STRING)
KwCounter = 89
Counter (SMIv1 alias for Counter32)
KwGauge = 90
Gauge (SMIv1 alias for Gauge32)
KwNetworkAddress = 91
NetworkAddress (SMIv1)
KwApplication = 92
APPLICATION
KwImplicit = 93
IMPLICIT
KwUniversal = 94
UNIVERSAL
KwCurrent = 95
current
KwDeprecated = 96
deprecated
KwObsolete = 97
obsolete
KwMandatory = 98
mandatory (SMIv1)
KwOptional = 99
optional (SMIv1)
KwReadOnly = 100
read-only
KwReadWrite = 101
read-write
KwReadCreate = 102
read-create
KwWriteOnly = 103
write-only (deprecated)
KwNotAccessible = 104
not-accessible
KwAccessibleForNotify = 105
accessible-for-notify
KwNotImplemented = 106
not-implemented (AGENT-CAPABILITIES)
Implementations§
Source§impl TokenKind
impl TokenKind
Sourcepub fn is_keyword(self) -> bool
pub fn is_keyword(self) -> bool
Returns true if this is any keyword token (structural, clause, macro,
type, tag, or status/access).
Sourcepub fn is_identifier(self) -> bool
pub fn is_identifier(self) -> bool
Returns true for UppercaseIdent or
LowercaseIdent.
Sourcepub fn is_type_keyword(self) -> bool
pub fn is_type_keyword(self) -> bool
Returns true for built-in SMI type keywords (INTEGER, Counter32,
OCTET, STRING, NetworkAddress, etc.).
Sourcepub fn is_macro_keyword(self) -> bool
pub fn is_macro_keyword(self) -> bool
Returns true for SMI macro invocation keywords (MODULE-IDENTITY,
OBJECT-TYPE, TRAP-TYPE, etc.).
Sourcepub fn is_clause_keyword(self) -> bool
pub fn is_clause_keyword(self) -> bool
Returns true for clause keywords used within macro bodies (SYNTAX,
STATUS, DESCRIPTION, INDEX, DEFVAL, etc.).
Sourcepub fn is_tag_keyword(self) -> bool
pub fn is_tag_keyword(self) -> bool
Returns true for ASN.1 tag keywords (APPLICATION, IMPLICIT,
UNIVERSAL).
Sourcepub fn is_status_access_keyword(self) -> bool
pub fn is_status_access_keyword(self) -> bool
Returns true for status or access value keywords (current,
deprecated, read-only, not-accessible, etc.).
Sourcepub fn is_structural_keyword(self) -> bool
pub fn is_structural_keyword(self) -> bool
Returns true for structural keywords that frame the module
(DEFINITIONS, BEGIN, END, IMPORTS, FROM, MACRO, etc.).
Sourcepub fn display_name(self) -> &'static str
pub fn display_name(self) -> &'static str
Returns a human-readable name suitable for use in error messages.
Punctuation tokens are shown as quoted characters (e.g. '{'),
keywords use their libsmi_name, and other
tokens use descriptive labels like "identifier" or "number".
Sourcepub fn libsmi_name(self) -> &'static str
pub fn libsmi_name(self) -> &'static str
Returns the libsmi-compatible uppercase name for this token kind.
These names match the token naming conventions used by the libsmi
library, with hyphens replaced by underscores (e.g. OBJECT_TYPE,
READ_ONLY, COLON_COLON_EQUAL).
Trait Implementations§
impl Copy for TokenKind
impl Eq for TokenKind
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Freeze for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnsafeUnpin for TokenKind
impl UnwindSafe for TokenKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more