Namespace: Consultingwerk.Studio.Proparse
Class 
ProparseHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:ProparseHelper
Purpose:Provides advanced routines to analyse the Proparse AST
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Tue Jun 28 20:14:06 CEST 2011
Notes:http://www.joanju.com/analyst/javadoc/



Top Method Summary
Options Name Purpose
+ LOGICAL ExistsChildNodeByPath (JPNode, character) Returns if the child node with the given node path exists
+ ExportDatabaseSchema () Exports the Database Schema to Proparse
+ org.prorefactor.core.JPNode FindChildNodeOfNodeType (JPNode, character) Searches for a child node of the given node with the matching node type
+ org.prorefactor.core.JPNode FindChildNodeOfNodeTypeWithID (JPNode, character, character) Searches for a child node of the given node with the matching node type and ID childnode text
+ org.prorefactor.core.JPNode FindChildNodeOfNodeTypeWithText (JPNode, character, character) Searches for a child node of the given node with the matching node type and text
+ org.prorefactor.core.JPNode FindFirstChildByPositionInCode (JPNode) Returns the first JPNode in a AST by position
+ org.prorefactor.core.JPNode FindRoutineParent (JPNode) Finds the Routine-Level Block that contains the given JPNode
+ Consultingwerk.BufferFieldName GetBufferFieldName (FieldRefNode) Returns a BufferFieldName based on the given FieldRefNode instance
+ org.prorefactor.core.JPNode GetChildNodeByPath (JPNode, character) Returns the reference to the child node with the given node path
+ CHARACTER GetFullNodeText (JPNode) Returns the full text of the Node
+ CHARACTER GetIdNodeText (JPNode) Returns the text of the ID node below the given Node
# GetInternalRunStatements (JPNode) Returns a temp-table with all interal RUN statements in the given node (typically the Root node of a parse unit)
+ GetInternalRunStatements (JPNode, table) Returns a temp-table with all interal RUN statements in the given node (typically the Root node of a parse unit)
+ GetNodeChildren (JPNode, List) Returns the List with all children (direct and indirect added)
+ GetNodeChildrenOfNodeType (JPNode, character, List) Returns the List with all children of the given node type (direct and indirect added)
+ org.prorefactor.core.JPNode GetNodeFromNum (integer) Gets a Node by it's number
+ INTEGER GetRoutineDepth (JPNode) Returns the block level relative to the next Routine-Level Block for the given JPNode
+ CHARACTER GetSubtypeName (integer) Returns the Subtype name based on Proparse's SubType Index
+ LOGICAL HasChildNodeOfNodeType (JPNode, character) Searches for a Childnode of the given node with the matching node type
+ LOGICAL HasChildNodeOfNodeTypeWithID (JPNode, character, character) Searches for a Childnode of the given node with the matching node type and ID childnode text
+ LOGICAL HasChildNodeOfNodeTypeWithText (JPNode, character, character) Searches for a Childnode of the given node with the matching node type and text
+ Initialize () Initializes propase
+ INTEGER NumChildNodeOfNodeType (JPNode, character) Returns the number of child nodes of the given node with the matching node type
+ INTEGER NumChildren (JPNode) Returns the number of direct child nodes of the given JPNode
+ LOGICAL ParentIsTrivialDo (JPNode) Returns if the parent of the given JPNode is a simple DO: block (without any condision, e.g. DO WITH FRAME:)
+ org.prorefactor.treeparser.ParseUnit ParseFile (character) Parses a file and returns the reference to the ParseUnit
+ CHARACTER ParseParameterList (JPNode) Parses the Parameter_list of a Method/Function/Event/Constructor node
+ CHARACTER ParseParameterList (JPNode, logical) Parses the Parameter_list of a Method/Function/Event/Constructor node
+ CHARACTER ParseProcedureParameterList (JPNode) Parses the Parameter_list of a procedure (internal or external) node
+ CHARACTER ParseProcedureParameterList (JPNode, logical) Parses the Parameter_list of a procedure (internal or external) node
+ CHARACTER ParserConfigGet (character) Returns a parser configuration parameter
+ LOGICAL ParserConfigSet (character, character) Sets a proparse configuration parameter (propath, proversion)
+ org.prorefactor.treeparser.ParseUnit ParseString (longchar) Parses the passed in String
+ ReplaceIndividualNode (JPNode, longchar) Replaces a routine node (METHOD, CONSTRUCTOR, ...) with the given text
+ ReplaceRoutineNode (JPNode, longchar, logical, logical) Replaces a routine node (METHOD, CONSTRUCTOR, ...) with the given text
+ SetProparseEnvironment () Set's OpenEdge session enviroment in proparse
+ CHARACTER TriggerCompleteEventList (JPNode) Returns the complete trigger Event_list node of a Trigger node
+ CHARACTER TriggerEventList (JPNode) Returns the Text of the Event_list node of a Trigger node
+ CHARACTER TriggerWidgetRef (JPNode) Returns the Text of the Widget_ref node of a Trigger node

