NIST SIP Parser and Stack (v1.2) API

gov.nist.core
Class LexerCore

java.lang.Object
  |
  +--gov.nist.core.StringTokenizer
        |
        +--gov.nist.core.LexerCore
Direct Known Subclasses:
Lexer

public abstract class LexerCore
extends StringTokenizer

A lexical analyzer that is used by all parsers in our implementation.

Author:
M. Ranganathan

Field Summary
static int ALPHA
           
static int AND
           
static int AT
           
static int BACK_QUOTE
           
static int BACKSLASH
           
static int BAR
           
static int COLON
           
static int DIGIT
           
static int DOLLAR
           
static int DOT
           
static int DOUBLEQUOTE
           
static int END
           
static int EQUALS
           
static int EXCLAMATION
           
static int GREATER_THAN
           
static int HAT
           
static int HT
           
static int ID
           
static int L_CURLY
           
static int L_SQUARE_BRACKET
           
static int LESS_THAN
           
static int LPAREN
           
static int MINUS
           
static int NULL
           
static int PERCENT
           
static int PLUS
           
static int POUND
           
static int QUESTION
           
static int QUOTE
           
static int R_CURLY
           
static int R_SQUARE_BRACKET
           
static int RPAREN
           
static int SEMICOLON
           
static int SLASH
           
static int SP
           
static int STAR
           
static int START
           
static int TILDE
           
static int UNDERSCORE
           
static int WHITESPACE
           
 
Constructor Summary
LexerCore(String lexerName)
           
LexerCore(String lexerName, String buffer)
          Initialize the lexer with a buffer.
 
Method Summary
 String byteStringNoComma()
           
 String byteStringNoSemicolon()
           
static String charAsString(char ch)
           
 String charAsString(int nchars)
          Lookahead in the inputBuffer for n chars and return as a string.
 String comment()
           
 ParseException createParseException()
          Create a parse exception.
 String getBuffer()
          Get the buffer.
 String getNextId()
          Get the next id.
 Token getNextToken()
           
 int getPtr()
          Get the read pointer.
 String getRest()
          Get the rest of the String
 String getString(char c)
          Get the sub-String until the character is encountered
 String lookupToken(int value)
           
 int markInputPosition()
          Mark the position for backtracking.
 Token match(int tok)
          Match the given token or throw an exception if no such token can be matched.
 String number()
          Get and consume the next number.
 String peekNextId()
          Peek the next id but dont move the buffer pointer forward.
 Token peekNextToken()
          Look ahead for one token.
 Vector peekNextToken(int ntokens)
           
 String quotedString()
           
 void rewindInputPosition(int position)
          Rewind the input ptr to the marked position.
abstract  void selectLexer(String lexerName)
           
 void SPorHT()
           
 boolean startsId()
           
 String ttoken()
           
 String ttokenAllowSpace()
           
 
Methods inherited from class gov.nist.core.StringTokenizer
consume, consume, getLine, getLines, getNextChar, getNextToken, getSDPFieldName, hasMoreChars, isAlpha, isDigit, isHexDigit, lookAhead, lookAhead, nextToken, peekLine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static final int START
See Also:
Constant Field Values

END

public static final int END
See Also:
Constant Field Values

ID

public static final int ID
See Also:
Constant Field Values

WHITESPACE

public static final int WHITESPACE
See Also:
Constant Field Values

DIGIT

public static final int DIGIT
See Also:
Constant Field Values

ALPHA

public static final int ALPHA
See Also:
Constant Field Values

BACKSLASH

public static final int BACKSLASH
See Also:
Constant Field Values

QUOTE

public static final int QUOTE
See Also:
Constant Field Values

AT

public static final int AT
See Also:
Constant Field Values

SP

public static final int SP
See Also:
Constant Field Values

HT

public static final int HT
See Also:
Constant Field Values

COLON

public static final int COLON
See Also:
Constant Field Values

STAR

public static final int STAR
See Also:
Constant Field Values

DOLLAR

