org.prorefactor.treeparser01
Class TP01Support

java.lang.Object
  extended by org.prorefactor.treeparser01.TP01Action
      extended by org.prorefactor.treeparser01.TP01Support

public class TP01Support
extends TP01Action

Provides all functions called by TreeParser01. TreeParser01 does not, itself, define any actions. Instead, it only makes calls to the functions defined in this class.


Field Summary
 
Fields inherited from class org.prorefactor.treeparser01.TP01Action
parseUnit
 
Constructor Summary
TP01Support()
           
 
Method Summary
 void addToSymbolScope(java.lang.Object o)
          Called at the *end* of the statement that defines the symbol.
 void blockBegin(AST blockAST)
          Beginning of a block.
 void blockEnd()
          End of a block.
protected  void browseRef(AST idAST)
          The ID node in a BROWSE ID pair.
protected  void callBegin(AST callAST)
          Node where a call occurs, such as USER_FUNC or LOCAL_METHOD_REF.
protected  void callEnd()
          Triggered once the call's parameters have been processed.
protected  void canFindBegin(AST canfindAST, AST recordAST)
          A CAN-FIND needs to have its own buffer and buffer scope, because CAN-FIND(x where x.y = z) does *not* cause a buffer reference to be created for x within the surrounding block.
protected  void canFindEnd(AST canfindAST)
          Called by the tree parser at the end of a can-find.
protected  void classState(AST classAST)
          Called by the tree parser at the CLASS node.
protected  void clearState(AST headAST)
          Called at the end of a CLEAR statement.
protected  void datasetTable(AST tableAST)
          The RECORD_NAME node for a buffer in a DATASET definition.
protected  void defAs(AST asAST)
          The tree parser calls this at an AS node
protected  void defExtent(AST extentAST)
          Called at an EXTENT node, first child is an expression.
protected  Browse defineBrowse(AST defAST, AST idAST)
          Called at the start of a DEFINE BROWSE statement.
protected  void defineBuffer(AST defAST, AST idAST, AST tableAST, boolean init)
          Define a buffer.
protected  void defineBufferForTrigger(AST tableAST)
          Define an unnamed buffer which is scoped (symbol and buffer) to the trigger scope/block.
protected  Symbol defineSymbol(int symbolType, AST defAST, AST idAST)
          Called by the tree parser to define anything other than buffers, temp/work tables, and variables/parameters.
protected  void defineTable(JPNode defNode, JPNode idNode, int storeType)
           
protected  void defineTableFieldFinalize(java.lang.Object obj)
          Called by the tree parser at the end of a temp or work table field definition.
protected  java.lang.Object defineTableFieldInitialize(AST idAST)
          Defining a table field is done in two steps.
protected  void defineTableLike(AST tableAST)
          Called by the tree parser if a LIKE node is encountered in a temp/work table definition.
protected  void defineTemptable(AST defAST, AST idAST)
          Called by the tree parser when a temp-table is defined.
protected  Variable defineVariable(AST defAST, AST idAST)
          Called by the tree parser when a variable is defined.
protected  Variable defineVariable(AST defAST, AST idAST, int dataType)
          Some syntaxes imply a data type without LIKE/AS.
protected  void defineWorktable(AST defAST, AST idAST)
          Called by the tree parser when a work-table is defined.
protected  void defLike(AST likeAST)
          The tree parser calls this at a LIKE node
protected  void field(AST refAST, AST idAST, int contextQualifier, int whichTable)
          Process a Field_ref node.
protected  void fnvExpression(AST node)
          Called by the tree parser at filenameorvalue: VALUE(expression), passing in the expression node.
protected  void fnvFilename(AST node)
          Called by the tree parser for filenameorvalue: FILENAME production Partly implemented for Calls and Routines.
protected  void formItem(AST ast)
          Called from Form_item node
protected  void frameBlockCheck(AST ast)
          Called from DO|REPEAT|FOR blocks.
protected  void frameDef(AST defAST, AST idAST)
          Called at tree parser DEFINE FRAME statement.
