net.percederberg.mib.asn1.parser
Class AsnParser
java.lang.Object
|
+--net.percederberg.mib.asn1.parser.AsnParser
- All Implemented Interfaces:
- AsnParserConstants
- public class AsnParser
- extends java.lang.Object
- implements AsnParserConstants
An ASN.1 parser class. The parser is generated to be static, and only
the method parse() should be called, which returns the parse tree.
The grammar used is derived in part from the yacc and lex sources
of 'snacc' - a GNU ASN.1 to C or C++ compiler. Other parts of the
grammar comes from RFC 1155, 1212, and 1215 in order to be able to
correctly parse Internet MIBs.
The parser was originally written by Helena Sarin (hsarin@lucent.com).
Modifications have been made by Per Cederberg (per@percederberg.net).
The changes includes removing parts of the constraint mechanism,
fixing some inefficient rules, and adding new productions for parsing
Internet MIBs. Some unnecessary productions have been removed and
others have been brought closer to the original 'snacc' grammar.
Tokens and productions have also been reordered and renamed.
- Author:
- Helena Sarin, hsarin@lucent.com, Per Cederberg, per@percederberg.net
Fields inherited from interface net.percederberg.mib.asn1.parser.AsnParserConstants |
COMMENT, DEFAULT, EOF, TABSENT, TACCESS, TANY, TAPPLICATION, TASSIGN, TBAR, TBEGIN, TBINSTRING, TBIT, TBOOLEAN, TBY, TCHOICE, TCOMMA, TCOMPONENT, TCOMPONENTS, TCSTRING, TDEFAULT, TDEFINED, TDEFINITIONS, TDEFVAL, TDESCRIPTION, TDOT, TEND, TENTERPRISE, TENUMERATED, TEXPLICIT, TEXPORTS, TFALSE, TFROM, THEXSTRING, TIDENTIFIER, TIMPLICIT, TIMPORTS, TINCLUDES, TINDEX, TINTEGER, TLCASEFIRST_IDENT, TLEFTBRACE, TLEFTBRACKET, TLEFTPAREN, TLESSTHAN, TMACRO, TMAX, TMIN, TMINUS, TMINUS_INFINITY, TNULL, TNUMBER, TOBJECT, TOBJECT_TYPE, TOCTET, TOF, tokenImage, TOPTIONAL, TPLUS_INFINITY, TPRESENT, TPRIVATE, TREAL, TREFERENCE, TRIGHTBRACE, TRIGHTBRACKET, TRIGHTPAREN, TSEMI_COLON, TSEQUENCE, TSET, TSIZE, TSTATUS, TSTRING, TSYNTAX, TTAGS, TTRAP_TYPE, TTRUE, TUCASEFIRST_IDENT, TUNIVERSAL, TVARIABLES, TWITH |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
token_source
public static AsnParserTokenManager token_source
token
public static Token token
jj_nt
public static Token jj_nt
lookingAhead
public static boolean lookingAhead
AsnParser
public AsnParser(java.io.InputStream stream)
AsnParser
public AsnParser(java.io.Reader stream)
AsnParser
public AsnParser(AsnParserTokenManager tm)
parse
public static Node parse(java.io.InputStream in)
throws ParseException
- Parses an input stream and returns a ParseTree object.
This method can be called any number of times, as it
automatically reinitializes the parser.
- Parameters:
in
- an input character stream- Returns:
- the top node of the parse tree
parse
public static Node parse(java.io.Reader in)
throws ParseException
- Parses an input stream and returns a ParseTree object.
This method can be called any number of times, as it
automatically reinitializes the parser.
- Parameters:
in
- an input stream reader- Returns:
- the top node of the parse tree
Start
public static final void Start()
throws ParseException
ModuleDefinition
public static final void ModuleDefinition()
throws ParseException
TagDefault
public static final void TagDefault()
throws ParseException
ModuleIdentifier
public static final void ModuleIdentifier()
throws ParseException
ModuleBody
public static final void ModuleBody()
throws ParseException
Exports
public static final void Exports()
throws ParseException
Imports
public static final void Imports()
throws ParseException
SymbolsFromModuleList
public static final void SymbolsFromModuleList()
throws ParseException
SymbolsFromModule
public static final void SymbolsFromModule()
throws ParseException
SymbolList
public static final void SymbolList()
throws ParseException
Symbol
public static final void Symbol()
throws ParseException
AssignmentList
public static final void AssignmentList()
throws ParseException
Assignment
public static final void Assignment()
throws ParseException
MacroDefinition
public static final void MacroDefinition()
throws ParseException
MacroBody
public static final void MacroBody()
throws ParseException
MacroReference
public static final void MacroReference()
throws ParseException
TypeAssignment
public static final void TypeAssignment()
throws ParseException
Type
public static final void Type()
throws ParseException
BuiltinType
public static final void BuiltinType()
throws ParseException
IntegerType
public static final void IntegerType()
throws ParseException
NamedNumberList
public static final void NamedNumberList()
throws ParseException
NamedNumber
public static final void NamedNumber()
throws ParseException
SignedNumber
public static final void SignedNumber()
throws ParseException
StringType
public static final void StringType()
throws ParseException
BitStringType
public static final void BitStringType()
throws ParseException
SequenceType
public static final void SequenceType()
throws ParseException
SequenceOfType
public static final void SequenceOfType()
throws ParseException
SetType
public static final void SetType()
throws ParseException
SetOfType
public static final void SetOfType()
throws ParseException
ElementTypeList
public static final void ElementTypeList()
throws ParseException
ElementType
public static final void ElementType()
throws ParseException
NamedType
public static final void NamedType()
throws ParseException
ChoiceType
public static final void ChoiceType()
throws ParseException
EnumeratedType
public static final void EnumeratedType()
throws ParseException
SelectionType
public static final void SelectionType()
throws ParseException
TaggedType
public static final void TaggedType()
throws ParseException
Tag
public static final void Tag()
throws ParseException
ClassNumber
public static final void ClassNumber()
throws ParseException
Class
public static final void Class()
throws ParseException
AnyType
public static final void AnyType()
throws ParseException
DefinedType
public static final void DefinedType()
throws ParseException
ConstraintList
public static final void ConstraintList()
throws ParseException
Constraint
public static final void Constraint()
throws ParseException
ValueConstraint
public static final void ValueConstraint()
throws ParseException
ValueRange
public static final void ValueRange()
throws ParseException
LowerEndPoint
public static final void LowerEndPoint()
throws ParseException
UpperEndPoint
public static final void UpperEndPoint()
throws ParseException
SizeConstraint
public static final void SizeConstraint()
throws ParseException
AlphabetConstraint
public static final void AlphabetConstraint()
throws ParseException
ValueAssignment
public static final void ValueAssignment()
throws ParseException
Value
public static final void Value()
throws ParseException
DefinedValue
public static final void DefinedValue()
throws ParseException
BuiltinValue
public static final void BuiltinValue()
throws ParseException
BooleanValue
public static final void BooleanValue()
throws ParseException
SpecialRealValue
public static final void SpecialRealValue()
throws ParseException
NullValue
public static final void NullValue()
throws ParseException
NamedValue
public static final void NamedValue()
throws ParseException
ObjectIdentifierValue
public static final void ObjectIdentifierValue()
throws ParseException
ObjIdComponentList
public static final void ObjIdComponentList()
throws ParseException
ObjIdComponent
public static final void ObjIdComponent()
throws ParseException
NameAndNumberForm
public static final void NameAndNumberForm()
throws ParseException
BinaryString
public static final void BinaryString()
throws ParseException
HexString
public static final void HexString()
throws ParseException
CharString
public static final void CharString()
throws ParseException
Number
public static final void Number()
throws ParseException
Identifier
public static final void Identifier()
throws ParseException
ModuleReference
public static final void ModuleReference()
throws ParseException
TypeReference
public static final void TypeReference()
throws ParseException
DefinedMacroType
public static final void DefinedMacroType()
throws ParseException
DefinedMacroName
public static final void DefinedMacroName()
throws ParseException
SnmpObjectTypeMacroType
public static final void SnmpObjectTypeMacroType()
throws ParseException
SnmpTrapTypeMacroType
public static final void SnmpTrapTypeMacroType()
throws ParseException
SnmpAccessPart
public static final void SnmpAccessPart()
throws ParseException
SnmpStatusPart
public static final void SnmpStatusPart()
throws ParseException
SnmpDescrPart
public static final void SnmpDescrPart()
throws ParseException
SnmpReferPart
public static final void SnmpReferPart()
throws ParseException
SnmpIndexPart
public static final void SnmpIndexPart()
throws ParseException
TypeOrValueList
public static final void TypeOrValueList()
throws ParseException
TypeOrValue
public static final void TypeOrValue()
throws ParseException
SnmpDefValPart
public static final void SnmpDefValPart()
throws ParseException
SnmpVarPart
public static final void SnmpVarPart()
throws ParseException
VarTypes
public static final void VarTypes()
throws ParseException
ReInit
public static void ReInit(java.io.InputStream stream)
ReInit
public static void ReInit(java.io.Reader stream)
ReInit
public void ReInit(AsnParserTokenManager tm)
getNextToken
public static final Token getNextToken()
getToken
public static final Token getToken(int index)
generateParseException
public static final ParseException generateParseException()
enable_tracing
public static final void enable_tracing()
disable_tracing
public static final void disable_tracing()