Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.parsers
Class ISeriesEditorCobolILESectionsParser

java.lang.Object
  extended by com.ibm.etools.iseries.parsers.ISeriesEditorCobolILESectionsParser

public class ISeriesEditorCobolILESectionsParser
extends Object

This class parses a COBOL files into sections based on the structure provided by the language, and generates an array of MarkElement to be used by outline view. Creation date: (9/4/2001 10:16:59 AM)

See Also:
"Os390SolutionsContentOutlinePage.java" * topLevel: vector to store outer-most level MarkElements lastParentME: MarkElement of parent lastMECurrentLevel: last MarkElement we saw at current level fileString: string of input file. startIndex: index into fileString where a line begins workIndex: current parsing location in fileString newLineIndex: index into fileString where newline char is for the current line areaAIndex: index at start of area A (column 8) nestLevel: current nesting level. shows how deep we are in lastParentME stack. lineNo: line number of the current statement in the file endOfNameIndex: index of the last character of the last division name we saw. topOfLastMECurrentLevel: a holder when popping the last MarkElement from the stack. currentME: MarkElement just created for the current statement. currentSectionME: MarkElement holder for sections (and PROC DIVISION) that can have sub-elements under them. topOfLastParentME: a holder when popping the last parent-level MarkElement from the stack. Last parent MarkElement is the immediate parent of the current MarkElement.

Field Summary
static String Copyright
           
 
Constructor Summary
ISeriesEditorCobolILESectionsParser(LpexView view)
          Constructor.
 
Method Summary
 void commonDivisionMethod(IFile file)
          This method handles a common part of the code for ENVIRONMENT, DATA, and PROCEDURE DIVISIONs.
 void commonSectionMethod(String divisionName)
          Handles common code for sections (Working-Storage section, Configuration section, etc.) and routines in PROCEDURE DIVISION.
protected  IAdaptable getParent(Hashtable toc, String number)
          Returns the mark element that is the logical parent of the given mark number.
protected  String getText(IFile file)
          Returns a string containing a line from the given file.
 ISeriesEditorCobolILEMarkElement[] parseCOBOL(IFile file)
           
 ISeriesEditorCobolILEMarkElement[] parseDefault(IFile file)
          Parse miscellaneous file types other than those selected by parse() method.
protected  String parseNumber(String heading)
          Returns the number for this heading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values
Constructor Detail

ISeriesEditorCobolILESectionsParser

public ISeriesEditorCobolILESectionsParser(LpexView view)
Constructor.

Method Detail

commonDivisionMethod

public void commonDivisionMethod(IFile file)
This method handles a common part of the code for ENVIRONMENT, DATA, and PROCEDURE DIVISIONs. If we are not at the top level of the tree structure, (i.e. not the outer most level,) then 1. find the parent MarkElement 2. create a MarkElement with the parent else (we must be at the outer most level) 1. create a MarkElement with file as the parent 2. add MarkElement to topLevel vector Replace the lastMECurrentLevel with the one just created (, because it is the latest one at the current nest level) Creation date: (9/12/2001 4:24:22 PM)

Parameters:
Ifile - file input file for the outline view

commonSectionMethod

public void commonSectionMethod(String divisionName)
Handles common code for sections (Working-Storage section, Configuration section, etc.) and routines in PROCEDURE DIVISION. 1. Check the last division name we saw (stored in lastMECurrentLevel). 2. If it matches the passed in name, create ISeriesEditorCobolILEMarkElement for this section. 3. Remember this as the current section (by making this the currentSectionME). Creation date: (9/12/2001 5:23:07 PM)

Parameters:
divisionName - java.lang.String contains the division name to which this section belongs to.

getParent

protected IAdaptable getParent(Hashtable toc,
                               String number)
Returns the mark element that is the logical parent of the given mark number. Each dot in a mark number represents a parent-child separation. For example, the parent of 1.2 is 1, the parent of 1.4.1 is 1.4. Returns null if there is no appropriate parent. Creation date: (9/13/2001 10:52:34 AM)

Parameters:
toc - java.util.Hashtable
number - java.lang.String
Returns:
org.eclipse.core.runtime.IAdaptable

getText

protected String getText(IFile file)
Returns a string containing a line from the given file. Returns an empty string if there were any errors reading the file.

Parameters:
file - input COBOL file
Returns:
String that contains a line of the given file. It contains all characters, including leading blanks on each line and new line characters for end of each line except the very last line of the file.

parseCOBOL

public ISeriesEditorCobolILEMarkElement[] parseCOBOL(IFile file)

parseDefault

public ISeriesEditorCobolILEMarkElement[] parseDefault(IFile file)
Parse miscellaneous file types other than those selected by parse() method. This is the original parse() method found in the LPEXexamples plugin. Any line that begins with a numeric character is displayed in outline view. Creation date: (9/13/2001 10:44:12 AM)

Parameters:
file - org.eclipse.core.resources.IFile
Returns:
com.ibm.ftt.ui.os390editors.ISeriesEditorCobolILEMarkElement[]

parseNumber

protected String parseNumber(String heading)
Returns the number for this heading. A heading consists of a number (an arbitrary string of numbers and dots), followed by arbitrary text. Creation date: (9/13/2001 10:58:16 AM)

Parameters:
heading - java.lang.String
Returns:
java.lang.String

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.