LPEX
4.4.0

com.ibm.lpex.cobol
Class CobolParser

java.lang.Object
  extended by com.ibm.lpex.core.LpexCommonParser
      extended by com.ibm.lpex.cobol.CobolParser
All Implemented Interfaces:
LpexConstants, LpexParser
Direct Known Subclasses:
Cobol400Parser, CobolSqlCicsParser, ILECobolParser

public class CobolParser
extends LpexCommonParser

Document parser for z/OS Enterprise COBOL (COBOL/390). This also serves as the base class for other COBOL document parsers.

Editor actions and assigned keys added by this document parser:

Keys already defined (for example, by the active base editor profile and by the user profile) to an action different from nullAction are not redefined in here.

Editor action modified by this document parser:

Parser properties handled directly by this parser:


Nested Class Summary
 class CobolParser.ParseElement
          A ParseElement contains cached information about a document element.
 class CobolParser.TokenFragment
          A TokenFragment contains information about part of a token.
 
Field Summary
protected  long _classAll
          Bitmask for COBOL parser element class.
protected  long _classAreaA
          Bitmask for COBOL parser element class.
protected  long _classAreaB
          Bitmask for COBOL parser element class.
protected  long _classBackwardLink
          Bitmask for COBOL parser element class.
protected  long _classBlank
          Bitmask for COBOL parser element class.
protected  long _classCics
          Bitmask for COBOL parser element class.
protected  long _classComment
          Bitmask for COBOL parser element class.
protected  long _classCommentTask
          Bitmask for COBOL parser element class.
protected  long _classDirective
          Bitmask for COBOL parser element class.
protected  long _classDivision
          Bitmask for COBOL parser element class.
protected  long _classDli
          Bitmask for COBOL parser element class.
protected  long _classError
          Bitmask for COBOL parser element class.
protected  long _classForwardLink
          Bitmask for COBOL parser element class.
protected  long _classPreprocessor
          Bitmask for COBOL parser element class.
protected  long _classSection
          Bitmask for COBOL parser element class.
protected  long _classSql
          Bitmask for COBOL parser element class.
protected  int _currentBytePosition
          The current COBOL-line byte position (column) of the current character (ZERO-based).
protected  int _currentCharacterPosition
          The current character position in the text string being parsed (ZERO-based).
protected  int _currentElement
          The current element being parsed.
protected  boolean _currentElementCompleted
          Indicates that the current line has bee parsed to the end.
protected  boolean _dbcsUserDefinedWord
          If the current token is a user defined word, then this indicates if it is a DBCS user defined word.
protected  int _decimalLength
          If the current token is a numeric literal, then this indicates the number of digits after the decimal.
protected  int _directiveStartBytePosition
          The byte position of the start of the compiler directive.
protected  int _directiveTokenStartBytePosition
          The byte position of the compiler directive keyword.
protected  StringBuffer _directiveTokenText
          The current directive token.
protected  int _endElement
          The last element in the current parse range.
protected  int _errorCount
          The number of error messages embedded during one total or incremental parse operation.
protected  int _exponentLength
          If the current token is a numeric literal, then this indicates the number of digits in the exponent.
protected  CobolParser.TokenFragment _firstTokenFragment
          A reference to the first token fragment of a multiline token.
protected  CobolParser.ParseElement _freeParseElements
          A reference to the first ParseElement in a list of unused ParseElements.
protected  boolean _inNonnumericLiteral
          Indicates that the current token character is within a nonnumeric literal.
protected  int _integerLength
          If the current token is a numeric literal, then this indicates the number of digits before the decimal.
protected  CobolParser.TokenFragment _lastTokenFragment
          A reference to the last token fragment of a multiline token.
protected  int _multiTokenStartElement
          This contains the starting element of a group of tokens that must be parsed together.
protected  char _nonnumericLiteralDelimiter
          If the current token is a nonnumeric literal, then this indicates the delimiter.
protected  boolean _nonnumericLiteralHasClosingDelimiter
          If the current token is a nonnumeric literal, then this indicates if the closing delimiter was found.
protected  boolean _nonnumericLiteralHasDBCS
          If the current token is a nonnumeric literal, then this indicates if a DBCS character was found.
protected  boolean _nonnumericLiteralHasNonbinary
          If the current token is a nonnumeric literal, then this indicates if a non binary (0 or 1) character was found.
protected  boolean _nonnumericLiteralHasNonhexadecimal
          If the current token is a nonnumeric literal, then this indicates if a non hexadecimal character was found.
protected  boolean _nonnumericLiteralHasSBCS
          If the current token is a nonnumeric literal, then this indicates if a SBCS character was found.
protected  int _nonnumericLiteralLength
          If the current token is a nonnumeric literal, then this indicates the length.
protected  char _nonnumericLiteralType
          If the current token is a nonnumeric literal, then this indicates the type.
protected  boolean _nSymbolNational
          The NSYMBOL compiler option, as defined in the parser profile.
protected  CobolParser.ParseElement _parseElements
          A reference to the first ParseElement in a list of active ParseElements.
protected  int _parseMode
          The current parse mode.
protected  int _previousCharacterWidth
          The source length of the previous character.
protected  CobolWords.Word _reservedWord
          If the current token is a reserved word, then this contains a reference to that word.
protected  int _rightMarginOfAreaB
          Column at which area B ends As of AIX COBOL 4.1 this might be 252 as well as 72.
protected  char _saveTokenCharacter
          The saved character.
protected  int _saveTokenCharacterBytePosition
          The byte position of the saved character.
protected  int _saveTokenCharacterElement
          The element number of the saved character.
protected  int _saveTokenCharacterPosition
          The character position of the saved character.
protected  boolean _saveTokenCharacterValid
          Indicates that the saved character is valid.
protected  boolean _sequenceNumbers16
          Indicates whether columns 1-6 are set as sequence numbers in the editor.
protected  boolean _sequenceNumbers7380
          Indicates whether columns 73-80 are set as sequence numbers in the editor.
protected  int _startElement
          The first element in the current parse range.
protected  boolean _tokenHasDelimiter
          Indicates that the current token has at least quote or apostrophe.
protected  StringBuffer _tokenText
          The current token.
static String AREA_B_RIGHT_MARGIN_PARAM
          Lpex editor parameter indicating the column after area B ends
static String CLASS_AREAA
          COBOL parser element class.
static String CLASS_AREAB
          COBOL parser element class.
static String CLASS_BLANK
          COBOL parser element class.
static String CLASS_BWDLINK
          COBOL parser element class.
static String CLASS_CICS
          COBOL parser element class.
static String CLASS_COMMENT
          COBOL parser element class.
static String CLASS_COMMENTTASK
          COBOL parser element class.
static String CLASS_DIRECTIVE
          COBOL parser element class.
static String CLASS_DIVISION
          COBOL parser element class.
