gate.wiki.antlr
Class YAMContext

java.lang.Object
  extended by gate.wiki.antlr.YAMContext

public class YAMContext
extends Object

Track everything about a translation in progress. Translation targets get this context. Plugins generate text that must be interpreted as YAM. We create a new lexer to handle the string, but the new lexer must share context with the original (enclosing) lexer. This object is what is shared among lexers.


Field Summary
protected  Stack inputNameStack
           
protected  boolean inTable
           
protected  YAMLexer lexer
           
protected  Stack listTypeStack
           
static int LOWEST_LEVEL
          Lowest section/overhead level etc...
static int NOT_IN_SECTION_LEVEL
          Indication that we are below the lowest level and not in a section
protected  Hashtable pluginCache
          Tracks a list of Class objects
static String PLUGINS
          List of package(s) to search for plugin names.
protected  int sectionLevel
           
protected  StringBuffer textBetweenMarkup
           
protected  Hashtable userClasses
          A hashtable used to store the user defined markup to plugin class name mappings.
protected  Hashtable variables
           
 
Constructor Summary
YAMContext(YAMLexer lexer)
           
 
Method Summary
 void defineVariable(String id, Object value)
           
 int getColumn()
          What column number in the file are we at?
 String getInputName()
           
 int getLine()
          What line number in the file are we at?
 Class getPlugin(String name)
          Get from cache or using predefined variable PLUGINS
 YAMTarget getTarget()
          The plugins will want to know what the output target language is
 Object getVariable(String id)
           
 boolean isNestedTranslator()
           
 String popInputName()
           
 void pushInputName(String name)
           
 void registerClass(String markup, String className)
          This method is used for registering the plugin class as the handler for the specified markup type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOWEST_LEVEL

public static int LOWEST_LEVEL
Lowest section/overhead level etc...


NOT_IN_SECTION_LEVEL

public static int NOT_IN_SECTION_LEVEL
Indication that we are below the lowest level and not in a section


PLUGINS

public static String PLUGINS
List of package(s) to search for plugin names. CLASSPATH must include dirs containing package roots listed here.


inTable

protected boolean inTable

listTypeStack

protected Stack listTypeStack

sectionLevel

protected int sectionLevel

textBetweenMarkup

protected StringBuffer textBetweenMarkup

inputNameStack

protected Stack inputNameStack

userClasses

protected Hashtable userClasses
A hashtable used to store the user defined markup to plugin class name mappings.


lexer

protected YAMLexer lexer

pluginCache

protected Hashtable pluginCache
Tracks a list of Class objects


variables

protected Hashtable variables
Constructor Detail

YAMContext

public YAMContext(YAMLexer lexer)
Method Detail

isNestedTranslator

public boolean isNestedTranslator()

getTarget

public YAMTarget getTarget()
The plugins will want to know what the output target language is


pushInputName

public void pushInputName(String name)

popInputName

public String popInputName()

getInputName

public String getInputName()

getLine

public int getLine()
What line number in the file are we at?


getColumn

public int getColumn()
What column number in the file are we at?


getVariable

public Object getVariable(String id)

defineVariable

public void defineVariable(String id,
                           Object value)

registerClass

public void registerClass(String markup,
                          String className)
This method is used for registering the plugin class as the handler for the specified markup type.

Parameters:
markup - the markup that this plugin handles.
className - the class name of the plgin.

getPlugin

public Class getPlugin(String name)
Get from cache or using predefined variable PLUGINS