net.percederberg.mib.asn1.node
Class Token

java.lang.Object
  |
  +--net.percederberg.mib.asn1.node.Node
        |
        +--net.percederberg.mib.asn1.node.Token
All Implemented Interfaces:
NodeConstants, Switchable

public class Token
extends Node

A class representing tokens.

Version:
1.3
Author:
Per Cederberg, per@percederberg.net

Field Summary
 int beginColumn
          beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.
 int beginLine
          beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.
 int endColumn
          beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.
 int endLine
          beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.
 java.lang.String image
          The string image of the token.
 Token next
          A reference to the next regular (non-special) token from the input stream.
 Token specialToken
          This field is used to access special tokens that occur prior to this token, but after the immediately preceding regular (non-special) token.
 
Fields inherited from class net.percederberg.mib.asn1.node.Node
kind
 
Fields inherited from interface net.percederberg.mib.asn1.node.NodeConstants
ALPHABETCONSTRAINT, ANYTYPE, ASSIGNMENT, ASSIGNMENTLIST, BINARYSTRING, BITSTRINGTYPE, BOOLEANVALUE, BUILTINTYPE, BUILTINVALUE, CHARSTRING, CHOICETYPE, CLASS, CLASSNUMBER, COMPLIANCEGROUP, COMPLIANCEOBJECT, CONSTRAINT, CONSTRAINTLIST, DEFINEDMACRONAME, DEFINEDMACROTYPE, DEFINEDTYPE, DEFINEDVALUE, ELEMENTTYPE, ELEMENTTYPELIST, ENUMERATEDTYPE, EOF, EXPORTS, HEXSTRING, IDENTIFIER, IMPORTS, INTEGERTYPE, LOWERENDPOINT, MACROBODY, MACRODEFINITION, MACROREFERENCE, MODULEBODY, MODULEDEFINITION, MODULEIDENTIFIER, MODULEREFERENCE, NAMEANDNUMBERFORM, NAMEDBIT, NAMEDBITS, NAMEDNUMBER, NAMEDNUMBERLIST, NAMEDTYPE, NAMEDVALUE, NULLVALUE, NUMBER, OBJECTIDENTIFIERVALUE, OBJIDCOMPONENT, OBJIDCOMPONENTLIST, productionNodeName, SELECTIONTYPE, SEQUENCEOFTYPE, SEQUENCETYPE, SETOFTYPE, SETTYPE, SIGNEDNUMBER, SIZECONSTRAINT, SKIPTOEND, SNMPACCESSPART, SNMPAGENTCAPABILITIESMACROTYPE, SNMPCOMPLIANCEPART, SNMPCONTACTPART, SNMPCREATIONPART, SNMPDEFVALPART, SNMPDESCRPART, SNMPDISPLAYPART, SNMPENTERPRISEPART, SNMPINDEXPART, SNMPMANDATORYPART, SNMPMODULECOMPLIANCEMACROTYPE, SNMPMODULEIDENTITYMACROTYPE, SNMPMODULEPART, SNMPMODULESUPPORTPART, SNMPNOTIFICATIONGROUPMACROTYPE, SNMPNOTIFICATIONSPART, SNMPNOTIFICATIONTYPEMACROTYPE, SNMPOBJECTGROUPMACROTYPE, SNMPOBJECTIDENTITYMACROTYPE, SNMPOBJECTSPART, SNMPOBJECTTYPEMACROTYPE, SNMPORGANIZATIONPART, SNMPPRODUCTRELEASEPART, SNMPREFERPART, SNMPREVISIONPART, SNMPSTATUSPART, SNMPSYNTAXPART, SNMPTEXTUALCONVENTIONMACROTYPE, SNMPTRAPTYPEMACROTYPE, SNMPUNITSPART, SNMPUPDATEPART, SNMPVARIATIONPART, SNMPVARPART, SNMPWRITESYNTAXPART, SPECIALREALVALUE, START, STRINGTYPE, SYMBOL, SYMBOLLIST, SYMBOLSFROMMODULE, SYMBOLSFROMMODULELIST, TABSENT, TACCESS, TAG, TAGDEFAULT, TAGENT_CAPABILITIES, TAGGEDTYPE, TANY, TAPPLICATION, TASSIGN, TAUGMENTS, TBAR, TBEGIN, TBINSTRING, TBIT, TBITS, TBOOLEAN, TBY, TCHOICE, TCOMMA, TCOMPONENT, TCOMPONENTS, TCONTACT_INFO, TCREATION_REQUIRES, TCSTRING, TDEFAULT, TDEFINED, TDEFINITIONS, TDEFVAL, TDESCRIPTION, TDISPLAY_HINT, TDOT, TEND, TENTERPRISE, TENUMERATED, TEXPLICIT, TEXPORTS, TFALSE, TFROM, TGROUP, THEXSTRING, TIDENT, TIDENTIFIER, TIMPLICIT, TIMPLIED, TIMPORTS, TINCLUDES, TINDEX, TINTEGER, TLAST_UPDATED, TLEFTBRACE, TLEFTBRACKET, TLEFTPAREN, TLESSTHAN, TMACRO, TMANDATORY_GROUPS, TMAX, TMAX_ACCESS, TMIN, TMIN_ACCESS, TMINUS, TMINUS_INFINITY, TMODULE, TMODULE_COMPLIANCE, TMODULE_IDENTITY, TNOTIFICATION_GROUP, TNOTIFICATION_TYPE, TNOTIFICATIONS, TNULL, TNUMBER, TOBJECT, TOBJECT_GROUP, TOBJECT_IDENTITY, TOBJECT_TYPE, TOBJECTS, TOCTET, TOF, tokenNodeName, TOPTIONAL, TORGANIZATION, TPLUS_INFINITY, TPRESENT, TPRIVATE, TPRODUCT_RELEASE, TREAL, TREFERENCE, TREVISION, TRIGHTBRACE, TRIGHTBRACKET, TRIGHTPAREN, TSEMI_COLON, TSEQUENCE, TSET, TSIZE, TSTATUS, TSTRING, TSUPPORTS, TSYNTAX, TTAGS, TTEXTUAL_CONVENTION, TTRAP_TYPE, TTRUE, TUNITS, TUNIVERSAL, TVARIABLES, TVARIATION, TWITH, TWRITE_SYNTAX, TYPE, TYPEASSIGNMENT, TYPEORBITS, TYPEORVALUE, TYPEORVALUELIST, TYPEREFERENCE, UPPERENDPOINT, VALUE, VALUEASSIGNMENT, VALUECONSTRAINT, VALUELIST, VALUERANGE, VARTYPES
 