static String CLASS_DLI
          COBOL parser element class.
static String CLASS_ERROR
          COBOL parser element class.
static String CLASS_FWDLINK
          COBOL parser element class.
static String CLASS_PREPROCESSOR
          COBOL parser element class.
static String CLASS_SECTION
          COBOL parser element class.
static String CLASS_SQL
          COBOL parser element class.
protected static int PARSE_MODE_CODE
          Normal parse mode.
protected static int PARSE_MODE_COMMENT_ENTRY
          The parser is in the middle of a comment entry in one of the identification divisions optional paragraphs.
protected static int PARSE_MODE_DATE
          The reserved word "DATE" has been detected.
protected static int PARSE_MODE_DATE_FORMAT
          "DATE FORMAT" has been detected.
protected static int PARSE_MODE_DATE_FORMAT_IS
          "DATE FORMAT IS" has been detected.
protected static int PARSE_MODE_FUNCTION
          The reserved word "FUNCTION" has been detected.
protected static int PARSE_MODE_LAST
          The last parse mode value defined.
protected static int PARSE_MODE_OPTIONAL_ID_PARAGRAPH
          One of the identification division optional paragraph reserved words has been detected.
protected static int PARSE_MODE_PICTURE
          Either "PIC" or "PICTURE" has been detected.
protected static int PARSE_MODE_PICTURE_IS
          Either "PIC IS" or "PICTURE IS" has been detected.
protected static int PARSE_MODE_PREPROCESSOR
          The parser has detected the word "EXEC".
protected static int PARSE_MODE_PSEUDO_TEXT
          An opening pseudo-text delimiter has been detected.
protected static char STYLE_COMPILER_DIRECTIVE
           
protected static char STYLE_FUNCTION
           
protected static char STYLE_PICTURE_STRING
           
protected static char STYLE_PREPROCESSOR_STRING
           
protected static char STYLE_RESERVED_WORD
           
protected static char STYLE_USER_DEFINED_WORD
           
 
Fields inherited from class com.ibm.lpex.core.LpexCommonParser
ATTRIBUTES_COMMENT, ATTRIBUTES_COMMENT_KEYWORD, ATTRIBUTES_COMMENT1, ATTRIBUTES_DEFAULT, ATTRIBUTES_DIRECTIVE, ATTRIBUTES_ERROR, ATTRIBUTES_ERROR1, ATTRIBUTES_KEYWORD, ATTRIBUTES_KEYWORD1, ATTRIBUTES_LIBRARY, ATTRIBUTES_NONSOURCE, ATTRIBUTES_NUMERAL, ATTRIBUTES_STRING, ATTRIBUTES_STRING1, BACKGROUND_COLOR, CLASS_MESSAGE, LANGUAGE_CCPP, LANGUAGE_CICS, LANGUAGE_CL, LANGUAGE_COBOL, LANGUAGE_COBOL400, LANGUAGE_COBOLILE, LANGUAGE_DDS, LANGUAGE_DLI, LANGUAGE_FORTRAN, LANGUAGE_HLASM, LANGUAGE_HTML, LANGUAGE_JAVA, LANGUAGE_JCL, LANGUAGE_LISP, LANGUAGE_PERL, LANGUAGE_PLI, LANGUAGE_REXX, LANGUAGE_RPG, LANGUAGE_RPGLEFIXED, LANGUAGE_RPGLEFREE, LANGUAGE_SABRETALK, LANGUAGE_SQL, LANGUAGE_XMI, LANGUAGE_XML, LANGUAGE_XSL, LEXER_RC_END, LEXER_RC_EOF, LEXER_RC_MORE, LEXER_RC_OK, POPUP_END, POPUP_FILTERVIEW, POPUP_SOURCE, POPUP_TOP, PROTOKEY_EMPTY, STYLE_MESSAGE, STYLE_NAME, view
 
Fields inherited from interface com.ibm.lpex.core.LpexConstants
HELP_COMMAND_MAP, LPEX_VERSION, MSG_POPUP_COMMENT, MSG_POPUP_ERRORS, MSG_POPUP_EXCLUDESELECTION, MSG_POPUP_FILTERVIEWMENU, MSG_POPUP_INSERTMENU, MSG_POPUP_SELECTEDMENU, MSG_POPUP_SHOWALL, MSG_POPUP_SOURCEMENU, MSG_POPUP_TASKS, MSG_POPUP_UNCOMMENT, PARSE_PENDING_CHANGE_MASK, PARSE_PENDING_INSERT_MASK, PARSE_PENDING_NEXT_DELETED_MASK, PARSE_PENDING_NEXT_SHOW_DELETED_MASK, PARSE_PENDING_PREV_DELETED_MASK, PARSE_PENDING_PREV_SHOW_DELETED_MASK, PARSE_PENDING_UNDO_MASK, PLATFORM_AWT, PLATFORM_SWT, PLATFORM_SWT_KEY, SHOW_ALL, SHOW_DOCUMENT, SHOW_NONE, SHOW_VIEW, STATUS_FIELDS_NOINSERT, STATUS_FIELDS_TRUNCATE, STATUS_FILE_ERRORREADING, STATUS_FILE_INCORRECTENCODING, STATUS_FILE_NOTFOUND, STATUS_FINDTEXT_INVALIDPATTERN, STATUS_FINDTEXT_NOTFOUND, STATUS_FINDTEXT_ONLYOCCURRENCE, STATUS_FINDTEXT_READONLY, STATUS_FINDTEXT_WRAPPED, STATUS_LOCATE_NOSEQUENCETEXT, STATUS_LOCATE_NOTFOUND, STATUS_LOCATE_WRAPPED, STATUS_SAVE_CANCELLED, STATUS_SAVE_FAILED, STATUS_TEXTLIMIT_ENFORCED, STATUS_TEXTLIMIT_OVERFLOW, STATUS_UNDO_NOTHINGUNDONE
 
Constructor Summary
CobolParser(LpexView lpexView)
          Constructor.
 
Method Summary
protected  void addErrorMessage(int element, String message)
          Adds an error message for the specified document element.
protected  void addErrorMessage(int element, String message, String argument)
          Adds an error message with an argument for the specified document element.
protected  void backSpace()
          Override the default backspace behaviour.
protected  void checkExtendedLengthSetting()
          Checks whether the right margin of Area B is at column 72 or 252.
protected  boolean checkSequenceNumbersSetting()
          Checks the sequence numbers setting for columns 73 - 80 and columns 1 - 6.
protected  void completeCurrentElement()
          Completes the parsing of the current line.
protected  boolean continueParse()
          Returns true if parsing should be continued (we are currently inside a COBOL construct).
protected  void delete()
          Override the default delete behaviour.
 LpexDocumentLocation documentLocationUsingFullText()
          Like LpexView.documentLocation() except position is relevant to fullText.
 String elementStyleUsingFullText(int element)
          Like LpexView.elementStyle(int) except that the style string will have style characters for "hidden" sequence numbers.