public static final int DOLLAR
See Also:
Constant Field Values

PLUS

public static final int PLUS
See Also:
Constant Field Values

POUND

public static final int POUND
See Also:
Constant Field Values

MINUS

public static final int MINUS
See Also:
Constant Field Values

DOUBLEQUOTE

public static final int DOUBLEQUOTE
See Also:
Constant Field Values

TILDE

public static final int TILDE
See Also:
Constant Field Values

BACK_QUOTE

public static final int BACK_QUOTE
See Also:
Constant Field Values

NULL

public static final int NULL
See Also:
Constant Field Values

EQUALS

public static final int EQUALS
See Also:
Constant Field Values

SEMICOLON

public static final int SEMICOLON
See Also:
Constant Field Values

SLASH

public static final int SLASH
See Also:
Constant Field Values

L_SQUARE_BRACKET

public static final int L_SQUARE_BRACKET
See Also:
Constant Field Values

R_SQUARE_BRACKET

public static final int R_SQUARE_BRACKET
See Also:
Constant Field Values

R_CURLY

public static final int R_CURLY
See Also:
Constant Field Values

L_CURLY

public static final int L_CURLY
See Also:
Constant Field Values

HAT

public static final int HAT
See Also:
Constant Field Values

BAR

public static final int BAR
See Also:
Constant Field Values

DOT

public static final int DOT
See Also:
Constant Field Values

EXCLAMATION

public static final int EXCLAMATION
See Also:
Constant Field Values

LPAREN

public static final int LPAREN
See Also:
Constant Field Values

RPAREN

public static final int RPAREN
See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

PERCENT

public static final int PERCENT
See Also:
Constant Field Values

QUESTION

public static final int QUESTION
See Also:
Constant Field Values

AND

public static final int AND
See Also:
Constant Field Values

UNDERSCORE

public static final int UNDERSCORE
See Also:
Constant Field Values
Constructor Detail

LexerCore

public LexerCore(String lexerName)

LexerCore

public LexerCore(String lexerName,
                 String buffer)
Initialize the lexer with a buffer.

Method Detail

lookupToken

public String lookupToken(int value)

selectLexer

public abstract void selectLexer(String lexerName)

peekNextId

public String peekNextId()
Peek the next id but dont move the buffer pointer forward.


getNextId

public String getNextId()
Get the next id.


getNextToken

public Token getNextToken()

peekNextToken

public Token peekNextToken()
                    throws ParseException
Look ahead for one token.

ParseException

peekNextToken

public Vector peekNextToken(int ntokens)
                     throws ParseException
ParseException

match

public Token match(int tok)
            throws ParseException
Match the given token or throw an exception if no such token can be matched.

ParseException

SPorHT

public void SPorHT()

startsId

public boolean startsId()

ttoken

public String ttoken()

ttokenAllowSpace

public String ttokenAllowSpace()

quotedString

public String quotedString()
                    throws ParseException
ParseException

comment

public String comment()
               throws ParseException
ParseException

byteStringNoSemicolon

public String byteStringNoSemicolon()

byteStringNoComma

public String byteStringNoComma()

charAsString

public static String charAsString(char ch)

charAsString

public String charAsString(int nchars)
Lookahead in the inputBuffer for n chars and return as a string. Do not consume the input.


number

public String number()
              throws ParseException
Get and consume the next number.

ParseException

markInputPosition

public int markInputPosition()
Mark the position for backtracking.


rewindInputPosition

public void rewindInputPosition(int position)
Rewind the input ptr to the marked position.


getRest

public String getRest()
Get the rest of the String

Returns:
String

getString

public String getString(char c)
                 throws ParseException
Get the sub-String until the character is encountered

Returns:
String
ParseException

getPtr

public int getPtr()
Get the read pointer.


getBuffer

public String getBuffer()
Get the buffer.


createParseException

public ParseException createParseException()
Create a parse exception.


NIST SIP Parser and Stack (v1.2) API

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Get the latest distribution.
Submit a bug report or feature request.