APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.compiler

pack-priv Class Lexer

extends Object
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.utils.PrefixResolver, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, java.util.List, javax.xml.transform.TransformerException, jdk.xml.internal.XMLSecurityManager, .XMLSecurityManager.Limit

This class is in charge of lexical processing of the XPath expression into tokens.

Field Summary

Modifier and TypeField and Description
private boolean
private Compiler
m_compiler

The target XPath.

private int
private int
pack-priv PrefixResolver
m_namespaceContext

The prefix resolver to map prefixes to namespaces in the XPath.

private int
private int
private int[]
m_patternMap

Ignore this, it is going away.

private int
m_patternMapSize

Ignore this, it is going away.

pack-priv XPathParser
m_processor

The XPath processor object.

pack-priv XMLSecurityManager
pack-priv static final int
TARGETEXTRA

This value is added to each element name in the TARGETEXTRA that is a 'target' (right-most top-level element name).

Constructor Summary

AccessConstructor and Description
pack-priv
Lexer(Compiler
The owning compiler for this lexer.
compiler
,
PrefixResolver
The prefix resolver for mapping qualified name prefixes to namespace URIs.
resolver
,
XPathParser
The parser that is processing strings to opcodes.
xpathProcessor
,
XMLSecurityManager
the XML security manager
xmlSecMgr
)

Create a Lexer object.

Method Summary

Modifier and TypeMethod and Description
private final void
addToTokenQueue(String
The token.
s
)

Add a token to the token queue.

pack-priv final int

Returns:

An opcode value.
getKeywordToken
(String
The keyword.
key
)

Given a string, return the corresponding keyword token.

private int

Returns:

the token queue position.
getTokenQueuePosFromMap
(int
The index in the m_patternMap.
i
)

Given a map pos, return the corresponding token queue pos.

private void
private int

Returns:

-1 always.
mapNSTokens
(String
The XPath name string.
pat
,
int
The start of the name string.
startSubstring
,
int
The position of the namespace seperator (':').
posOfNSSep
,
int
The end of the name index.
posOfScan
)

When a seperator token is found, see if there's a element name or the like to map.

private boolean

Returns:

true if this is the start of a pattern.
mapPatternElemPos
(int
The nesting count for the pattern element.
nesting
,
boolean
true if this is the start of a pattern.
isStart
,
boolean
true if we have determined that this is an attribute name.
isAttrName
)

Record the current position on the token queue as long as this is a top-level element.

private char

Returns:

the next char
peekNext
(String
the input string
s
,
int
the current index
index
)

Peeks at the next character without advancing the index.

private void
recordTokenString(List<String>
a list of strings.
targetStrings
)

Record the current token in the passed vector.

private final void
resetTokenMark(int
The new position.
mark
)

Reset token queue mark and m_token to a given position.

pack-priv void
tokenize(String
XSLT Expression.
pat
)

Walk through the expression and build a token queue, and a map of the top-level elements.

pack-priv void
tokenize(String
XSLT Expression.
pat
,
List<String>
a list to hold Strings, may be null.
targetStrings
)

Walk through the expression and build a token queue, and a map of the top-level elements.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isLiteralback to summary
private boolean isLiteral
m_compilerback to summary
private Compiler m_compiler

The target XPath.

m_grpCountback to summary
private int m_grpCount
m_grpCountLimitback to summary
private int m_grpCountLimit
m_namespaceContextback to summary
pack-priv PrefixResolver m_namespaceContext

The prefix resolver to map prefixes to namespaces in the XPath.

m_opCountback to summary
private int m_opCount
m_opCountLimitback to summary
private int m_opCountLimit
m_patternMapback to summary
private int[] m_patternMap

Ignore this, it is going away. This holds a map to the m_tokenQueue that tells where the top-level elements are. It is used for pattern matching so the m_tokenQueue can be walked backwards. Each element that is a 'target', (right-most top level element name) has TARGETEXTRA added to it.

m_patternMapSizeback to summary
private int m_patternMapSize

Ignore this, it is going away. The number of elements that m_patternMap maps;

m_processorback to summary
pack-priv XPathParser m_processor

The XPath processor object.

m_xmlSecMgrback to summary
pack-priv XMLSecurityManager m_xmlSecMgr
TARGETEXTRAback to summary
pack-priv static final int TARGETEXTRA

This value is added to each element name in the TARGETEXTRA that is a 'target' (right-most top-level element name).

Constructor Detail

Lexerback to summary
pack-priv Lexer(Compiler compiler, PrefixResolver resolver, XPathParser xpathProcessor, XMLSecurityManager xmlSecMgr)

Create a Lexer object.

Parameters
compiler:Compiler

The owning compiler for this lexer.

resolver:PrefixResolver

The prefix resolver for mapping qualified name prefixes to namespace URIs.

xpathProcessor:XPathParser

The parser that is processing strings to opcodes.

xmlSecMgr:XMLSecurityManager

the XML security manager

Method Detail

addToTokenQueueback to summary
private final void addToTokenQueue(String s)

Add a token to the token queue.

Parameters
s:String

The token.

getKeywordTokenback to summary
pack-priv final int getKeywordToken(String key)

Given a string, return the corresponding keyword token.

Parameters
key:String

The keyword.

Returns:int

An opcode value.

getTokenQueuePosFromMapback to summary
private int getTokenQueuePosFromMap(int i)

Given a map pos, return the corresponding token queue pos.

Parameters
i:int

The index in the m_patternMap.

Returns:int

the token queue position.

incrementCountback to summary
private void incrementCount()
mapNSTokensback to summary
private int mapNSTokens(String pat, int startSubstring, int posOfNSSep, int posOfScan) throws TransformerException

When a seperator token is found, see if there's a element name or the like to map.

Parameters
pat:String

The XPath name string.

startSubstring:int

The start of the name string.

posOfNSSep:int

The position of the namespace seperator (':').

posOfScan:int

The end of the name index.

Returns:int

-1 always.

mapPatternElemPosback to summary
private boolean mapPatternElemPos(int nesting, boolean isStart, boolean isAttrName)

Record the current position on the token queue as long as this is a top-level element. Must be called before the next token is added to the m_tokenQueue.

Parameters
nesting:int

The nesting count for the pattern element.

isStart:boolean

true if this is the start of a pattern.

isAttrName:boolean

true if we have determined that this is an attribute name.

Returns:boolean

true if this is the start of a pattern.

peekNextback to summary
private char peekNext(String s, int index)

Peeks at the next character without advancing the index.

Parameters
s:String

the input string

index:int

the current index

Returns:char

the next char

recordTokenStringback to summary
private void recordTokenString(List<String> targetStrings)

Record the current token in the passed vector.

Parameters
targetStrings:List<String>

a list of strings.

resetTokenMarkback to summary
private final void resetTokenMark(int mark)

Reset token queue mark and m_token to a given position.

Parameters
mark:int

The new position.

tokenizeback to summary
pack-priv void tokenize(String pat) throws TransformerException

Walk through the expression and build a token queue, and a map of the top-level elements.

Parameters
pat:String

XSLT Expression.

tokenizeback to summary
pack-priv void tokenize(String pat, List<String> targetStrings) throws TransformerException

Walk through the expression and build a token queue, and a map of the top-level elements.

Parameters
pat:String

XSLT Expression.

targetStrings:List<String>

a list to hold Strings, may be null.

Annotations
@SuppressWarnings:fallthrough