com.springsource.util.osgi.manifest.parse.standard
Class StandardHeaderLexer
java.lang.Object
com.springsource.util.osgi.manifest.parse.standard.StandardHeaderLexer
public class StandardHeaderLexer
- extends java.lang.Object
Lex an input string into a series of tokens. The possible tokens are defined
in HeaderTokenKind
Basic token descriptions:
- digit ::= [0..9]
- alpha ::= [a..zA..Z]
- alphanum ::= alpha | digit
- token ::= ( alphanum | ?_? | ?-? )+
- number ::= digit+
- jletter ::= Character.isJavaIdentifierStart()
- jletterordigit::= Character.isJavaIdentifierPart()
- identifier ::= jletter jletterordigit *
- quoted-string ::= ?"? ( [^"\#x0D#x0A#x00] | ?\"?|?\\?)* ?"?
- DOT ::= .
- COLON_EQUALS ::= ':='
- EQUALS ::= '='
- DOTSTAR ::= .*
header ::= clause ( ?,? clause ) *
clause ::= path ( ?;? path ) * ( ?;? parameter ) *
path ::= path-unquoted | (?"? path-unquoted ?"?)
path-unquoted ::= path-sep | path-sep? path-element (path-sep path-element)*
path-element ::= [^/"\#x0D#x0A#x00]+
path-sep ::= ?/?
Concurrent Semantics
Threadsafe.
- Author:
- Andy Clement
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
tokenStream
private HeaderTokenStream tokenStream
tokenStart
private int tokenStart
tokenStartedWithLetter
private boolean tokenStartedWithLetter
data
char[] data
state
private int state
datapos
private int datapos
datalen
private int datalen
extensionStart
private BasicHeaderToken extensionStart
lastEmittedToken
private BasicHeaderToken lastEmittedToken
foundSpace
private boolean foundSpace
allowsPathToken
private boolean allowsPathToken
UNKNOWN
private static final int UNKNOWN
- See Also:
- Constant Field Values
DIGITS
private static final int DIGITS
- See Also:
- Constant Field Values
ALPHABETIC
private static final int ALPHABETIC
- See Also:
- Constant Field Values
ALPHANUMERIC
private static final int ALPHANUMERIC
- See Also:
- Constant Field Values
TOKEN
private static final int TOKEN
- See Also:
- Constant Field Values
IDENTIFIER
private static final int IDENTIFIER
- See Also:
- Constant Field Values
QUOTEDSTRING
private static final int QUOTEDSTRING
- See Also:
- Constant Field Values
PATHELEMENT
private static final int PATHELEMENT
- See Also:
- Constant Field Values
stateToTokenMap
private static final HeaderTokenKind[] stateToTokenMap
tokenExtension
private static final boolean[] tokenExtension
lookup
private static final byte[] lookup
IS_DIGIT
private static final byte IS_DIGIT
- See Also:
- Constant Field Values
IS_ALPHA
private static final byte IS_ALPHA
- See Also:
- Constant Field Values
IS_UNDERLINE_OR_MINUS
private static final byte IS_UNDERLINE_OR_MINUS
- See Also:
- Constant Field Values
IS_ALPHANUM
private static final byte IS_ALPHANUM
- See Also:
- Constant Field Values
IS_TOKEN
private static final byte IS_TOKEN
- See Also:
- Constant Field Values
StandardHeaderLexer
public StandardHeaderLexer()
StandardHeaderLexer
public StandardHeaderLexer(boolean allowsPathToken)
getTokenStream
public HeaderTokenStream getTokenStream()
initializeLexer
private void initializeLexer(java.lang.String header)
process
public void process(java.lang.String header)
- Start in the UNKNOWN state where anything may come next, as characters are encountered and consumed the state will transition
amongst other states. It is operating on a maximal munch approach where we eat as much data as we can before being forced
into a new state and onto a new token.
- Parameters:
header
- string
processSpace
private void processSpace()
processDot
private void processDot()
processSlash
private void processSlash()
processStar
private void processStar()
processUnexpected
private void processUnexpected()
pathEnd
private boolean pathEnd(char ch)
processNul
private void processNul()
processDigit
private void processDigit()
processAlphabetic
private void processAlphabetic()
processUnderlineMinus
private void processUnderlineMinus()
processQuote
private void processQuote()
processJavaIdentifierPart
private void processJavaIdentifierPart()
processColon
private void processColon()
processJavaIdentifierStart
private void processJavaIdentifierStart()
isDigit
private boolean isDigit(int ch)
isAlphabetic
private boolean isAlphabetic(int ch)
isAlphanumeric
private boolean isAlphanumeric(int ch)
isUnderlineMinus
private boolean isUnderlineMinus(int ch)
isToken
private boolean isToken(int ch)
emitToken
private void emitToken(HeaderTokenKind kind,
int pos)
emitToken2
private void emitToken2(HeaderTokenKind kind,
int pos)
emitDotStar
private void emitDotStar(int pos)
emitColonEquals
private void emitColonEquals(int pos)
emitToken
private void emitToken(int tokenEnd)
pushExtensionToken
private void pushExtensionToken(BasicHeaderToken token)
pushToken
private void pushToken(BasicHeaderToken token)
recordProblem
private void recordProblem(HeaderProblemKind parseProblem,
int startOffset,
int endOffset,
java.lang.String... inserts)
- Record a problem with lexing.
- Parameters:
parseProblem
- the kind of problem that occurredstartOffset
- the start offset of the problemendOffset
- the end offset of the probleminserts
- the inserts for the problem message text