Top Constructor Summary
Options Name Purpose
- ProparseHelper () Disallow instance creation
ProparseHelper () Static Constructor of the ProparseHelper class

Top Property Summary
Options Name Purpose
+ LOGICAL Initialized


Method Detail
Top

PUBLIC LOGICAL ExistsChildNodeByPath (JPNode, character)

Purpose: Returns if the child node with the given node path exists
Notes: Pathes are separated either by / or \
Supported path references, samples
EQUAL\Field_ref\ID returns the ID node of an assignment
RECORD_NAME\WHERE\AND\AND\2\QSTRING - The quoted string "b" in FOR EACH Customer WHERE Customer.Name BEGINS "Lift" AND Customer.City BEGINS "b" AND Customer.Country = "USA": (the second node, a BEGINS is referenced by the 2)
2 - returns the second child of the parent node

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the parent JPNode
pcPath CHARACTER
The path reference
Returns LOGICAL
Logical value indicating if the child node with the given path exists
Top

PUBLIC ExportDatabaseSchema ()

Purpose: Exports the Database Schema to Proparse
Notes: Will only export the database schema to proparse when there are new
databases connected or new aliases defined

Top

PUBLIC org.prorefactor.core.JPNode FindChildNodeOfNodeType (JPNode, character)

Purpose: Searches for a child node of the given node with the matching node type
Notes: This method does not work recursively, so only direct child nodes are
processed

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child not type as returned by NodeTypes:getTypeName
Returns org.prorefactor.core.JPNode
The found JPNode or the unknown value
Top

PUBLIC org.prorefactor.core.JPNode FindChildNodeOfNodeTypeWithID (JPNode, character, character)

Purpose: Searches for a child node of the given node with the matching node type
and ID childnode text
Notes: This method does not work recursively, so only direct child nodes are
processed
Useful for finding

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child node type as returned by NodeTypes:getTypeName
pcChildNodeID CHARACTER
The searched child node ID node value
Returns org.prorefactor.core.JPNode
The found JPNode or the unknown value
Top

PUBLIC org.prorefactor.core.JPNode FindChildNodeOfNodeTypeWithText (JPNode, character, character)

Purpose: Searches for a child node of the given node with the matching node type
and text
Notes: This method does not work recursively, so only direct child nodes are
processed
Useful for finding Annotations with getText() = "@Annotation"

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child node type as returned by NodeTypes:getTypeName
pcChildNodeText CHARACTER
The searched child node getText() value
Returns org.prorefactor.core.JPNode
The found JPNode or the unknown value
Top

PUBLIC org.prorefactor.core.JPNode FindFirstChildByPositionInCode (JPNode)

Purpose: Returns the first JPNode in a AST by position
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The parent JPNode
Returns org.prorefactor.core.JPNode
The found JPNode or the unknown value
Top

PUBLIC org.prorefactor.core.JPNode FindRoutineParent (JPNode)

Purpose: Finds the Routine-Level Block that contains the given JPNode
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to return the reference to the routine-level block for
Returns org.prorefactor.core.JPNode
The JPNode that describes the routine-level block for the given JPNode
Top

