com.opensymphony.module.sitemesh.html.tokenizer
Class Parser

java.lang.Object
  extended by Lexer
      extended by 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
 class Parser.ReusableToken
           
 
Field Summary
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  java.lang.String name
           
private  int position
           
private  java.lang.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
Parser(char[] input, TokenHandler handler)
           
 
Method Summary
private  void parseAttribute()
           
protected  void parsedAttribute(java.lang.String name, java.lang.String value, boolean quoted)
           
protected  void parsedTag(int type, java.lang.String name, int start, int length)
           
protected  void parsedText(int position, int length)
           
private  void parseFullTag(int type, java.lang.String name, int start)
           
private  void parseTag(int type)
           
private  void pushBack(int next)
           
protected  void reportError(java.lang.String message, int line, int column)
           
private  void skipWhiteSpace()
           
 void start()
           
private  java.lang.String text()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeBuffer

private final CharArray attributeBuffer

reusableToken

private final Parser.ReusableToken reusableToken

pushbackToken

private int pushbackToken

pushbackText

private java.lang.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 java.lang.String name

type

private int type
Constructor Detail

Parser

public Parser(char[] input,
              TokenHandler handler)
Method Detail

text

private java.lang.String text()

skipWhiteSpace

private void skipWhiteSpace()
                     throws java.io.IOException
Throws:
java.io.IOException

pushBack

private void pushBack(int next)

start

public void start()

parseTag

private void parseTag(int type)
               throws java.io.IOException
Throws:
java.io.IOException

parseFullTag

private void parseFullTag(int type,
                          java.lang.String name,
                          int start)
                   throws java.io.IOException
Throws:
java.io.IOException

parseAttribute

private void parseAttribute()
                     throws java.io.IOException
Throws:
java.io.IOException

parsedText

protected void parsedText(int position,
                          int length)

parsedTag

protected void parsedTag(int type,
                         java.lang.String name,
                         int start,
                         int length)

parsedAttribute

protected void parsedAttribute(java.lang.String name,
                               java.lang.String value,
                               boolean quoted)

reportError

protected void reportError(java.lang.String message,
                           int line,
                           int column)

www.opensymphony.com/sitemesh/