Home | News | Wiki | About StringTemplate | Feedback | Support | Bugs


Latest version is 3.2.
Download now! »

Download
» Home
» Download
» News
»Using StringTemplate
» Documentation
» Wiki
» Articles
» File Sharing
» Code API
» Tech Support
»About StringTemplate
» What is it?
» Showcase
» Testimonials
» Software License
» Changes
»Feedback
»Credits
»Contact


Support StringTemplate, ANTLR Project by making a donation! Terence often pays for things like the antlr.org server, conference travel, and this site design (that alone cost US$1000). Buy him a beer and pizza remotely ;)

Search



PathGroupLoader


org.antlr.stringtemplate
Class PathGroupLoader

java.lang.Object
  extended byorg.antlr.stringtemplate.PathGroupLoader
All Implemented Interfaces:
StringTemplateGroupLoader
Direct Known Subclasses:
CommonGroupLoader

public class PathGroupLoader
extends java.lang.Object
implements StringTemplateGroupLoader

A brain dead loader that looks only in the directory(ies) you specify in the ctor. You may specify the char encoding. NOTE: this does not work when you jar things up! Use CommonGroupLoader instead in that case


Field Summary
protected  java.util.List dirs
          List of ':' separated dirs to pull groups from
protected  StringTemplateErrorListener errors
           
(package private)  java.lang.String fileCharEncoding
          How are the files encoded (ascii, UTF8, ...)? You might want to read UTF8 for example on an ascii machine.
 
Constructor Summary
PathGroupLoader(java.lang.String dirStr, StringTemplateErrorListener errors)
          Pass a single dir or multiple dirs separated by colons from which to load groups/interfaces.
PathGroupLoader(StringTemplateErrorListener errors)
           
 
Method Summary
 void error(java.lang.String msg)
           
 void error(java.lang.String msg, java.lang.Exception e)
           
 java.lang.String getFileCharEncoding()
           
protected  java.io.InputStreamReader getInputStreamReader(java.io.InputStream in)
           
 StringTemplateGroup loadGroup(java.lang.String groupName)
          Load the group called groupName from somewhere.
 StringTemplateGroup loadGroup(java.lang.String groupName, java.lang.Class templateLexer, StringTemplateGroup superGroup)
          Load a group with a specified superGroup.
 StringTemplateGroup loadGroup(java.lang.String groupName, StringTemplateGroup superGroup)
          Load a group with a specified superGroup.
 StringTemplateGroupInterface loadInterface(java.lang.String interfaceName)
          Load the interface called interfaceName from somewhere.
protected  java.io.BufferedReader locate(java.lang.String name)
          Look in each directory for the file called 'name'.
 void setFileCharEncoding(java.lang.String fileCharEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirs

protected java.util.List dirs
List of ':' separated dirs to pull groups from


errors

protected StringTemplateErrorListener errors

fileCharEncoding

java.lang.String fileCharEncoding
How are the files encoded (ascii, UTF8, ...)? You might want to read UTF8 for example on an ascii machine.

Constructor Detail

PathGroupLoader

public PathGroupLoader(StringTemplateErrorListener errors)

PathGroupLoader

public PathGroupLoader(java.lang.String dirStr,
                       StringTemplateErrorListener errors)
Pass a single dir or multiple dirs separated by colons from which to load groups/interfaces.

Method Detail

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName,
                                     java.lang.Class templateLexer,
                                     StringTemplateGroup superGroup)
Load a group with a specified superGroup. Groups with region definitions must know their supergroup to find templates during parsing.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName,
                                     StringTemplateGroup superGroup)
Description copied from interface: StringTemplateGroupLoader
Load a group with a specified superGroup. Groups with region definitions must know their supergroup to find templates during parsing.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadGroup

public StringTemplateGroup loadGroup(java.lang.String groupName)
Description copied from interface: StringTemplateGroupLoader
Load the group called groupName from somewhere. Return null if no group is found.

Specified by:
loadGroup in interface StringTemplateGroupLoader

loadInterface

public StringTemplateGroupInterface loadInterface(java.lang.String interfaceName)
Description copied from interface: StringTemplateGroupLoader
Load the interface called interfaceName from somewhere. Return null if no interface is found.

Specified by:
loadInterface in interface StringTemplateGroupLoader

locate

protected java.io.BufferedReader locate(java.lang.String name)
                                 throws java.io.IOException
Look in each directory for the file called 'name'.

Throws:
java.io.IOException

getInputStreamReader

protected java.io.InputStreamReader getInputStreamReader(java.io.InputStream in)

getFileCharEncoding

public java.lang.String getFileCharEncoding()

setFileCharEncoding

public void setFileCharEncoding(java.lang.String fileCharEncoding)

error

public void error(java.lang.String msg)

error

public void error(java.lang.String msg,
                  java.lang.Exception e)