protected  int evaluateBeginElement(int element)
          Evaluates a parse range for incremental parse from the specified element up to the top of the document.
protected  int evaluateEndElement(int element)
          Evaluates a parse range for incremental parse from the specified element to the bottom of the document.
protected  CobolWords.Word findDirective()
          Returns the directive word indicated by the current directive token.
protected  CobolParser.ParseElement findParseElement(int element)
          Finds the active ParseElement for the specified element.
protected  void flushElements()
          Flushes any of the cached elements with which we are finished.
protected  CicsLexer getCicsLexer(LpexCharStream stream)
          Returns the CicsLexer.
 String getCommentStyleCharacters()
          Returns the style characters used for styling comments ("cs$").
protected  boolean getDirectiveToken()
          Returns the potential compiler-directive keyword.
protected  LpexSubparser getDliLexer(LpexCharStream stream)
          Returns the DliLexer.
 String getLanguage()
          Returns "COBOL", the language supported by this parser.
 String getLanguage(LpexDocumentLocation loc)
          Returns a string identifying the language segment at the specified location.
 String getLshToken()
          Returns the current token for language-sensitive help (LSH).
protected  void getNSYMBOL()
          Sets _nSymbolNational for the current setting for the NSYMBOL compiler option.
protected  String getPopupItem(String key)
           
protected  String getPopupItems(int popupLocation)
          Returns this parser's contribution to the popup.
 ResourceBundle getProfile()
          Returns this parser's profile.
protected  SqlLexer getSqlLexer(LpexCharStream stream)
          Returns the SqlLexer.