PUBLIC Consultingwerk.BufferFieldName GetBufferFieldName (FieldRefNode)

Purpose: Returns a BufferFieldName based on the given FieldRefNode instance
Notes:

Parameters:
poFieldNode org.prorefactor.nodetypes.FieldRefNode
The FieldRefNode to parse
Returns Consultingwerk.BufferFieldName
The BufferFieldName with the data of the FieldRefNode
Top

PUBLIC org.prorefactor.core.JPNode GetChildNodeByPath (JPNode, character)

Purpose: Returns the reference to the child node with the given node path
Notes: Pathes are separated either by / or \
Supported path references, samples
EQUAL\Field_ref\ID returns the ID node of an assignment
RECORD_NAME\WHERE\AND\AND\2\QSTRING - The quoted string "b" in FOR EACH Customer WHERE Customer.Name BEGINS "Lift" AND Customer.City BEGINS "b" AND Customer.Country = "USA": (the second node, a BEGINS is referenced by the 2)
2 - returns the second child of the parent node

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the parent JPNode
pcPath CHARACTER
The path reference
Returns org.prorefactor.core.JPNode
The reference to the child JPNode with the given node path
Top

PUBLIC CHARACTER GetFullNodeText (JPNode)

Purpose: Returns the full text of the Node
Notes: Similar to the JPNode:toStringFullText() implementation,
but without the leading comments and white space characters

Parameters:
poNode org.prorefactor.core.JPNode
The node to return the full text of
Returns CHARACTER
The full text of the node
Top

PUBLIC CHARACTER GetIdNodeText (JPNode)

Purpose: Returns the text of the ID node below the given Node
Notes: Returns ? when the given node does not contain an ID Node

Parameters:
poNode org.prorefactor.core.JPNode
: character
Returns CHARACTER
The Text valud of the ID node below the given node or ?
Top

PROTECTED GetInternalRunStatements (JPNode)

Purpose: Returns a temp-table with all interal RUN statements in the given
node (typically the Root node of a parse unit)
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The node to parse
Top

PUBLIC GetInternalRunStatements (JPNode, table)

Purpose: Returns a temp-table with all interal RUN statements in the given
node (typically the Root node of a parse unit)
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The node to parse
ttRunStatements TEMP-TABLE ttRunStatements
The temp-table with the located run statements (from Consultingwerk/Studio/Proparse/ttRunStatements.i)
Top

PUBLIC GetNodeChildren (JPNode, List)

Purpose: Returns the List with all children (direct and indirect added)
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The parent JPNode
poNodes System.Collections.Generic.List
The generic List of JPNode object
Top

PUBLIC GetNodeChildrenOfNodeType (JPNode, character, List)

Purpose: Returns the List with all children of the given node type
(direct and indirect added)
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The parent JPNode
pcNodeType CHARACTER
The node type to add
poNodes System.Collections.Generic.List
The generic List of JPNode object
Top

PUBLIC org.prorefactor.core.JPNode GetNodeFromNum (integer)

Purpose: Gets a Node by it's number
Notes:

Parameters:
piNodeNum INTEGER
The node number to return
Returns org.prorefactor.core.JPNode
The JPNode with the specified number
Top

PUBLIC INTEGER GetRoutineDepth (JPNode)

Purpose: Returns the block level relative to the next Routine-Level Block
for the given JPNode
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to return the block level for
Returns INTEGER
Block level relatively to the parent node
Top

PUBLIC CHARACTER GetSubtypeName (integer)

Purpose: Returns the Subtype name based on Proparse's SubType Index
Notes:

Parameters:
piSubtypeIndex INTEGER
The index of the subtype as returns from the JPNode
Returns CHARACTER
The CHARACTER SubtypeName
Top

PUBLIC LOGICAL HasChildNodeOfNodeType (JPNode, character)

Purpose: Searches for a Childnode of the given node with the matching node type
Notes:

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child not type as returned by NodeTypes:getTypeName
Returns LOGICAL
True when a child node with the given node type exists
Top

