Class PageTemplate::Parser
In: lib/PageTemplate/parser.rb
Parent: Object

The big ass parser that does all the dirty work of turning templates into compiled commands.

Parser.new() accepts a hash as an argument, and looks for these keys: (with defaults)

 'namespace' => A namespace object. (A new namespace)
 'glossary'  => A SyntaxGlossary class singleton. (DefaultGlossary)
 'preprocessor' => The preprocessor. (DefaultPreprocessor)
 'default_processor' => The processor. (:process)
 'source' => The Source for templates. (FileSource)

Once the parser is created, it can compile and parse any number of templates.

It can be treated as a one-template item by using Parser#load(template), and calling Parser.output

To create separate generated templates from the same engine, use Parser#parse, or Parser#load. (It will still keep the most recent one it‘s load‘d, but that will not affect previously parsed or loaded)

Methods

clearCommands   compile   load   new   output   parse   parser   recent_parser  

Included Modules

NamespaceItem

Attributes

args  [R] 
commands  [R] 
default_processor  [R] 
glossary  [R] 
method_separators  [R] 
namespace  [R] 
preprocessor  [R] 
source  [R] 

Public Class methods

Parser.new() accepts a hash as an argument, and looks for these keys: (with defaults)

 'namespace' => A namespace object. (A new namespace)
 'glossary'  => A SyntaxGlossary object. (a dup of DEFAULTGLOSSARY)
 'preprocessor' => The preprocessor. (DefaultPreprocessor)
 'default_processor' => The processor. (:process)
 'source' => The Source for templates. (FileSource)

This is corny, but recent_parser returns the most recently created Parser.

Public Instance methods

Not really of any point, but clears the saved commands.

Load name from a template, but do not save it.

Load name from a template, and save it to allow this parser to use it for output.

If any commands are loaded and saved, return a string of it.

Compile a Template (BlockCommand) from a string. Does not save the commands.

But redefine parser

[Validate]