apache > cocoon
 

Parser Transformer

Parser Transformer

The parser transformer builds a syntax tree of a list of lexemes (tokens), by using a grammar file.

  • Name: parser
  • Class: org.apache.cocoon.transformation.ParserTransformer
  • Cacheable: yes - uses the last modification date of the grammar document for validation.

The parser uses the following elements from the SAX stream, and replaces them through a syntax tree.

<lexemes xmlns="http://chaperon.sourceforge.net/schema/lexemes/1.0">
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="punctation" text="..."/>
</lexemes>

The parser transformer will replace those elements with a syntax tree.

<paragraph xmlns="http://chaperon.sourceforge.net/schema/syntaxtree/1.0">
 <sentence>
  <word>...</word>
  <word>...</word>
  <word>...</word>
  <punctation>...</punctation>
 </sentence>
</paragraph>

A detailed explanation of function and the grammar format can be found at Chaperon.