Constructor Summary
Token()
           
 
Method Summary
 int firstColumn()
          Returns the first column for the token.
 int firstLine()
          Returns the first line for the token.
 int lastColumn()
          Returns the last column for the token.
 int lastLine()
          Returns the last line for the token.
static Token newToken(int ofKind)
          Returns a new Token object, by default.
 java.lang.String toString()
          Returns the image.
 
Methods inherited from class net.percederberg.mib.asn1.node.Node
apply, childAfter, childAt, childOfType, children, childrenOfType, getParent, isAncestor, isParent, isType, setParent, toName, toName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

beginLine

public int beginLine
beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.

beginColumn

public int beginColumn
beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.

endLine

public int endLine
beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.

endColumn

public int endColumn
beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character of this token.

image

public java.lang.String image
The string image of the token.

next

public Token next
A reference to the next regular (non-special) token from the input stream. If this is the last token from the input stream, or if the token manager has not read tokens beyond this one, this field is set to null. This is true only if this token is also a regular token. Otherwise, see below for a description of the contents of this field.

specialToken

public Token specialToken
This field is used to access special tokens that occur prior to this token, but after the immediately preceding regular (non-special) token. If there are no such special tokens, this field is set to null. When there are more than one such special token, this field refers to the last of these special tokens, which in turn refers to the next previous special token through its specialToken field, and so on until the first special token (whose specialToken field is null). The next fields of special tokens refer to other special tokens that immediately follow it (without an intervening regular token). If there is no such token, this field is null.
Constructor Detail

Token

public Token()
Method Detail

toString

public final java.lang.String toString()
Returns the image.
Overrides:
toString in class Node
Returns:
the token image

newToken

public static final Token newToken(int ofKind)
Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a subclass of Token called IDToken that you want to create if ofKind is ID, simlpy add something like: case MyParserConstants.ID: return new IDToken(); to the following switch statement. Then you can cast matchedToken variable to the appropriate type and use it in your lexical actions.
Parameters:
ofKind - the token kind
Returns:
a new token object

firstLine

public int firstLine()
Returns the first line for the token.
Overrides:
firstLine in class Node
Returns:
the first line

firstColumn

public int firstColumn()
Returns the first column for the token.
Overrides:
firstColumn in class Node
Returns:
the first column

lastLine

public int lastLine()
Returns the last line for the token.
Overrides:
lastLine in class Node
Returns:
the last line

lastColumn

public int lastColumn()
Returns the last column for the token.
Overrides:
lastColumn in class Node
Returns:
the last column