com.legstar.cobol
Class CobolFixedFormatSourceCleaner

java.lang.Object
  extended by com.legstar.cobol.AbstractCobolSourceCleaner
      extended by com.legstar.cobol.CobolFixedFormatSourceCleaner

public class CobolFixedFormatSourceCleaner
extends AbstractCobolSourceCleaner

Clean a fixed format COBOL source.

Fixed format is the traditional IBM z/OS format where columns 1-6 contain sequence numbers, column 7 is the indicator area, area A spans from column 8 to 11 and area B from 12 to 72.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.legstar.cobol.AbstractCobolSourceCleaner
AbstractCobolSourceCleaner.CleaningContext
 
Field Summary
 
Fields inherited from class com.legstar.cobol.AbstractCobolSourceCleaner
ALPHANUM_LITERAL_START, COBOL_DELIMITER, COMPILER_DIRECTIVES, DATA_DESCRIPTION_END, DATA_DESCRIPTION_START, DATA_DIVISION, IDENTIFICATION_DIVISION, PROCEDURE_DIVISION
 
Constructor Summary
CobolFixedFormatSourceCleaner(RecognizerErrorHandler errorHandler)
          Construct with a shared error handler.
CobolFixedFormatSourceCleaner(RecognizerErrorHandler errorHandler, int startColumn, int endColumn)
          Construct with a shared error handler.
 
Method Summary
 String cleanFixedLine(String line)
          Clear sequence numbers in column 1-6 and anything beyond column 72.
 String extendedCleanLine(String line)
          Derived classes can extend this method to further clean a line of code.
 int getIndicatorAreaPos()
          
 boolean isComment(String line)
          Specialized cleaners determine if this line is a comment.
 
Methods inherited from class com.legstar.cobol.AbstractCobolSourceCleaner
clean, cleanLine, emitErrorMessage, getErrorHandler, isArgument, isDataDivision, isLineOfCode, removeExtraneousCharacters, replaceLongSeparators
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CobolFixedFormatSourceCleaner

public CobolFixedFormatSourceCleaner(RecognizerErrorHandler errorHandler)
Construct with a shared error handler.

Parameters:
errorHandler - handles error messages

CobolFixedFormatSourceCleaner

public CobolFixedFormatSourceCleaner(RecognizerErrorHandler errorHandler,
                                     int startColumn,
                                     int endColumn)
Construct with a shared error handler.

Parameters:
errorHandler - handles error messages
startColumn - column where code starts (indicator area)
endColumn - column where code ends (right margin)
Method Detail

extendedCleanLine

public String extendedCleanLine(String line)
Derived classes can extend this method to further clean a line of code.

Overrides:
extendedCleanLine in class AbstractCobolSourceCleaner
Parameters:
line - the current line of code
Returns:
a cleaner line of code

getIndicatorAreaPos

public int getIndicatorAreaPos()

Specified by:
getIndicatorAreaPos in class AbstractCobolSourceCleaner
Returns:
the zero-based position of the indicator area

cleanFixedLine

public String cleanFixedLine(String line)
Clear sequence numbers in column 1-6 and anything beyond column 72.

Parameters:
line - the line of code
Returns:
a line of code without sequence numbers

isComment

public boolean isComment(String line)
Description copied from class: AbstractCobolSourceCleaner
Specialized cleaners determine if this line is a comment.

Specified by:
isComment in class AbstractCobolSourceCleaner
Parameters:
line - the line to check
Returns:
true if this line is a comment


Copyright © 2015 LegSem. All rights reserved.