protected  void frameEnablingStatement(AST ast)
          This is a specialization of frameInitializingStatement, called for ENABLE|UPDATE|PROMPT-FOR.
protected  void frameInitializingStatement(AST ast)
          This is called at the beginning of a frame affecting statement, with the statement head node.
protected  void frameRef(AST idAST)
          Called for the ID node in a #(FRAME ID) pair.
protected  void frameStatementEnd()
          This is called at the end of a frame affecting statement.
protected  void funcBegin(AST funcAST, AST idAST)
          Called immediately after the ID node in a FUNCTION statement/block.
protected  void funcDef(AST funcAST, AST idAST)
          Called by the tree parser in a function definition immediately before the code block begins.
protected  void funcEnd(AST funcAST)
           
protected  void funcForward(AST idAST)
          Called by the tree parser if a FUNCTION statement is found to be any sort of a function FORWARD, IN, or MAP TO.
 SymbolScope getCurrentScope()
           
 ErrorList getErrorList()
          Partly implemented for Calls and Routines.
 SymbolScopeRoot getRootScope()
           
protected  void lexat(AST fieldRefAST)
          Called at the Field_ref node after a lexical '@' sign in a frame phrase.
protected  void methodBegin(AST blockAST, AST idAST)
          Called by the tree parser at METHOD statement, after method's scope has been created.
protected  void methodEnd(AST blockAST)
           
protected  void paramBind()
          Called if there is a BIND keyword for a parameter.
protected  void paramEnd()
          Called at the end of the syntax for a formal arg or a Call's parameter.
protected  void paramExpression(AST exprAST)
          An expression being passed as a parameter (as part of a call).
protected  void paramForCall(AST directionAST)
          Called with the direction node (BUFFER|INPUT|OUTPUT|INPUTOUTPUT) for a new call arg.
protected  void paramForRoutine(AST directionAST)
          Called with the direction node (BUFFER|INPUT|OUTPUT|INPUTOUTPUT) for a new formal arg.
protected  void paramNoName(AST datatypeAST)
          Called for a parameter with no identifier.
protected  void paramProgressType(int progressType)
          Called by the treeparser to set the parameter progressType from default VARIABLE to either TEMPTABLE or DATASET.
protected  void paramSymbol(AST symbolAST)
          Called with the node that is linked to the Symbol for the current WIP parameter.
protected  Block popBlock()
           
protected  void procedureBegin(AST procAST, AST idAST)
          Called by the tree parser at the beginning of a PROCEDURESTATE rule.
protected  void procedureEnd(AST node)
          Called by the tree parser at the end of a PROCEDURESTATE rule.
protected  void programRoot(AST rootAST)
          Called by the tree parser right off the bat, at the Program_root node
protected  void programTail()
          Called by the tree parser at the end of the program, after Program_tail.
protected  Block pushBlock(Block block)
           
protected  void recordNameNode(AST anode, int contextQualifier)
          Action to take at various RECORD_NAME nodes.
protected  void routineReturnDatatype(AST datatypeAST)
          The datatype node or CLASS node for the return of a FUNCTION or METHOD.
protected  void runBegin(AST runAST)
          Called by the tree parser at the beginning of a RUN statement.
protected  void runEnd(AST node)
          Called by the tree parser in the RUN statement right before any parameters.
protected  void runInHandle(AST exprNode)
          Called by the tree parser for RUN IN HANDLE.
protected  void runPersistentSet(AST fld)
          Called by the tree parser for RUN PERSISTENT SET.
protected  void scopeAdd(AST anode)
          Called by the tree parser where a symbol scope needs to be added, in other words, in functions, procedures, and triggers.
protected  void scopeClose(AST scopeRootNode)
          Called by the tree parser immediately after the end of a function, procedure, or trigger block (a symbol scope).
protected  void setSymbol(int symbolType, AST idAST)
          Lookup and assign a symbol to an ID node.
protected  void strongScope(AST anode)
          Create a "strong" buffer scope.
protected  void structorBegin(AST blockAST)
          Constructor or destructor.