PUBLIC LOGICAL HasChildNodeOfNodeTypeWithID (JPNode, character, character)

Purpose: Searches for a Childnode of the given node with the matching node type
and ID childnode text
Notes: Useful for finding PROCEDURE with a certain name etc.

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child not type as returned by NodeTypes:getTypeName
pcChildNodeID CHARACTER
The searched child node ID node value
Returns LOGICAL
True when a child node with the given node type exists
Top

PUBLIC LOGICAL HasChildNodeOfNodeTypeWithText (JPNode, character, character)

Purpose: Searches for a Childnode of the given node with the matching node type
and text
Notes: Useful for finding Annotations with getText() = "@Annotation"

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child not type as returned by NodeTypes:getTypeName
pcChildNodeText CHARACTER
The searched child node getText() value
Returns LOGICAL
True when a child node with the given node type exists
Top

PUBLIC Initialize ()

Purpose: Initializes propase
Notes:

Top

PUBLIC INTEGER NumChildNodeOfNodeType (JPNode, character)

Purpose: Returns the number of child nodes of the given node with the matching
node type
Notes: This method does not work recursively, so only direct child nodes are
counted

Parameters:
poASTNode org.prorefactor.core.JPNode
The parent JPNode
pcChildNodeType CHARACTER
The searched child not type as returned by NodeTypes:getTypeName
Returns INTEGER
The number of child nodes with the given type
Top

PUBLIC INTEGER NumChildren (JPNode)

Purpose: Returns the number of direct child nodes of the given JPNode
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to return the number of children of
Returns INTEGER
The number of direct child nods
Top

PUBLIC LOGICAL ParentIsTrivialDo (JPNode)

Purpose: Returns if the parent of the given JPNode is a simple DO: block
(without any condision, e.g. DO WITH FRAME:)
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to test the parent block of
Returns LOGICAL
Logical value indicating if the parent of the given node is a trivial DO block
Top

PUBLIC org.prorefactor.treeparser.ParseUnit ParseFile (character)

Purpose: Parses a file and returns the reference to the ParseUnit
Notes:

Parameters:
pcFilename CHARACTER
The CHARACTER FileName to be used to open the java.io.File
Returns org.prorefactor.treeparser.ParseUnit
The proparse ParseUnit reference
Top

PUBLIC CHARACTER ParseParameterList (JPNode)

Purpose: Parses the Parameter_list of a Method/Function/Event/Constructor
node
Notes: Returns a value in the form "INPUT CHARACTER,OUTPUT INTEGER,OUTPUT DATASET-HANDLE"

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the JPNode of the Method/Function/Event/Constructor
Returns CHARACTER
The Character representation of the Parameter list
Top

PUBLIC CHARACTER ParseParameterList (JPNode, logical)

Purpose: Parses the Parameter_list of a Method/Function/Event/Constructor
node
Notes: Returns a value in the form "INPUT CHARACTER,OUTPUT INTEGER,OUTPUT DATASET-HANDLE"

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the JPNode of the Method/Function/Event/Constructor
plIncludeParameterName LOGICAL
Logical value indicating if the parameter name should be included as well
Returns CHARACTER
The Character representation of the Parameter list
Top

PUBLIC CHARACTER ParseProcedureParameterList (JPNode)

Purpose: Parses the Parameter_list of a procedure (internal or external) node
Notes: Returns a value in the form "INPUT CHARACTER,OUTPUT INTEGER,OUTPUT DATASET-HANDLE"

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the JPNode of the Procedure or Program_root
Returns CHARACTER
The Character representation of the Parameter list
Top

PUBLIC CHARACTER ParseProcedureParameterList (JPNode, logical)

Purpose: Parses the Parameter_list of a procedure (internal or external) node
Notes: Returns a value in the form "INPUT CHARACTER,OUTPUT INTEGER,OUTPUT DATASET-HANDLE"

Parameters:
poParentNode org.prorefactor.core.JPNode
The reference to the JPNode of the Procedure or Program_root
plIncludeParameterName LOGICAL
Logical value indicating if the parameter name should be included as well
Returns CHARACTER
The Character representation of the Parameter list
Top

PUBLIC CHARACTER ParserConfigGet (character)

Purpose: Returns a parser configuration parameter
Notes:

Parameters:
pcFlag CHARACTER
The name of a proparse config flag
Returns CHARACTER
The CHARACTER value of the Proparse config value
Top

PUBLIC LOGICAL ParserConfigSet (character, character)

Purpose: Sets a proparse configuration parameter (propath, proversion)
Notes:

Parameters:
pcFlag CHARACTER
The name of a proparse config flag
pcValue CHARACTER
The value for the proparse config flag
Returns LOGICAL
Always TRUE
Top

PUBLIC org.prorefactor.treeparser.ParseUnit ParseString (longchar)

Purpose: Parses the passed in String
Notes: Writes the string to a temporary file for parsing. The temporary file
name will be

Parameters:
plcString LONGCHAR
The LONGCHAR String to parse
Returns org.prorefactor.treeparser.ParseUnit
The proparse ParseUnit reference
Top

PUBLIC ReplaceIndividualNode (JPNode, longchar)

Purpose: Replaces a routine node (METHOD, CONSTRUCTOR, ...) with the given
text
Notes: Should not be called more than onces for a given Parse Unit as by replacing
a routine node all following line counts may become inaccurate
Really only replaces the text of the given node and not any nested nodes

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
plcNewText LONGCHAR
The new text for the node
Top

PUBLIC ReplaceRoutineNode (JPNode, longchar, logical, logical)

Purpose: Replaces a routine node (METHOD, CONSTRUCTOR, ...) with the given
text
Notes: Should not be called more than onces for a given Parse Unit as by replacing
a routine node all following line counts may become inaccurate
Optionally replaces the comments block (a single block) or any white
spaces that preceedes the method block.
When replacing all white spaces preceeding the routine node
(plReplaceAllLeadingHiddenText = TRUE) it is recommended, to start
the plcNewText with two new lines (~n~n)

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
plcNewText LONGCHAR
The new text for the node
plReplaceComments LOGICAL
Replaces comments preceeding the node
plReplaceAllLeadingHiddenText LOGICAL
Replaces comments and all white spaces preceeding the node
Top

PUBLIC SetProparseEnvironment ()

Purpose: Set's OpenEdge session enviroment in proparse
Notes:

Top

PUBLIC CHARACTER TriggerCompleteEventList (JPNode)

Purpose: Returns the complete trigger Event_list node of a Trigger node
Notes: Returns "":U if no Event_list node is present, comma-delimited

Parameters:
poASTNode org.prorefactor.core.JPNode
The JPNode of the Trigger itself (ON / Blocknode)
Returns CHARACTER
The Text of the Event_list node
Top

PUBLIC CHARACTER TriggerEventList (JPNode)

Purpose: Returns the Text of the Event_list node of a Trigger node
Notes: Returns "":U if no Event_list node is present

Parameters:
poASTNode org.prorefactor.core.JPNode
The JPNode of the Trigger itself (ON / Blocknode)
Returns CHARACTER
The Text of the Event_list node
Top

PUBLIC CHARACTER TriggerWidgetRef (JPNode)

Purpose: Returns the Text of the Widget_ref node of a Trigger node
Notes: Returns "":U if no Widget_ref node is present, drills down into the
Field_ref node if present (for UI widgets)

Parameters:
poASTNode org.prorefactor.core.JPNode
The JPNode of the Trigger itself (ON / Blocknode)
Returns CHARACTER
The Text of the Widget_ref node


Constructor Detail
Top

PRIVATE ProparseHelper ()

Purpose: Disallow instance creation
Notes:

Top

STATIC ProparseHelper ()

Purpose: Static Constructor of the ProparseHelper class
Notes:



Property Detail
Top

PUBLIC LOGICAL Initialized


Returns LOGICAL


Temp-Table Detail

Temp-Table ttRunStatements

Defined in:


©2006-2020 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       04.02.2020 23:32:57