protected  boolean getToken()
          Returns the next token in the current element.
 LpexDocumentLocation getTokenLocationUsingFullText(LpexDocumentLocation fullTextLoc)
          Like getTokenLocation(LpexDocumentLocation loc), except that loc is expected to be relative to the fullText of the line (i.e.
 String getTokenUsingFullText(LpexDocumentLocation loc)
          Like getToken(LpexDocumentLocation loc), except that loc is expected to be relative to the fullText of the line (i.e.
protected  void initCurrentElement()
          Initializes the current element for parsing.
protected  void initializeParser()
          Initializes the parser.
protected  void initParser()
          Initializes the parser.
protected  boolean isCommaOrSemicolon()
          Returns true if the current token is a comma or semicolon.
protected  boolean isDirectiveLine()
          Returns true if the current line is a directive line.
protected  boolean isFloatingComment()
           
protected  boolean isFunctionName()
          Returns true if the current token is a function name.
protected  boolean isNonnumericLiteral()
          Returns true if the current token is a nonnumeric literal.
protected  boolean isNumericLiteral()
          Returns true if the current token is a numeric literal.
protected  boolean isPeriod()
          Returns true if the current token is a period.
protected  boolean isPreprocessorStart()
          Returns true if the current token is "EXEC".
protected  boolean isPseudoTextStart()
          Returns true if the current token is an opening pseudo-text delimiter.
protected  boolean isReservedWord()
          Returns true if the current token is a reserved word.
protected  boolean isSeparator()
          Returns true if the current token is a separator.
 boolean isTokenDelimiter(char ch)
          Returns whether the specified character is a token delimiter.
protected  boolean isUserDefinedWord()
          Returns true if the current token is a user-defined word.
protected  int join()
          Override the default join behaviour.
protected  int join(boolean undoCheck)
          Override the default join behaviour.
protected  void linkElements(int startElement, int endElement)
          Links the specified elements together if necessary.
protected  void linkLexedElements(int startElement, int endElement)
          Links the specified lexed elements if necessary.
protected  int maxDigits()
          Returns the maximum number of digits allowed in a numeric literal.
protected  int maxExponent()
          Returns the maximum number of digits allowed in the exponent of a floating-point literal.
protected  int maxMantissa()
          Returns the maximum number of digits allowed in the mantissa of a floating-point literal.
protected  int maxPicture()
          Returns the maximum number of characters allowed in the picture string.
protected  void nextCharacter()
          Advances to the next character in the current element.
protected  boolean nextTokenCharacter()
          Advances to the next token character.
protected  boolean nextTokenElement()
          Advances to the next token (non-show) element in the parse range.
protected  String nonnumericLiteralTypes()
          Returns a string indicating valid nonnumeric literal types.
protected  void parse()
          Parses the affected range of elements.
 void parseAll()
          Total parse of the entire document.
protected  void parseCodeToken()
          Parses the current code token (_tokenText).
protected  boolean parseComment()
           
protected  void parseCommentEntryToken()
          Parses the current comment entry token.
protected  void parseDateFormatIsToken()
          Parses the current date format is clause token.
protected  void parseDateFormatString()
          Parses the current date format.
protected  void parseDateFormatToken()
          Parses the current date format clause token.
protected  void parseDateToken()
          Parses the current date clause token.
protected  void parseDirectiveLine()
          Parses a directive line.
 void parseElement(int element)
          Incremental parse.
protected  void parseErrorToken()
          Parses the current error token.
protected  void parseFloatingCommentToken()
           
protected  void parseFunctionToken()
          Parses the current function clause token.
protected  boolean parseIndicatorArea()
          Parses the indicator area.
protected  void parseNonnumericLiteral()
          Parses the current nonnumeric literal.
protected  void parseNumericLiteral()
          Parses the current numeric literal.
protected  void parseOptionalIdParagraphToken()
          Parses the current identification division optional paragraph token.
protected  void parsePictureIsToken()
          Parses the current token in the PICTURE IS clause.
protected  void parsePictureString()
          Parses the current picture string.
protected  void parsePictureToken()
          Parses the current token in the PICTURE clause.
protected  void parsePreprocessorStart()
          Parse the current "EXEC" token.
protected  void parsePreprocessorToken()
          Parses the current preprocessor string token.
protected  void parsePseudoTextStart()
          Parses the current opening pseudo-text delimiter.
protected  void parsePseudoTextToken()
          Parses the current pseudo-text token.
protected  void parseReservedWord()
          Parse the current reserved word.
protected  void parseSeparator()
          Parses the current separator token.
protected  void parseToken()
          Parses the current token.
protected  void parseUserDefinedWord()
          Parses the current user-defined word.
protected  void propertySet(String key)
          Listens to changes to any of our parser properties in this view.
protected  void reInitCurrentElement(int currentCharacterPosition)
          Reinitializes the current element for parsing.
protected  void saveTokenCharacter()
          Saves the current token character.
protected  void setCommentToken()
          Sets the style characters for the current comment token.
protected  void setDocumentElementText(LpexView view, int iElement, String strElement)
          Associates the text with the editor element line Removes the null at the end of the string
 void setStyleAttributes()
          Defines this parser's style attributes.
protected  void setToken(char styleCharacter)
          Sets the style character for the current token.
protected  void setToken(char styleCharacter, long classes)
          Sets the style character and classes for the current token.
protected  void setToken(char styleCharacter, long classes, String message)
          Sets the style character, classes and error message for the current token.
protected  void setToken(char styleCharacter, long classes, String message, String argument)
          Sets the style character, classes, error message and error message argument for the current token.
protected  void setTokenEnd()
          Sets the (saved) current character as the end of the current token.
protected  void splitLine()
          Override the default splitLine behaviour.
protected  void splitLine(boolean undoCheck)
          Override the default splitLine behaviour.
protected  String toUpperCase(String name)
          Utility method for selectively uppercasing the characters in a string, for use as an IBM i *NAME value.
protected  void upperCaseCOBOLLines(LpexView lpexView)
           
protected  void upperCaseElement(int _startElement, int _endElement, int topPosition, int bottomPosition)
          Performs uppercasing of Elements if requested
 
Methods inherited from class com.ibm.lpex.core.LpexCommonParser
addDocumentMessage, addMessage, addMessage, addMessage, blockMarkWord, copyDocumentMessages, cursorIndent, defineFilterAction, defineFilterAction, expandProtoKeyword, getInstallStyleAttributes, getProperty, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isDebuggable, isPrimaryParser, isWordCharacter, lineComment, lpexView, matchToken, newLine, openLine, parse, removeDocumentMessages, removeMessages, removeMessages, resetParser, setProperty, setStyle, styleString, terminateParser, tokenBegin, tokenEnd, totalParse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSE_MODE_CODE

protected static final int PARSE_MODE_CODE
Normal parse mode.

See Also:
Constant Field Values

PARSE_MODE_PSEUDO_TEXT

protected static final int PARSE_MODE_PSEUDO_TEXT
An opening pseudo-text delimiter has been detected. Now the parser is searching for the closing delimiter.

See Also:
Constant Field Values

PARSE_MODE_PICTURE

protected static final int PARSE_MODE_PICTURE
Either "PIC" or "PICTURE" has been detected. Now the parser is looking for either the reserved word "IS" or the picture string.

See Also:
Constant Field Values

PARSE_MODE_PICTURE_IS

protected static final int PARSE_MODE_PICTURE_IS
Either "PIC IS" or "PICTURE IS" has been detected. Now the parser is looking for the picture string.

See Also:
Constant Field Values

PARSE_MODE_OPTIONAL_ID_PARAGRAPH

protected static final int PARSE_MODE_OPTIONAL_ID_PARAGRAPH
One of the identification division optional paragraph reserved words has been detected. Now the parser is looking for the period that should follow that reserved word.

See Also:
Constant Field Values

PARSE_MODE_COMMENT_ENTRY

protected static final int PARSE_MODE_COMMENT_ENTRY
The parser is in the middle of a comment entry in one of the identification divisions optional paragraphs.

See Also:
Constant Field Values

PARSE_MODE_FUNCTION

protected static final int PARSE_MODE_FUNCTION
The reserved word "FUNCTION" has been detected. Now the parser is looking for the token that follows FUNCTION to see if it is a valid function name.

See Also:
Constant Field Values

PARSE_MODE_DATE

protected static final int PARSE_MODE_DATE
The reserved word "DATE" has been detected. Now the parser is checking to see if the token that follows DATE is the reserved word "FORMAT".

See Also:
Constant Field Values

PARSE_MODE_DATE_FORMAT

protected static final int PARSE_MODE_DATE_FORMAT
"DATE FORMAT" has been detected. Now the parser is looking for either the reserved word "IS" or the date format.

See Also:
Constant Field Values

PARSE_MODE_DATE_FORMAT_IS

protected static final int PARSE_MODE_DATE_FORMAT_IS
"DATE FORMAT IS" has been detected. Now the parser is looking to see if the next token is a valid date format.

See Also:
Constant Field Values

PARSE_MODE_PREPROCESSOR

protected static final int PARSE_MODE_PREPROCESSOR
The parser has detected the word "EXEC". Now it is looking for the word "END-EXEC". If "SQL", "CICS", or "DLI" is encountered, the appropriate SQL/CICS/DLI subparser may be activated.

See Also:
Constant Field Values

PARSE_MODE_LAST

protected static final int PARSE_MODE_LAST
The last parse mode value defined.

See Also:
Constant Field Values

AREA_B_RIGHT_MARGIN_PARAM

public static final String AREA_B_RIGHT_MARGIN_PARAM
Lpex editor parameter indicating the column after area B ends

See Also:
Constant Field Values

CLASS_FWDLINK

public static final String CLASS_FWDLINK
COBOL parser element class.

See Also:
Constant Field Values

CLASS_BWDLINK

public static final String CLASS_BWDLINK
COBOL parser element class.

See Also:
Constant Field Values

CLASS_BLANK

public static final String CLASS_BLANK
COBOL parser element class.

See Also:
Constant Field Values

CLASS_ERROR

public static final String CLASS_ERROR
COBOL parser element class.

See Also:
Constant Field Values

CLASS_COMMENT

public static final String CLASS_COMMENT
COBOL parser element class.

See Also:
Constant Field Values

CLASS_COMMENTTASK

public static final String CLASS_COMMENTTASK
COBOL parser element class.

See Also:
Constant Field Values

CLASS_DIRECTIVE

public static final String CLASS_DIRECTIVE
COBOL parser element class.

See Also:
Constant Field Values

CLASS_DIVISION

public static final String CLASS_DIVISION
COBOL parser element class.

See Also:
Constant Field Values

CLASS_SECTION

public static final String CLASS_SECTION
COBOL parser element class.

See Also:
Constant Field Values

CLASS_AREAA

public static final String CLASS_AREAA
COBOL parser element class.

See Also:
Constant Field Values

CLASS_AREAB

public static final String CLASS_AREAB
COBOL parser element class.

See Also:
Constant Field Values

CLASS_PREPROCESSOR

public static final String CLASS_PREPROCESSOR
COBOL parser element class.

See Also:
Constant Field Values

CLASS_SQL

public static final String CLASS_SQL
COBOL parser element class.

See Also:
Constant Field Values

CLASS_CICS

public static final String CLASS_CICS
COBOL parser element class.

See Also:
Constant Field Values

CLASS_DLI

public static final String CLASS_DLI
COBOL parser element class.

See Also:
Constant Field Values

_classForwardLink

protected long _classForwardLink
Bitmask for COBOL parser element class.


_classBackwardLink

protected long _classBackwardLink
Bitmask for COBOL parser element class.


_classBlank

protected long _classBlank
Bitmask for COBOL parser element class.


_classError

protected long _classError
Bitmask for COBOL parser element class.


_classComment

protected long _classComment
Bitmask for COBOL parser element class.


_classCommentTask

protected long _classCommentTask
Bitmask for COBOL parser element class.


_classDirective

protected long _classDirective
Bitmask for COBOL parser element class.


_classDivision

protected long _classDivision
Bitmask for COBOL parser element class.


_classSection

protected long _classSection
Bitmask for COBOL parser element class.


_classAreaA

protected long _classAreaA
Bitmask for COBOL parser element class.


_classAreaB

protected long _classAreaB
Bitmask for COBOL parser element class.


_classPreprocessor

protected long _classPreprocessor
Bitmask for COBOL parser element class.


_classSql

protected long _classSql
Bitmask for COBOL parser element class.


_classCics

protected long _classCics
Bitmask for COBOL parser element class.


_classDli

protected long _classDli
Bitmask for COBOL parser element class.


_classAll

protected long _classAll
Bitmask for COBOL parser element class.


_nSymbolNational

protected boolean _nSymbolNational
The NSYMBOL compiler option, as defined in the parser profile. By default it is true, for default compiler option NSYMBOL(NATIONAL).


_sequenceNumbers7380

protected boolean _sequenceNumbers7380
Indicates whether columns 73-80 are set as sequence numbers in the editor. Updated by checkSequenceNumbersSetting() at the beginning of each parse operation.

When set as sequence numbers (see the sequenceNumbers editor parameter), they are not part of the edit area. The COBOL/390 parser must be aware of this, so it doesn't attempt to set styles for text found in these columns (which are now actually columns 81-88 in the document!).

See Also:
_sequenceNumbers16

_sequenceNumbers16

protected boolean _sequenceNumbers16
Indicates whether columns 1-6 are set as sequence numbers in the editor. Updated by checkSequenceNumbersSetting() at the beginning of each parse operation.

See Also:
_sequenceNumbers7380

_rightMarginOfAreaB

protected int _rightMarginOfAreaB
Column at which area B ends As of AIX COBOL 4.1 this might be 252 as well as 72.


_startElement

protected int _startElement
The first element in the current parse range.


_endElement

protected int _endElement
The last element in the current parse range.


_currentElement

protected int _currentElement
The current element being parsed.


_currentCharacterPosition

protected int _currentCharacterPosition
The current character position in the text string being parsed (ZERO-based).


_currentBytePosition

protected int _currentBytePosition
The current COBOL-line byte position (column) of the current character (ZERO-based).


_previousCharacterWidth

protected int _previousCharacterWidth
The source length of the previous character.


_currentElementCompleted

protected boolean _currentElementCompleted
Indicates that the current line has bee parsed to the end.


_parseElements

protected CobolParser.ParseElement _parseElements
A reference to the first ParseElement in a list of active ParseElements.


_freeParseElements

protected CobolParser.ParseElement _freeParseElements
A reference to the first ParseElement in a list of unused ParseElements.


_saveTokenCharacterElement

protected int _saveTokenCharacterElement
The element number of the saved character.


_saveTokenCharacterBytePosition

protected int _saveTokenCharacterBytePosition
The byte position of the saved character.


_saveTokenCharacterPosition

protected int _saveTokenCharacterPosition
The character position of the saved character.


_saveTokenCharacter

protected char _saveTokenCharacter
The saved character.


_saveTokenCharacterValid

protected boolean _saveTokenCharacterValid
Indicates that the saved character is valid.


_directiveTokenText

protected StringBuffer _directiveTokenText
The current directive token.


_directiveTokenStartBytePosition

protected int _directiveTokenStartBytePosition
The byte position of the compiler directive keyword.


_directiveStartBytePosition

protected int _directiveStartBytePosition
The byte position of the start of the compiler directive.


_parseMode

protected int _parseMode
The current parse mode.


_firstTokenFragment

protected CobolParser.TokenFragment _firstTokenFragment
A reference to the first token fragment of a multiline token.


_lastTokenFragment

protected CobolParser.TokenFragment _lastTokenFragment
A reference to the last token fragment of a multiline token.


_tokenText

protected StringBuffer _tokenText
The current token.


_inNonnumericLiteral

protected boolean _inNonnumericLiteral
Indicates that the current token character is within a nonnumeric literal.


_tokenHasDelimiter

protected boolean _tokenHasDelimiter
Indicates that the current token has at least quote or apostrophe.


_reservedWord

protected CobolWords.Word _reservedWord
If the current token is a reserved word, then this contains a reference to that word.


_integerLength

protected int _integerLength
If the current token is a numeric literal, then this indicates the number of digits before the decimal.


_decimalLength

protected int _decimalLength
If the current token is a numeric literal, then this indicates the number of digits after the decimal.


_exponentLength

protected int _exponentLength
If the current token is a numeric literal, then this indicates the number of digits in the exponent.


_dbcsUserDefinedWord

protected boolean _dbcsUserDefinedWord
If the current token is a user defined word, then this indicates if it is a DBCS user defined word.


_nonnumericLiteralType

protected char _nonnumericLiteralType
If the current token is a nonnumeric literal, then this indicates the type. The type is one of:


_nonnumericLiteralDelimiter

protected char _nonnumericLiteralDelimiter
If the current token is a nonnumeric literal, then this indicates the delimiter.


_nonnumericLiteralLength

protected int _nonnumericLiteralLength
If the current token is a nonnumeric literal, then this indicates the length.


_nonnumericLiteralHasClosingDelimiter

protected boolean _nonnumericLiteralHasClosingDelimiter
If the current token is a nonnumeric literal, then this indicates if the closing delimiter was found.


_nonnumericLiteralHasNonhexadecimal

protected boolean _nonnumericLiteralHasNonhexadecimal
If the current token is a nonnumeric literal, then this indicates if a non hexadecimal character was found.


_nonnumericLiteralHasNonbinary

protected boolean _nonnumericLiteralHasNonbinary
If the current token is a nonnumeric literal, then this indicates if a non binary (0 or 1) character was found.


_nonnumericLiteralHasDBCS

protected boolean _nonnumericLiteralHasDBCS
If the current token is a nonnumeric literal, then this indicates if a DBCS character was found.


_nonnumericLiteralHasSBCS

protected boolean _nonnumericLiteralHasSBCS
If the current token is a nonnumeric literal, then this indicates if a SBCS character was found.


_multiTokenStartElement

protected int _multiTokenStartElement
This contains the starting element of a group of tokens that must be parsed together.


_errorCount

protected int _errorCount
The number of error messages embedded during one total or incremental parse operation. When this count reaches 500, no more messages are added.


STYLE_USER_DEFINED_WORD

protected static final char STYLE_USER_DEFINED_WORD
See Also:
Constant Field Values

STYLE_RESERVED_WORD

protected static final char STYLE_RESERVED_WORD
See Also:
Constant Field Values

STYLE_FUNCTION

protected static final char STYLE_FUNCTION
See Also:
Constant Field Values

STYLE_COMPILER_DIRECTIVE

protected static final char STYLE_COMPILER_DIRECTIVE
See Also:
Constant Field Values

STYLE_PREPROCESSOR_STRING

protected static final char STYLE_PREPROCESSOR_STRING
See Also:
Constant Field Values

STYLE_PICTURE_STRING

protected static final char STYLE_PICTURE_STRING
See Also:
Constant Field Values
Constructor Detail

CobolParser

public CobolParser(LpexView lpexView)
Constructor.

Parameters:
lpexView - the document view associated with this parser
Method Detail

initParser

protected void initParser()
Initializes the parser.

Overrides:
initParser in class LpexCommonParser
See Also:
Life cycle

parseAll

public void parseAll()
Total parse of the entire document. Done initially after a document has been loaded in the editor, after an updateProfile command, and after a change to the NSYMBOL and taskTags parser properties.

This method sets the parse range (_startElement .. _endElement) to the entire document, and calls parse() to do the work.

Specified by:
parseAll in class LpexCommonParser
See Also:
Total and incremental parse

parseElement

public void parseElement(int element)
Incremental parse. This method establishes an initial optimal parse range (_startElement .. _endElement), and calls parse() to do the work. During parse(), _endElement may be further extended. Before this method returns, all the elements in the final parse range are removed from the associated view's parse-pending list.

Extenders of this parser should not alter the document in a subclass of this method, or the element argument may become incorrect. For example, in order to add and remove error-message show lines (e.g., from a COBOL syntax checker), you must use the LpexCommonParser methods addMessage() and removeMessages().

Specified by:
parseElement in class LpexCommonParser
Parameters:
element - an element affected by a committed change in this view
See Also:
LpexView.parsePending(int), LpexView.elementParsed(int), Total and incremental parse

parse

protected void parse()
Parses the affected range of elements. Called by parseAll() and parseElement().

This method assumes that _startElement and _endElement have been determined and set. While the parse is performed in here, the initial _endElement may be further extended; in this case, removeMessages() will be called to delete this parser's default embedded error messages in the extended range.

Extenders of this parser should not alter the document in a subclass of this method, or the established _startElement and _endElement may become incorrect. For example, in order to add and remove error-message show lines (e.g., from a COBOL syntax checker), you must use the LpexCommonParser methods addMessage() and removeMessages().


reInitCurrentElement

protected void reInitCurrentElement(int currentCharacterPosition)
Reinitializes the current element for parsing. When a preprocessor lexer completes an "EXEC" .. "END-EXEC" construct, this method is called to get regular COBOL parsing going again.

Parameters:
currentCharacterPosition - the next character position to handle inside the effective text of _currentElement

initCurrentElement

protected void initCurrentElement()
Initializes the current element for parsing. It is cached into a ParseElement, and everything up to the first token character is parsed.

A directive or comment line will be parsed in its entirety before this method returns.


parseComment

protected boolean parseComment()

parseIndicatorArea

protected boolean parseIndicatorArea()
Parses the indicator area. This method is called by initCurrentElement() to parse the indicator area (column 7). If it returns true, then initCurrentElement() continues parsing until the first token character in the line, otherwise it just returns.

Returns:
true = the indicator area character was parsed, or
false = the entire element has been parsed (for example, in the case of a comment '*' indicator area)

findDirective

protected CobolWords.Word findDirective()
Returns the directive word indicated by the current directive token.


isDirectiveLine

protected boolean isDirectiveLine()
Returns true if the current line is a directive line.


parseDirectiveLine

protected void parseDirectiveLine()
Parses a directive line.


getDirectiveToken

protected boolean getDirectiveToken()
Returns the potential compiler-directive keyword.

Returns:
true if a possible compiler directive was found

completeCurrentElement

protected void completeCurrentElement()
Completes the parsing of the current line.


flushElements

protected void flushElements()
Flushes any of the cached elements with which we are finished.


findParseElement

protected CobolParser.ParseElement findParseElement(int element)
Finds the active ParseElement for the specified element.

Returns:
null if there is no ParseElement for the given element

continueParse

protected boolean continueParse()
Returns true if parsing should be continued (we are currently inside a COBOL construct).


getToken

protected boolean getToken()
Returns the next token in the current element. On exit, the new token is in _tokenText.

Returns:
true a token was found

setTokenEnd

protected void setTokenEnd()
Sets the (saved) current character as the end of the current token.


nextTokenCharacter

protected boolean nextTokenCharacter()
Advances to the next token character. To gather the current token, the caller of this method will go on calling it until false is returned: at that moment _currentCharacterPosition will point to the next non-space character (the next token, possibly in the next element), and the intervening spaces will have been styled to '_'.

Returns:
true if the next token character is contiguous (no intervening spaces) to the current token character

nextTokenElement

protected boolean nextTokenElement()
Advances to the next token (non-show) element in the parse range. _currentElement is updated.

Returns:
true if another token element was found, or false if no more token elements are found within the current parse range

nextCharacter

protected void nextCharacter()
Advances to the next character in the current element. Variables _currentCharacterPosition and _currentBytePosition are advanced to the next character position inside the element text, or to the next position if beyond the current element's text.


saveTokenCharacter

protected void saveTokenCharacter()
Saves the current token character.


parseToken

protected void parseToken()
Parses the current token. Calls the appropriate parseXxxToken() method based on the current parse mode.


parseCodeToken

protected void parseCodeToken()
Parses the current code token (_tokenText).


isSeparator

protected boolean isSeparator()
Returns true if the current token is a separator.


isCommaOrSemicolon

protected boolean isCommaOrSemicolon()
Returns true if the current token is a comma or semicolon.


isFloatingComment

protected boolean isFloatingComment()

isPeriod

protected boolean isPeriod()
Returns true if the current token is a period.


parseSeparator

protected void parseSeparator()
Parses the current separator token.


isReservedWord

protected boolean isReservedWord()
Returns true if the current token is a reserved word.


parseReservedWord

protected void parseReservedWord()
Parse the current reserved word. For certain keywords, _multiTokenStartElement and _parseMode are set.


isNumericLiteral

protected boolean isNumericLiteral()
Returns true if the current token is a numeric literal.


maxDigits

protected int maxDigits()
Returns the maximum number of digits allowed in a numeric literal.


maxMantissa

protected int maxMantissa()
Returns the maximum number of digits allowed in the mantissa of a floating-point literal.


maxExponent

protected int maxExponent()
Returns the maximum number of digits allowed in the exponent of a floating-point literal.


parseNumericLiteral

protected void parseNumericLiteral()
Parses the current numeric literal.


isPreprocessorStart

protected boolean isPreprocessorStart()
Returns true if the current token is "EXEC".


parsePreprocessorStart

protected void parsePreprocessorStart()
Parse the current "EXEC" token. Sets the parse mode to PREPROCESSOR.


isUserDefinedWord

protected boolean isUserDefinedWord()
Returns true if the current token is a user-defined word.


parseUserDefinedWord

protected void parseUserDefinedWord()
Parses the current user-defined word.


nonnumericLiteralTypes

protected String nonnumericLiteralTypes()
Returns a string indicating valid nonnumeric literal types.


isNonnumericLiteral

protected boolean isNonnumericLiteral()
Returns true if the current token is a nonnumeric literal.


parseNonnumericLiteral

protected void parseNonnumericLiteral()
Parses the current nonnumeric literal.


isPseudoTextStart

protected boolean isPseudoTextStart()
Returns true if the current token is an opening pseudo-text delimiter.


parsePseudoTextStart

protected void parsePseudoTextStart()
Parses the current opening pseudo-text delimiter.


parseErrorToken

protected void parseErrorToken()
Parses the current error token.


parsePseudoTextToken

protected void parsePseudoTextToken()
Parses the current pseudo-text token.


parsePictureToken

protected void parsePictureToken()
Parses the current token in the PICTURE clause.


parsePictureIsToken

protected void parsePictureIsToken()
Parses the current token in the PICTURE IS clause.


maxPicture

protected int maxPicture()
Returns the maximum number of characters allowed in the picture string.


parsePictureString

protected void parsePictureString()
Parses the current picture string.


parseOptionalIdParagraphToken

protected void parseOptionalIdParagraphToken()
Parses the current identification division optional paragraph token.


parseFloatingCommentToken

protected void parseFloatingCommentToken()

parseCommentEntryToken

protected void parseCommentEntryToken()
Parses the current comment entry token.


isFunctionName

protected boolean isFunctionName()
Returns true if the current token is a function name.


parseFunctionToken

protected void parseFunctionToken()
Parses the current function clause token.


parseDateToken

protected void parseDateToken()
Parses the current date clause token.


parseDateFormatToken

protected void parseDateFormatToken()
Parses the current date format clause token.


parseDateFormatIsToken

protected void parseDateFormatIsToken()
Parses the current date format is clause token.


parseDateFormatString

protected void parseDateFormatString()
Parses the current date format.


parsePreprocessorToken

protected void parsePreprocessorToken()
Parses the current preprocessor string token. If it is "END-EXEC", it returns the parse mode to CODE. If it is "SQL", "CICS", or "DLI", it tries to activate the appropriate lexer.


setToken

protected void setToken(char styleCharacter)
Sets the style character for the current token.


setToken

protected void setToken(char styleCharacter,
                        long classes)
Sets the style character and classes for the current token.


setToken

protected void setToken(char styleCharacter,
                        long classes,
                        String message)
Sets the style character, classes and error message for the current token.


setToken

protected void setToken(char styleCharacter,
                        long classes,
                        String message,
                        String argument)
Sets the style character, classes, error message and error message argument for the current token.


setCommentToken

protected void setCommentToken()
Sets the style characters for the current comment token. Variation of setToken(char) for styling a token as a comment ('c') with optional task tags ('$').


linkElements

protected void linkElements(int startElement,
                            int endElement)
Links the specified elements together if necessary. No action is taken if startElement and endElement are the same element.

Multiple elements belonging to one construct are doubly-linked with the _classForwardLink and _classBackwardLink.


linkLexedElements

protected void linkLexedElements(int startElement,
                                 int endElement)
Links the specified lexed elements if necessary. These are elements that were parsed by CicsLexer, SqlLexer, or another subparser. This method is similar to linkElements(), but it also corrects styles as normally handled by the COBOL parser (sequence numbers, indicator area).

See Also:
linkElements(int,int)

getProfile

public ResourceBundle getProfile()
Returns this parser's profile. The profile is Profile.properties in the com.ibm.lpex.cobol package.

Overrides:
getProfile in class LpexCommonParser
See Also:
LpexCommonParser.getProperty(java.lang.String), Parser properties

getLanguage

public String getLanguage()
Returns "COBOL", the language supported by this parser.

Overrides:
getLanguage in class LpexCommonParser
See Also:
LpexCommonParser.LANGUAGE_COBOL

getLanguage

public String getLanguage(LpexDocumentLocation loc)
Returns a string identifying the language segment at the specified location. In mixed-content documents, this may differ from the main language of the document. The method assumes that no parse is pending.

Overrides:
getLanguage in class LpexCommonParser
Parameters:
loc - document location
Returns:
one of: LpexCommonParser.LANGUAGE_COBOL, LpexCommonParser.LANGUAGE_SQL, LpexCommonParser.LANGUAGE_CICS, LpexCommonParser.LANGUAGE_DLI
See Also:
LpexCommonParser.getLanguage(), Mixed content documents

initializeParser

protected void initializeParser()
Initializes the parser. Sets up the parser for the associated document view: sets style attributes, registers element classes, creates editor actions, redefines the popup, etc. for the language-sensitive edit features supported.


checkExtendedLengthSetting

protected void checkExtendedLengthSetting()
Checks whether the right margin of Area B is at column 72 or 252. Sets the field _rightMarginOfAreaB to the correct value.


checkSequenceNumbersSetting

protected boolean checkSequenceNumbersSetting()
Checks the sequence numbers setting for columns 73 - 80 and columns 1 - 6. Updates _sequenceNumbers7380, _sequenceNumbers16, and the current editing fields and format line text.

Returns:
false = no change in the sequenceNumbers setting

getPopupItems

protected String getPopupItems(int popupLocation)
Returns this parser's contribution to the popup. The parser contributes to the Filter view submenu (Divisions, Code, Comments, Outline, Embedded SQL/CICS/DLI, Errors, Tasks) and to the Source submenu (Comment, Uncomment).

Overrides:
getPopupItems in class LpexCommonParser
Parameters:
popupLocation - the location on the pop-up menu of the items requested, one of:
LpexCommonParser.POPUP_TOP, LpexCommonParser.POPUP_FILTERVIEW, LpexCommonParser.POPUP_SOURCE, LpexCommonParser.POPUP_END
Returns:
this parser's contribution to the pop-up menu, or
null if none
See Also:
LpexCommonParser.defineFilterAction(java.lang.String, java.lang.String)

getPopupItem

protected String getPopupItem(String key)

setStyleAttributes

public void setStyleAttributes()
Defines this parser's style attributes. The following style characters are set: '_' (layout blanks), 'b' (separator), 'u' (user-defined word), 'r' (reserved word), 'f' (function), 'a' (date format), 'n' (numeric literal), 'p' (picture string), 'l' (nonnumeric literal), 't' (pseudo-text), 'c' (comment), '$' (comment task tag), 's' (sequence number), 'i' (indicator area), 'd' (compiler directive keyword), 'v' (compiler directive), 'e' (error), 'h' (preprocessor string).


getCommentStyleCharacters

public String getCommentStyleCharacters()
Returns the style characters used for styling comments ("cs$").

Overrides:
getCommentStyleCharacters in class LpexCommonParser

isTokenDelimiter

public boolean isTokenDelimiter(char ch)
Returns whether the specified character is a token delimiter. Only covers those characters which may be otherwise misinterpreted by a token-selection action.

Overrides:
isTokenDelimiter in class LpexCommonParser
Parameters:
ch - character queried, for example ')'
See Also:
LpexCommonParser.getToken(com.ibm.lpex.core.LpexDocumentLocation), LpexCommonParser.tokenBegin(com.ibm.lpex.core.LpexDocumentLocation), LpexCommonParser.tokenEnd(com.ibm.lpex.core.LpexDocumentLocation)

propertySet

protected void propertySet(String key)
Listens to changes to any of our parser properties in this view. The following parser properties are tracked: fields, fields.16, formatLineText, NSYMBOL, tabs, taskTags.

Overrides:
propertySet in class LpexCommonParser
Parameters:
key - base name of the parser property that was set, for example "autoIndent"
See Also:
LpexCommonParser.setProperty(String,String), LpexCommonParser.getProperty(java.lang.String), Parser properties

getNSYMBOL

protected void getNSYMBOL()
Sets _nSymbolNational for the current setting for the NSYMBOL compiler option. The NSYMBOL option is "NATIONAL"/"NAT" (the default), or "DBCS".


evaluateBeginElement

protected int evaluateBeginElement(int element)
Evaluates a parse range for incremental parse from the specified element up to the top of the document.

Returns:
new start element to parse from

evaluateEndElement

protected int evaluateEndElement(int element)
Evaluates a parse range for incremental parse from the specified element to the bottom of the document.

Returns:
new end element to parse to

addErrorMessage

protected void addErrorMessage(int element,
                               String message,
                               String argument)
Adds an error message with an argument for the specified document element. No more than 500 error messages are embedded in the view during one parse operation.

Parameters:
element - the text element the message refers to
message - base message key in the editor resources
argument - substitution argument used in formatting the message

addErrorMessage

protected void addErrorMessage(int element,
                               String message)
Adds an error message for the specified document element. No more than 500 error messages are embedded in the view during one parse operation.

Parameters:
element - the text element the message refers to
message - base message key in the editor resources

getLshToken

public String getLshToken()
Returns the current token for language-sensitive help (LSH). The token returned will serve (in common LSH implementations) as a key into the mapping table to the appropriate help panel. When null is returned, the LSH implementation should display a default language help panel.

In addition to language keywords, this parser generates the following 'tokens' for special situations:

Overrides:
getLshToken in class LpexCommonParser
See Also:
Language-sensitive help

getSqlLexer

protected SqlLexer getSqlLexer(LpexCharStream stream)
Returns the SqlLexer. The parser extending CobolParser to support embedded EXEC SQL statements must override this method to construct and return an SqlLexer object. The implementation of this method provided by CobolParser does nothing, except return null.

Parameters:
stream - input character stream for the lexer

getCicsLexer

protected CicsLexer getCicsLexer(LpexCharStream stream)
Returns the CicsLexer. The parser extending CobolParser to support embedded EXEC CICS statements must override this method to construct and return a CicsLexer object. The implementation of this method provided by CobolParser does nothing, except return null.

Parameters:
stream - input character stream for the lexer

getDliLexer

protected LpexSubparser getDliLexer(LpexCharStream stream)
Returns the DliLexer. The parser extending CobolParser to support embedded EXEC DLI statements must override this method to construct and return a DliLexer object. The implementation of this method provided by CobolParser does nothing, except return null.

Parameters:
stream - input character stream for the lexer

splitLine

protected void splitLine()
Override the default splitLine behaviour. When text is split, indent it to the same level as the previous line, when applicable. Includes special handling for comments and literals.

Overrides:
splitLine in class LpexCommonParser
See Also:
LpexCommonParser.getTextIndent(int)

splitLine

protected void splitLine(boolean undoCheck)
Override the default splitLine behaviour. When text is split, indent it to the same level as the previous line, when applicable. Includes special handling for comments and literals.

Parameters:
undoCheck - set undo checkpoints within the action

join

protected int join()
Override the default join behaviour. When text is joined, remove the leading blanks.

Returns:
1 on a delete line (shift up), 2 on a simple join, 3 on a complex join, -1 otherwise

join

protected int join(boolean undoCheck)
Override the default join behaviour. When text is joined, remove the leading blanks.

Parameters:
undoCheck - set undo checkpoints within the action
Returns:
1 on a delete line (shift up), 2 on a simple join, 3 on a complex join, -1 otherwise

backSpace

protected void backSpace()
Override the default backspace behaviour. If no text is selected, and the position is at the start of a line, perform a join with the previous line instead of a delete. If text is selected, perform a default backspace action, then call split, then join.


delete

protected void delete()
Override the default delete behaviour. If no text is selected, and the position is at the end of a line, perform a join instead of a delete. If text is selected, perform a default delete action, then call split, then join.


getTokenUsingFullText

public String getTokenUsingFullText(LpexDocumentLocation loc)
Like getToken(LpexDocumentLocation loc), except that loc is expected to be relative to the fullText of the line (i.e. with sequence numbers present).

Parameters:
loc - location with position within the fullText of the line

getTokenLocationUsingFullText

public LpexDocumentLocation getTokenLocationUsingFullText(LpexDocumentLocation fullTextLoc)
Like getTokenLocation(LpexDocumentLocation loc), except that loc is expected to be relative to the fullText of the line (i.e. with sequence numbers present).

Parameters:
loc - location with position within the fullText of the line

elementStyleUsingFullText

public String elementStyleUsingFullText(int element)
Like LpexView.elementStyle(int) except that the style string will have style characters for "hidden" sequence numbers.

Parameters:
element - element

documentLocationUsingFullText

public LpexDocumentLocation documentLocationUsingFullText()
Like LpexView.documentLocation() except position is relevant to fullText.

Returns:

upperCaseElement

protected void upperCaseElement(int _startElement,
                                int _endElement,
                                int topPosition,
                                int bottomPosition)
Performs uppercasing of Elements if requested


setDocumentElementText

protected void setDocumentElementText(LpexView view,
                                      int iElement,
                                      String strElement)
Associates the text with the editor element line Removes the null at the end of the string


toUpperCase

protected String toUpperCase(String name)
Utility method for selectively uppercasing the characters in a string, for use as an IBM i *NAME value. This method is used, for example, when uppercasing object names, library names, and member names. Characters within double-quotes are left as-is.

Parameters:
name - The name to be uppercased.
Returns:
The *NAME value, selectively uppercased.

upperCaseCOBOLLines

protected void upperCaseCOBOLLines(LpexView lpexView)

LPEX
4.4.0

Copyright � 2016 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.