protected  void structorEnd(AST blockAST)
          End of constructor or destructor.
protected  void viewState(AST headAST)
          Called at the end of a VIEW statement.
 
Methods inherited from class org.prorefactor.treeparser01.TP01Action
getParseUnit, setParseUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TP01Support

public TP01Support()
Method Detail

addToSymbolScope

public void addToSymbolScope(java.lang.Object o)
Called at the *end* of the statement that defines the symbol.

Overrides:
addToSymbolScope in class TP01Action

blockBegin

public void blockBegin(AST blockAST)
Beginning of a block.

Overrides:
blockBegin in class TP01Action

blockEnd

public void blockEnd()
End of a block.

Overrides:
blockEnd in class TP01Action

browseRef

protected void browseRef(AST idAST)
The ID node in a BROWSE ID pair.

Overrides:
browseRef in class TP01Action

callBegin

protected void callBegin(AST callAST)
Description copied from class: TP01Action
Node where a call occurs, such as USER_FUNC or LOCAL_METHOD_REF.

Overrides:
callBegin in class TP01Action

callEnd

protected void callEnd()
Description copied from class: TP01Action
Triggered once the call's parameters have been processed.

Overrides:
callEnd in class TP01Action

canFindBegin

protected void canFindBegin(AST canfindAST,
                            AST recordAST)
A CAN-FIND needs to have its own buffer and buffer scope, because CAN-FIND(x where x.y = z) does *not* cause a buffer reference to be created for x within the surrounding block. (Ensuring that the x.y reference does not create a buffer reference was the tricky part.) Also note the behaviour of the 4GL: You can use an existing named buffer within a CAN-FIND, but of course the CAN-FIND does not move any pointers around. We accomplish this by making a local-scoped named buffer using that same name.

Overrides:
canFindBegin in class TP01Action

canFindEnd

protected void canFindEnd(AST canfindAST)
Description copied from class: TP01Action
Called by the tree parser at the end of a can-find.

Overrides:
canFindEnd in class TP01Action

classState

protected void classState(AST classAST)
Description copied from class: TP01Action
Called by the tree parser at the CLASS node.

Overrides:
classState in class TP01Action

clearState

protected void clearState(AST headAST)
Description copied from class: TP01Action
Called at the end of a CLEAR statement.

Overrides:
clearState in class TP01Action

datasetTable

protected void datasetTable(AST tableAST)
Description copied from class: TP01Action
The RECORD_NAME node for a buffer in a DATASET definition.

Overrides:
datasetTable in class TP01Action

defAs

protected void defAs(AST asAST)
The tree parser calls this at an AS node

Overrides:
defAs in class TP01Action

defExtent

protected void defExtent(AST extentAST)
Description copied from class: TP01Action
Called at an EXTENT node, first child is an expression.

Overrides:
defExtent in class TP01Action

defLike

protected void defLike(AST likeAST)
The tree parser calls this at a LIKE node

Overrides:
defLike in class TP01Action

defineBrowse

protected Browse defineBrowse(AST defAST,
                              AST idAST)
Called at the start of a DEFINE BROWSE statement.

Overrides:
defineBrowse in class TP01Action

defineBuffer

protected void defineBuffer(AST defAST,
                            AST idAST,
                            AST tableAST,
                            boolean init)
Define a buffer. If the buffer is initialized at the same time it is defined (as in a buffer parameter), then parameter init should be true.

Overrides:
defineBuffer in class TP01Action

defineBufferForTrigger

protected void defineBufferForTrigger(AST tableAST)
Define an unnamed buffer which is scoped (symbol and buffer) to the trigger scope/block.

Overrides:
defineBufferForTrigger in class TP01Action
Parameters:
tableAST - The RECORD_NAME node. Must already have the Table symbol linked to it.

defineSymbol

protected Symbol defineSymbol(int symbolType,
                              AST defAST,
                              AST idAST)
Description copied from class: TP01Action
Called by the tree parser to define anything other than buffers, temp/work tables, and variables/parameters.

