|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpmp.Macroprocessor
public class Macroprocessor
Main class of Macroprocessor.
Title: PMP: Macroprocessor
Description: Java macroprocessor
Copyright: Copyright (c) 2005
Nested Class Summary | |
---|---|
class |
Macroprocessor.Component
|
Field Summary | |
---|---|
protected java.util.Locale |
currentLoc
|
protected java.lang.String |
currentLocStr
|
static int |
DEBUG_EVERY_TOKEN
Debug level: Print every processed token |
static int |
DEBUG_MACRO_CALLS
Debug level: Print macro calls |
static int |
DEBUG_MACRO_RESULTS
Debug level: Print macro call results |
static int |
DEBUG_NODEBUG
Debug level: No debugging |
static int |
DEBUG_NOTICES
Debug level: Print notice messages |
static java.lang.String |
DEFAULT_PREFIX
|
protected MacroList |
macros
|
protected Analyzer |
mpan
|
protected InputOutput |
mpio
|
protected InputQueue |
mpiq
|
protected java.lang.String |
pmpprefix
|
protected java.util.ArrayList<java.net.URL> |
urls
List of libraries with macro class files. |
Constructor Summary | |
---|---|
Macroprocessor()
|
Method Summary | |
---|---|
void |
assignIO(InputOutput io)
Assigns InputOutput class to macroprocessor. |
void |
debug(java.lang.Object message,
int level)
|
void |
error(java.lang.String msg)
Produces fatal error. |
int |
getDebugLevel()
Get current level of debugging output. |
java.util.Locale |
getLocale()
|
Macroprocessor |
getMP()
|
Analyzer |
getMPAnalyzer()
|
InputOutput |
getMPIO()
|
InputQueue |
getMPIQ()
|
MacroList |
getMPMacros()
|
java.lang.String |
getPrefix()
Returns prefix of configuration directives. |
void |
importLibrary(java.lang.String name)
Adds given library to library list. |
boolean |
isReady()
Returns true if macroprocessor is ready. |
AbstractMacro |
loadFromClass(java.lang.String className)
Loads macro class. |
void |
macroListModified(MacroListModifyEvent event)
Method invoked on event. |
void |
notice(java.lang.String msg)
Produces notice message. |
void |
parse()
Starts macroprocessor. |
void |
reset()
Resets macroprocessor. |
java.lang.String |
runMacro(CallStackItem item)
Invokes macro's AbstractMacro.run(Macroprocessor,String[]) method
and returns result. |
void |
setDebugLevel(int level)
Sets new debugging level. |
boolean |
setDebugLevel(java.lang.String level)
Sets debugging level according to given string. |
java.lang.String |
setPrefix(java.lang.String newprefix)
Changes prefix of configuration directives. |
void |
warning(java.lang.String msg)
Produces warning message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MacroList macros
protected InputOutput mpio
protected InputQueue mpiq
protected Analyzer mpan
public static final java.lang.String DEFAULT_PREFIX
protected java.lang.String pmpprefix
public static final int DEBUG_NODEBUG
public static final int DEBUG_NOTICES
public static final int DEBUG_MACRO_CALLS
public static final int DEBUG_MACRO_RESULTS
public static final int DEBUG_EVERY_TOKEN
protected java.util.Locale currentLoc
protected java.lang.String currentLocStr
protected java.util.ArrayList<java.net.URL> urls
Constructor Detail |
---|
public Macroprocessor()
Method Detail |
---|
public void macroListModified(MacroListModifyEvent event)
MacroListModifyListener
macroListModified
in interface MacroListModifyListener
public void assignIO(InputOutput io)
This should be done as soon as possible since it is the only way MP can provide any feedback.
io
- InputOutput classpublic boolean isReady()
true
if macroprocessor is ready. This method
doesn't check whether InputQueue is not empty.
parse()
.public void reset()
public void parse() throws FatalParserException, InternalMPError
FatalParserException
- when something fails and it is impossible to continue
InternalMPError
- when internal error has occured
FatalParserException
- when parsing error has occurspublic final Macroprocessor getMP()
public final InputOutput getMPIO()
public final InputQueue getMPIQ()
public final Analyzer getMPAnalyzer()
public final MacroList getMPMacros()
public final java.lang.String getPrefix()
ConfigDirectives
public final java.lang.String setPrefix(java.lang.String newprefix)
newprefix
- new prefix for configuration directives
ConfigDirectives
public final int getDebugLevel()
public final void setDebugLevel(int level)
level
- level of debuggingpublic final boolean setDebugLevel(java.lang.String level)
level
- desired level as String
true
if level
parameter contains
valid valuepublic void debug(java.lang.Object message, int level)
public java.util.Locale getLocale()
public java.lang.String runMacro(CallStackItem item)
AbstractMacro.run(Macroprocessor,String[])
method
and returns result.
item
- object describing macro-call
public void importLibrary(java.lang.String name)
name
- name of librarypublic AbstractMacro loadFromClass(java.lang.String className)
AbstractMacro
. If something fails, warning is produced.
className
- name of class
null
if loading fails, otherwise instance of
loaded class.warning(String)
public final void error(java.lang.String msg)
ConfigDirectives.LAST_ERROR
is updated and given message is sent
to InputOutput object of this macroprocessor. This method terminates
macroprocessor by throwing FatalParserException
.
msg
- message textInputOutput.errorHandler(String)
public final void warning(java.lang.String msg)
ConfigDirectives.LAST_WARNING
is updated and given message is
sent to InputOutput object of this macroprocessor.
msg
- message textInputOutput.warningHandler(String)
public final void notice(java.lang.String msg)
ConfigDirectives.LAST_NOTICE
is updated and given message is sent
to InputOutput object of this macroprocessor.
msg
- message textInputOutput.noticeHandler(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |