|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hawk.module.script.ScriptInterpreter
public class ScriptInterpreter
This parses the hawk script and runs the same. This reads through the hawk file and parses the function definition and hence creates the function script out of them. The function script contains all the scripts written inside the function definition.
This is the place where all the global variables and aliases are stored.
This parses through target application's IModule implementations to cache all the modules IModule and subtask SubTaskContainer Note: The developer has to annotate the tasks with SubTask to register with Hawk framework as subtask failing to which Hawk will ignore the same.
ScriptUsage
,
IModule
,
SubTaskContainer
,
SubTask
Field Summary | |
---|---|
protected java.util.Map<Variable,IScript> |
globalVariableTable
Global map containing global var and its value |
Method Summary | |
---|---|
boolean |
cacheAliases()
|
java.util.Map<java.lang.String,FunctionScript> |
cacheFunctionScriptMap()
This caches the function script map |
java.util.Map<java.lang.String,FunctionScript> |
cacheFunctionScriptMap(boolean shouldParseDetails)
This caches the function script map |
boolean |
cacheGlobalVariable()
This caches all the global variables declared |
java.util.Map<java.lang.String,StructureDefnScript> |
cacheStructureDefnMap()
This caches the structure definition |
java.util.Map<IModule,java.util.Map<java.lang.String,SubTaskContainer>> |
cacheSubTasks()
This caches the subtasks implemented by the user using SubTask. |
FunctionScript |
cloneFunctionScript(FunctionScript functionScript)
This clones input FunctionScript. |
boolean |
compile(java.lang.String scriptFile)
This parses the hawk script file for syntax check. |
boolean |
createFunctionScript(java.lang.String functionName,
FunctionScript functionScript)
|
boolean |
doesStructExist(java.lang.String structName)
This checks if structName is defined in the hawk script |
boolean |
doesStructMemberExist(java.lang.String structName,
java.lang.String structMember)
This checks if a structName and it's member structMember are defined in the hawk script |
FunctionScript |
findFunctionScript(java.lang.String mangledFunctionName)
This finds the FunctionScript for the input mangled function name When invoked in threads other than main thread, this method clones the function script and returns the same. |
java.util.Map<java.lang.String,FunctionScript> |
getFunctionScriptMap()
This returns the cached function->FunctionScript map. |
IScript |
getGlobalValue(java.lang.String globalVar)
Getter for global variable |
static ScriptInterpreter |
getInstance()
SingleTon accessor method of ScriptInterpreter |
java.util.Map<java.lang.Integer,java.lang.String> |
getScriptMap()
|
java.util.Set<SubTaskContainer> |
getSortedSubTasks(IModule module)
This returns Set the subtasks of a module sorted on the sequence number. |
java.util.Map<java.lang.String,StructureDefnScript> |
getStructureDefnMap()
This returns the cached structure->StructureDefnScript map. |
java.util.Map<IModule,java.util.Map<java.lang.String,SubTaskContainer>> |
getSubTasks()
This returns the cached module->subtask map. |
boolean |
interpret()
This interprets the hawk script file. |
boolean |
isGlobalVarDeclared(Variable globalVar)
Checks whether this global variable is declared. |
boolean |
isInsideMultiLineScript(int i)
|
static void |
main(java.lang.String[] args)
Entry point of hawk script interpretation |
java.util.Map<java.lang.String,FunctionScript> |
parseFunctionScriptMap()
|
void |
setGlobalValue(Variable globalVar,
IScript globalValue)
Setter for global variable |
void |
setScriptMap(java.util.Map<java.lang.Integer,java.lang.String> scriptMap)
|
void |
unsetGlobalValue(java.lang.String globalVar)
Removes the global variable from the global variable map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<Variable,IScript> globalVariableTable
VariableDeclScript
Method Detail |
---|
public static ScriptInterpreter getInstance()
public java.util.Map<java.lang.Integer,java.lang.String> getScriptMap()
public void setScriptMap(java.util.Map<java.lang.Integer,java.lang.String> scriptMap)
public IScript getGlobalValue(java.lang.String globalVar)
globalVar
-
public void setGlobalValue(Variable globalVar, IScript globalValue)
globalVar
- globalValue
- public void unsetGlobalValue(java.lang.String globalVar)
globalVar
- the variable to be removed.public boolean isGlobalVarDeclared(Variable globalVar)
globalVar
-
public java.util.Map<IModule,java.util.Map<java.lang.String,SubTaskContainer>> cacheSubTasks()
public java.util.Map<IModule,java.util.Map<java.lang.String,SubTaskContainer>> getSubTasks()
cacheSubTasks()
public java.util.Set<SubTaskContainer> getSortedSubTasks(IModule module) throws HawkException
Set
the subtasks of a module sorted on the sequence number.
module
- for which sorted tasks are required.
Set
the subtasks of a module sorted on the sequence number.
HawkException
public java.util.Map<java.lang.String,StructureDefnScript> cacheStructureDefnMap() throws HawkException
HawkException
StructureDefnScript
public boolean doesStructExist(java.lang.String structName) throws HawkException
structName
-
HawkException
public boolean doesStructMemberExist(java.lang.String structName, java.lang.String structMember) throws HawkException
structName
- structMember
-
HawkException
public java.util.Map<java.lang.String,StructureDefnScript> getStructureDefnMap() throws HawkException
cacheStructureDefnMap()
HawkException
public FunctionScript cloneFunctionScript(FunctionScript functionScript)
functionScript
-
ExecParallelSingleLineScript
public java.util.Map<java.lang.String,FunctionScript> parseFunctionScriptMap() throws HawkException
HawkException
public boolean cacheAliases() throws HawkException
HawkException
public java.util.Map<java.lang.String,FunctionScript> cacheFunctionScriptMap() throws HawkException
HawkException
FunctionScript
public java.util.Map<java.lang.String,FunctionScript> cacheFunctionScriptMap(boolean shouldParseDetails) throws HawkException
HawkException
FunctionScript
public boolean createFunctionScript(java.lang.String functionName, FunctionScript functionScript) throws HawkException
HawkException
public FunctionScript findFunctionScript(java.lang.String mangledFunctionName) throws HawkException
mangledFunctionName
-
HawkException
FunctionScript
public java.util.Map<java.lang.String,FunctionScript> getFunctionScriptMap() throws HawkException
cacheFunctionScriptMap()
HawkException
public boolean cacheGlobalVariable() throws HawkException
HawkException
public boolean isInsideMultiLineScript(int i)
public boolean interpret() throws HawkException
HawkException
- if there is no main function defined in hawk script
or if the script is not interpretable.public boolean compile(java.lang.String scriptFile) throws HawkException
scriptFile
- hawk script file
HawkException
- if it is not valid hawk script filepublic static void main(java.lang.String[] args)
args
- command line arguments as per java standards
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |