org.eclipse.emf.codegen.jet
Class JETCompiler

java.lang.Object
  extended by org.eclipse.emf.codegen.jet.JETCompiler
All Implemented Interfaces:
JETParseEventListener
Direct Known Subclasses:
JETEmitter.MyBaseJETCompiler

public class JETCompiler
extends java.lang.Object
implements JETParseEventListener


Field Summary
protected static java.lang.String CONSTANT_PREFIX
           
protected  long constantCount
           
protected  java.util.Map<char[],JETConstantDataGenerator> constantDictionary
           
protected  java.util.List<JETConstantDataGenerator> constants
           
protected  boolean fNoNewLineForScriptlets
          If true, the newline immediately preceding a scriptlet or directive (though not a successful include directive), along with any intervening spaces, will be stripped from the character data.
protected  char[] fSavedLine
          If fNoNewLineForScriptlets is true, the trailing newline/space sequence is stripped from each character data segment, and stored in this field.
protected  boolean fUseStaticFinalConstants
           
protected  java.util.List<JETGenerator> generators
           
protected static char[] NULL_CHAR_ARRAY
           
protected  JETParser parser
           
protected  JETReader reader
           
protected  int sectionDepth
          The depth of the current section, where 0 is outside of any sections.
protected  JETSkeleton skeleton
           
protected  boolean skipping
          Whether content is currently being skipped.
protected  java.util.Stack<org.eclipse.emf.codegen.jet.JETCompiler.SkipSection> skipSections
          A stack of sections and whether to start skipping, one from each include with alternative encountered.
protected  java.lang.String templateURI
           
protected  java.lang.String[] templateURIPath
           
protected  java.io.PrintWriter writer
           
 
Constructor Summary
JETCompiler(java.lang.String templateURI)
           
JETCompiler(java.lang.String[] templateURIPath, java.lang.String relativeTemplateURI)
           
JETCompiler(java.lang.String[] templateURIPath, java.lang.String relativeTemplateURI, java.lang.String encoding)
           
JETCompiler(java.lang.String templateURI, java.io.InputStream inputStream, java.lang.String encoding)
           
JETCompiler(java.lang.String templateURI, java.lang.String encoding)
           
 
Method Summary
 void addCharDataGenerator(char[] chars)
           
 void addGenerator(JETGenerator gen)
           
 void beginPageProcessing()
           
 void doAddCharDataGenerator(char[] chars)
           
 void endPageProcessing()
           
static java.lang.String find(java.lang.String[] locationURIPath, java.lang.String relativeLocationURI)
           
static java.lang.String[] findLocation(java.lang.String[] locationURIPath, int start, java.lang.String relativeLocationURI)
           
 void generate(java.io.OutputStream oStream)
           
 void generate(java.io.Writer writer)
           
 java.lang.String getResolvedTemplateURI()
           
 JETSkeleton getSkeleton()
           
 void handleCharData(char[] chars)
           
 void handleDirective(java.lang.String directive, JETMark start, JETMark stop, java.util.Map<java.lang.String,java.lang.String> attributes)
           
 void handleExpression(JETMark start, JETMark stop, java.util.Map<java.lang.String,java.lang.String> attributes)
           
protected  void handleNewSkeleton()
           
 void handleScriptlet(JETMark start, JETMark stop, java.util.Map<java.lang.String,java.lang.String> attributes)
           
static java.io.InputStream openStream(java.lang.String locationURI)
           
 void parse()
           
protected  void parse(JETCoreElement[] coreElements, java.lang.Class<?>[] accept)
           
protected static java.lang.String[] resolveLocation(java.lang.String[] templateURIPath, int start, java.lang.String baseLocationURI, java.lang.String locationURI)
           
protected static java.lang.String[] resolveLocation(java.lang.String[] templateURIPath, java.lang.String baseLocationURI, java.lang.String locationURI)
           
protected  char[] stripFirstNewLineWithBlanks(char[] chars)
           
protected  char[] stripLastNewLineWithBlanks(char[] chars)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_CHAR_ARRAY

protected static final char[] NULL_CHAR_ARRAY

templateURIPath

protected java.lang.String[] templateURIPath

templateURI

protected java.lang.String templateURI

parser

protected JETParser parser

skeleton

protected JETSkeleton skeleton

reader

protected JETReader reader

writer

protected java.io.PrintWriter writer

generators

protected java.util.List<JETGenerator> generators

constants

protected java.util.List<JETConstantDataGenerator> constants

constantDictionary

protected java.util.Map<char[],JETConstantDataGenerator> constantDictionary

constantCount

protected long constantCount

fNoNewLineForScriptlets

protected boolean fNoNewLineForScriptlets
If true, the newline immediately preceding a scriptlet or directive (though not a successful include directive), along with any intervening spaces, will be stripped from the character data.


fUseStaticFinalConstants

protected boolean fUseStaticFinalConstants

