net.sf.jse
Class Fragment
java.lang.Object
|
+--net.sf.jse.Fragment
- All Implemented Interfaces:
- java.lang.Cloneable
- Direct Known Subclasses:
- CompoundFragment, LeafFragment
- public abstract class Fragment
- extends java.lang.Object
- implements java.lang.Cloneable
Mother of all Fragments
- Version:
- 0.9, 03OCT00
- Author:
- Jonathan Bachrach, Keith Playford
Field Summary |
static PrettyStream |
out
Stream for pretty printing using pprint and pprintln |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
public static PrettyStream out
- Stream for pretty printing using pprint and pprintln
Fragment
public Fragment()
compilePatternElement
public Expansion compilePatternElement(FragmentList tail,
IdentifierFragment nowVar,
IdentifierFragment endVar)
- Top level entry point to compiling fragments within a pattern
- Parameters:
tail
- remaining fragments to compiling through tail callingnowVar
- runtime variable bound to current input fragments- See Also:
Template.compilePattern(net.sf.jse.Fragment, net.sf.jse.IdentifierFragment)
generatePatternCode
public Expansion generatePatternCode(IdentifierFragment nowVar,
IdentifierFragment nextVar)
- Pattern matching code generator
- Parameters:
nowVar
- runtime variable bound to current input fragmentsnextVar
- where to put remaining fragments after matching- See Also:
compilePatternElement(net.sf.jse.FragmentList, net.sf.jse.IdentifierFragment, net.sf.jse.IdentifierFragment)
compileTemplate
public Fragment compileTemplate(int depth)
- Template code generator -- probably should be compileTemplateElement
- See Also:
Template.compileTemplate(int)
compileQuestionExpression
public Fragment compileQuestionExpression(int tDepth,
int qDepth)
collectBoundVariables
public FragmentList collectBoundVariables()
getCurrentLine
public static int getCurrentLine()
setCurrentLine
public static void setCurrentLine(int line)
getLine
public int getLine()
makeToken
public static antlr.Token makeToken(int type,
java.lang.String text)
makeToken
public static antlr.Token makeToken(int type)
tokens
public List tokens()
expandTemplates
public Fragment expandTemplates()
expandMacros
public Fragment expandMacros(MacroExpander expander,
boolean isRecursive)
markMacros
public Fragment markMacros(MacroExpander expander)
isTerminator
public boolean isTerminator()
capitalize
public static java.lang.String capitalize(java.lang.String name)
- Parameters:
name
- string to be capitalized
getValue
public java.lang.Object getValue()
- protocol for converting fragments back into Java literals
getInt
public int getInt()
getFloat
public float getFloat()
getString
public java.lang.String getString()
getChar
public char getChar()
getInsideFragments
public abstract FragmentList getInsideFragments()
die
public static void die(java.lang.String message)