Overrides:
defineSymbol in class TP01Action

defineTableFieldInitialize

protected java.lang.Object defineTableFieldInitialize(AST idAST)
Defining a table field is done in two steps. The first step creates the field and field buffer but does not assign the field to the table yet. The second step assigns the field to the table. We don't want the field assigned to the table until we're done examining the field options, because we don't want the field available for lookup due to situations like this: def temp-table tt1 field DependentCare like DependentCare.

Overrides:
defineTableFieldInitialize in class TP01Action
Returns:
The Object that is expected to be passed as an argument to defineTableFieldFinalize.
See Also:
defineTableFieldFinalize(Object)

defineTableFieldFinalize

protected void defineTableFieldFinalize(java.lang.Object obj)
Description copied from class: TP01Action
Called by the tree parser at the end of a temp or work table field definition.

Overrides:
defineTableFieldFinalize in class TP01Action

defineTableLike

protected void defineTableLike(AST tableAST)
Description copied from class: TP01Action
Called by the tree parser if a LIKE node is encountered in a temp/work table definition.

Overrides:
defineTableLike in class TP01Action

defineTable

protected void defineTable(JPNode defNode,
                           JPNode idNode,
                           int storeType)

defineTemptable

protected void defineTemptable(AST defAST,
                               AST idAST)
Description copied from class: TP01Action
Called by the tree parser when a temp-table is defined.

Overrides:
defineTemptable in class TP01Action

defineVariable

protected Variable defineVariable(AST defAST,
                                  AST idAST)
Description copied from class: TP01Action
Called by the tree parser when a variable is defined.

Overrides:
defineVariable in class TP01Action

defineVariable

protected Variable defineVariable(AST defAST,
                                  AST idAST,
                                  int dataType)
Description copied from class: TP01Action
Some syntaxes imply a data type without LIKE/AS.

Overrides:
defineVariable in class TP01Action

defineWorktable

protected void defineWorktable(AST defAST,
                               AST idAST)
Description copied from class: TP01Action
Called by the tree parser when a work-table is defined.

Overrides:
defineWorktable in class TP01Action

field

protected void field(AST refAST,
                     AST idAST,
                     int contextQualifier,
                     int whichTable)
Process a Field_ref node.

Overrides:
field in class TP01Action
Parameters:
refAST - The Field_ref node.
idAST - The ID node.
contextQualifier - What sort of reference is this? Read? Update? Etc.
-
whichTable - For name resolution - which table must this be a field of? Input 0 for any table, 1 for the lastTableReferenced, 2 for the prevTableReferenced.

fnvExpression

protected void fnvExpression(AST node)
Called by the tree parser at filenameorvalue: VALUE(expression), passing in the expression node. Partly implemented for Calls and Routines.

Overrides:
fnvExpression in class TP01Action

fnvFilename

protected void fnvFilename(AST node)
Called by the tree parser for filenameorvalue: FILENAME production Partly implemented for Calls and Routines.

Overrides:
fnvFilename in class TP01Action

formItem

protected void formItem(AST ast)
Called from Form_item node

Overrides:
formItem in class TP01Action

frameBlockCheck

protected void frameBlockCheck(AST ast)
Called from DO|REPEAT|FOR blocks.

Overrides:
frameBlockCheck in class TP01Action

frameDef

protected void frameDef(AST defAST,
                        AST idAST)
Called at tree parser DEFINE FRAME statement.

Overrides:
frameDef in class TP01Action

frameEnablingStatement

protected void frameEnablingStatement(AST ast)
This is a specialization of frameInitializingStatement, called for ENABLE|UPDATE|PROMPT-FOR.

Overrides:
frameEnablingStatement in class TP01Action

frameInitializingStatement

protected void frameInitializingStatement(AST ast)
This is called at the beginning of a frame affecting statement, with the statement head node.

Overrides:
frameInitializingStatement in class TP01Action

frameStatementEnd

protected void frameStatementEnd()
This is called at the end of a frame affecting statement.

Overrides:
frameStatementEnd in class TP01Action