fSavedLine

protected char[] fSavedLine
If fNoNewLineForScriptlets is true, the trailing newline/space sequence is stripped from each character data segment, and stored in this field. Depending on what follows, it may then be discarded or handled as its own character data segment.


sectionDepth

protected int sectionDepth
The depth of the current section, where 0 is outside of any sections. A section is delimited by start and end directives, and must be preceded by an include directive with fail="alternative".


skipping

protected boolean skipping
Whether content is currently being skipped. This is set according to skipSections, as sections are started and ended.


skipSections

protected java.util.Stack<org.eclipse.emf.codegen.jet.JETCompiler.SkipSection> skipSections
A stack of sections and whether to start skipping, one from each include with alternative encountered.


CONSTANT_PREFIX

protected static final java.lang.String CONSTANT_PREFIX
See Also:
Constant Field Values
Constructor Detail

JETCompiler

public JETCompiler(java.lang.String templateURI)
            throws JETException
Throws:
JETException

JETCompiler

public JETCompiler(java.lang.String templateURI,
                   java.lang.String encoding)
            throws JETException
Throws:
JETException

JETCompiler

public JETCompiler(java.lang.String templateURI,
                   java.io.InputStream inputStream,
                   java.lang.String encoding)
            throws JETException
Throws:
JETException

JETCompiler

public JETCompiler(java.lang.String[] templateURIPath,
                   java.lang.String relativeTemplateURI)
            throws JETException
Throws:
JETException

JETCompiler

public JETCompiler(java.lang.String[] templateURIPath,
                   java.lang.String relativeTemplateURI,
                   java.lang.String encoding)
            throws JETException
Throws:
JETException
Method Detail

getResolvedTemplateURI

public java.lang.String getResolvedTemplateURI()

handleDirective

public void handleDirective(java.lang.String directive,
                            JETMark start,
                            JETMark stop,
                            java.util.Map<java.lang.String,java.lang.String> attributes)
                     throws JETException
Specified by:
handleDirective in interface JETParseEventListener
Throws:
JETException

handleNewSkeleton

protected void handleNewSkeleton()

handleExpression

public void handleExpression(JETMark start,
                             JETMark stop,
                             java.util.Map<java.lang.String,java.lang.String> attributes)
                      throws JETException
Specified by:
handleExpression in interface JETParseEventListener
Throws:
JETException

handleScriptlet

public void handleScriptlet(JETMark start,
                            JETMark stop,
                            java.util.Map<java.lang.String,java.lang.String> attributes)
                     throws JETException
Specified by:
handleScriptlet in interface JETParseEventListener
Throws:
JETException

handleCharData

public void handleCharData(char[] chars)
                    throws JETException
Specified by:
handleCharData in interface JETParseEventListener
Throws:
JETException

addGenerator

public void addGenerator(JETGenerator gen)
                  throws JETException
Throws:
JETException

addCharDataGenerator

public void addCharDataGenerator(char[] chars)
                          throws JETException
Throws:
JETException

doAddCharDataGenerator

public void doAddCharDataGenerator(char[] chars)
                            throws JETException
Throws:
JETException

stripFirstNewLineWithBlanks

protected char[] stripFirstNewLineWithBlanks(char[] chars)

stripLastNewLineWithBlanks

protected char[] stripLastNewLineWithBlanks(char[] chars)

beginPageProcessing

public void beginPageProcessing()
Specified by:
beginPageProcessing in interface JETParseEventListener

endPageProcessing

public void endPageProcessing()
                       throws JETException
Specified by:
endPageProcessing in interface JETParseEventListener
Throws:
JETException

parse

public void parse()
           throws JETException
Throws:
JETException

parse

protected void parse(JETCoreElement[] coreElements,
                     java.lang.Class<?>[] accept)
              throws JETException
Throws:
JETException

generate

public void generate(java.io.OutputStream oStream)
              throws JETException
Throws:
JETException

generate

public void generate(java.io.Writer writer)
              throws JETException
Throws:
JETException

getSkeleton

public JETSkeleton getSkeleton()

resolveLocation

protected static java.lang.String[] resolveLocation(java.lang.String[] templateURIPath,
                                                    java.lang.String baseLocationURI,
                                                    java.lang.String locationURI)

resolveLocation

protected static java.lang.String[] resolveLocation(java.lang.String[] templateURIPath,
                                                    int start,
                                                    java.lang.String baseLocationURI,
                                                    java.lang.String locationURI)

findLocation

public static java.lang.String[] findLocation(java.lang.String[] locationURIPath,
                                              int start,
                                              java.lang.String relativeLocationURI)

find

public static java.lang.String find(java.lang.String[] locationURIPath,
                                    java.lang.String relativeLocationURI)

openStream

public static java.io.InputStream openStream(java.lang.String locationURI)
                                      throws JETException
Throws:
JETException

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.