Class Parser
- java.lang.Object
-
- Lexer
-
- com.opensymphony.module.sitemesh.html.tokenizer.Parser
-
public class Parser extends LexerLooks 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 classParser.ReusableToken
-
Field Summary
Fields Modifier and Type Field Description private CharArrayattributeBufferstatic shortEQUALSstatic shortGTprivate TokenHandlerhandlerprivate char[]inputprivate intlengthstatic shortLTstatic shortLT_CLOSE_MAGIC_COMMENTstatic shortLT_OPEN_MAGIC_COMMENTprivate Stringnameprivate intpositionprivate StringpushbackTextprivate intpushbackTokenstatic shortQUOTEstatic shortQUOTEDprivate Parser.ReusableTokenreusableTokenstatic shortSLASHstatic shortTEXTprivate inttypestatic shortWHITESPACEstatic shortWORD
-
Constructor Summary
Constructors Constructor Description Parser(char[] input, TokenHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidparseAttribute()protected voidparsedAttribute(String name, String value, boolean quoted)protected voidparsedTag(int type, String name, int start, int length)protected voidparsedText(int position, int length)private voidparseFullTag(int type, String name, int start)private voidparseTag(int type)private voidpushBack(int next)protected voidreportError(String message, int line, int column)private voidskipWhiteSpace()voidstart()private Stringtext()
-
-
-
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)
-
-