frameRef

protected void frameRef(AST idAST)
Description copied from class: TP01Action
Called for the ID node in a #(FRAME ID) pair.

Overrides:
frameRef in class TP01Action

funcBegin

protected void funcBegin(AST funcAST,
                         AST idAST)
Description copied from class: TP01Action
Called immediately after the ID node in a FUNCTION statement/block.

Overrides:
funcBegin in class TP01Action

funcDef

protected void funcDef(AST funcAST,
                       AST idAST)
Description copied from class: TP01Action
Called by the tree parser in a function definition immediately before the code block begins.

Overrides:
funcDef in class TP01Action
Parameters:
funcAST - The FUNCTION node.
idAST - The ID node (the function name).

funcEnd

protected void funcEnd(AST funcAST)
Overrides:
funcEnd in class TP01Action

funcForward

protected void funcForward(AST idAST)
Description copied from class: TP01Action
Called by the tree parser if a FUNCTION statement is found to be any sort of a function FORWARD, IN, or MAP TO.

Overrides:
funcForward in class TP01Action
Parameters:
idAST - The ID node (name of the function).

getCurrentScope

public SymbolScope getCurrentScope()

getErrorList

public ErrorList getErrorList()
Partly implemented for Calls and Routines.


getRootScope

public SymbolScopeRoot getRootScope()

lexat

protected void lexat(AST fieldRefAST)
Description copied from class: TP01Action
Called at the Field_ref node after a lexical '@' sign in a frame phrase.

Overrides:
lexat in class TP01Action

methodBegin

protected void methodBegin(AST blockAST,
                           AST idAST)
Description copied from class: TP01Action
Called by the tree parser at METHOD statement, after method's scope has been created.

Overrides:
methodBegin in class TP01Action

methodEnd

protected void methodEnd(AST blockAST)
Overrides:
methodEnd in class TP01Action

paramBind

protected void paramBind()
Description copied from class: TP01Action
Called if there is a BIND keyword for a parameter.

Overrides:
paramBind in class TP01Action

paramEnd

protected void paramEnd()
Description copied from class: TP01Action
Called at the end of the syntax for a formal arg or a Call's parameter.

Overrides:
paramEnd in class TP01Action

paramExpression

protected void paramExpression(AST exprAST)
Description copied from class: TP01Action
An expression being passed as a parameter (as part of a call).

Overrides:
paramExpression in class TP01Action

paramForCall

protected void paramForCall(AST directionAST)
Description copied from class: TP01Action
Called with the direction node (BUFFER|INPUT|OUTPUT|INPUTOUTPUT) for a new call arg.

Overrides:
paramForCall in class TP01Action

paramForRoutine

protected void paramForRoutine(AST directionAST)
Description copied from class: TP01Action
Called with the direction node (BUFFER|INPUT|OUTPUT|INPUTOUTPUT) for a new formal arg.

Overrides:
paramForRoutine in class TP01Action

paramNoName

protected void paramNoName(AST datatypeAST)
Called for a parameter with no identifier. You may have a parameter that has no name, which means that it is a formal argument that is unused in the function/method. (Also possible in some calls to specify {ID AS datatype}.) However, we *do* need to have a WIP Symbol that can be assigned to the Parameter object, get any EXTENT assigned to it, etc.

Overrides:
paramNoName in class TP01Action
Parameters:
datatypeAST - The node of the datatype, might be a CLASS node.

paramProgressType

protected void paramProgressType(int progressType)
Description copied from class: TP01Action
Called by the treeparser to set the parameter progressType from default VARIABLE to either TEMPTABLE or DATASET.

Overrides:
paramProgressType in class TP01Action

paramSymbol

protected void paramSymbol(AST symbolAST)
Description copied from class: TP01Action
Called with the node that is linked to the Symbol for the current WIP parameter.

Overrides:
paramSymbol in class TP01Action

popBlock

protected Block popBlock()

procedureBegin

protected void procedureBegin(AST procAST,
                              AST idAST)
