Class Parser
- java.lang.Object
-
- Lexer
-
- com.opensymphony.module.sitemesh.html.tokenizer.Parser
-
public class Parser extends Lexer
Looks for patterns of tokens in the Lexer and translates these to calls to pass to the TokenHandler.- Author:
- Joe Walnes
- See Also:
TagTokenizer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Parser.ReusableToken
-
Field Summary
Fields Modifier and Type Field Description private CharArray
attributeBuffer
static short
EQUALS
static short
GT
private TokenHandler
handler
private char[]
input
private int
length
static short
LT
static short
LT_CLOSE_MAGIC_COMMENT
static short
LT_OPEN_MAGIC_COMMENT
private String
name
private int
position
private String
pushbackText
private int
pushbackToken
static short
QUOTE
static short
QUOTED
private Parser.ReusableToken
reusableToken
static short
SLASH
static short
TEXT
private int
type
static short
WHITESPACE
static short
WORD
-
Constructor Summary
Constructors Constructor Description Parser(char[] input, TokenHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
parseAttribute()
protected void
parsedAttribute(String name, String value, boolean quoted)
protected void
parsedTag(int type, String name, int start, int length)
protected void
parsedText(int position, int length)
private void
parseFullTag(int type, String name, int start)
private void
parseTag(int type)
private void
pushBack(int next)
protected void
reportError(String message, int line, int column)
private void
skipWhiteSpace()
void
start()
private String
text()
-
-
-
Field Detail
-
attributeBuffer
private final CharArray attributeBuffer
-
reusableToken
private final Parser.ReusableToken reusableToken
-
pushbackToken
private int pushbackToken
-
pushbackText
private String pushbackText
-
SLASH
public static final short SLASH
- See Also:
- Constant Field Values
-
WHITESPACE
public static final short WHITESPACE
- See Also:
- Constant Field Values
-
EQUALS
public static final short EQUALS
- See Also:
- Constant Field Values
-
QUOTE
public static final short QUOTE
- See Also:
- Constant Field Values
-
WORD
public static final short WORD
- See Also:
- Constant Field Values
-
TEXT
public static final short TEXT
- See Also:
- Constant Field Values
-
QUOTED
public static final short QUOTED
- See Also:
- Constant Field Values
-
LT
public static final short LT
- See Also:
- Constant Field Values
-
GT
public static final short GT
- See Also:
- Constant Field Values
-
LT_OPEN_MAGIC_COMMENT
public static final short LT_OPEN_MAGIC_COMMENT
- See Also:
- Constant Field Values
-
LT_CLOSE_MAGIC_COMMENT
public static final short LT_CLOSE_MAGIC_COMMENT
- See Also:
- Constant Field Values
-
input
private final char[] input
-
handler
private TokenHandler handler
-
position
private int position
-
length
private int length
-
name
private String name
-
type
private int type
-
-
Constructor Detail
-
Parser
public Parser(char[] input, TokenHandler handler)
-
-
Method Detail
-
text
private String text()
-
skipWhiteSpace
private void skipWhiteSpace() throws IOException
- Throws:
IOException
-
pushBack
private void pushBack(int next)
-
start
public void start()
-
parseTag
private void parseTag(int type) throws IOException
- Throws:
IOException
-
parseFullTag
private void parseFullTag(int type, String name, int start) throws IOException
- Throws:
IOException
-
parseAttribute
private void parseAttribute() throws IOException
- Throws:
IOException
-
parsedText
protected void parsedText(int position, int length)
-
parsedTag
protected void parsedTag(int type, String name, int start, int length)
-
reportError
protected void reportError(String message, int line, int column)
-
-