Description copied from class: TP01Action
Called by the tree parser at the beginning of a PROCEDURESTATE rule.

Overrides:
procedureBegin in class TP01Action

procedureEnd

protected void procedureEnd(AST node)
Description copied from class: TP01Action
Called by the tree parser at the end of a PROCEDURESTATE rule.

Overrides:
procedureEnd in class TP01Action

programRoot

protected void programRoot(AST rootAST)
Description copied from class: TP01Action
Called by the tree parser right off the bat, at the Program_root node

Overrides:
programRoot in class TP01Action

programTail

protected void programTail()
Description copied from class: TP01Action
Called by the tree parser at the end of the program, after Program_tail.

Overrides:
programTail in class TP01Action

pushBlock

protected Block pushBlock(Block block)

recordNameNode

protected void recordNameNode(AST anode,
                              int contextQualifier)
Action to take at various RECORD_NAME nodes.

Overrides:
recordNameNode in class TP01Action

routineReturnDatatype

protected void routineReturnDatatype(AST datatypeAST)
Description copied from class: TP01Action
The datatype node or CLASS node for the return of a FUNCTION or METHOD.

Overrides:
routineReturnDatatype in class TP01Action

runBegin

protected void runBegin(AST runAST)
Called by the tree parser at the beginning of a RUN statement.

Overrides:
runBegin in class TP01Action

runEnd

protected void runEnd(AST node)
Called by the tree parser in the RUN statement right before any parameters.

Overrides:
runEnd in class TP01Action

runInHandle

protected void runInHandle(AST exprNode)
Called by the tree parser for RUN IN HANDLE. Get the RunHandle value in "run in ." Where is a handle valued Expression; then save the RunHandle value in the current call. Partly implemented for Calls and Routines.

Overrides:
runInHandle in class TP01Action
Parameters:
exprNode - - the node for .

runPersistentSet

protected void runPersistentSet(AST fld)
Called by the tree parser for RUN PERSISTENT SET. Update the in "run persistent set .": save a reference to the external procedure in . The AST structure for this form of the run is: runstate : #( RUN filenameorvalue (#(PERSISTENT ( #(SET (field)? ) )? ) where is this action. Thus, we expect a value in wipFieldNode with the name of the handle variable. This method gets the variable from the current scope and stores a reference to it in the current call (being built), so that the Call.finalize method can update its value. Partly implemented for Calls and Routines.

Overrides:
runPersistentSet in class TP01Action
Parameters:
fld - is used for error reporting.

scopeAdd

protected void scopeAdd(AST anode)
Description copied from class: TP01Action
Called by the tree parser where a symbol scope needs to be added, in other words, in functions, procedures, and triggers.

Overrides:
scopeAdd in class TP01Action
Parameters:
anode - The function, procedure, triggers, or on node.

scopeClose

protected void scopeClose(AST scopeRootNode)
Description copied from class: TP01Action
Called by the tree parser immediately after the end of a function, procedure, or trigger block (a symbol scope).

Overrides:
scopeClose in class TP01Action
Parameters:
scopeRootNode - The function, procedure, triggers, or on node.

setSymbol

protected void setSymbol(int symbolType,
                         AST idAST)
Description copied from class: TP01Action
Lookup and assign a symbol to an ID node.

Overrides:
setSymbol in class TP01Action

strongScope

protected void strongScope(AST anode)
Create a "strong" buffer scope. This is called within a DO FOR or REPEAT FOR statement.

Overrides:
strongScope in class TP01Action
Parameters:
anode - Is the RECORD_NAME node. It must already have the BufferSymbol linked to it.

structorBegin

protected void structorBegin(AST blockAST)
Constructor or destructor.

Overrides:
structorBegin in class TP01Action

structorEnd

protected void structorEnd(AST blockAST)
End of constructor or destructor.

Overrides:
structorEnd in class TP01Action

viewState

protected void viewState(AST headAST)
Called at the end of a VIEW statement.

Overrides:
viewState in class TP01Action


Copyright © 2008 Joanju Software. All Rights Reserved.