Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

com.ibm.lpex.cobol
Class CobolParser

java.lang.Object
  extended bycom.ibm.lpex.core.LpexCommonParser
      extended bycom.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.

Actions added by this document parser for selective views of the document:

Editor action modified by this document parser:

Parser properties handled directly by this parser:


Nested Class Summary
 class CobolParser.ParseElement
          The ParseElement class 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 element class used by this parser.
protected  long _classAreaA
          Bitmask for element class used by this parser.
protected  long _classAreaB
          Bitmask for element class used by this parser.
protected  long _classBackwardLink
          Bitmask for element class used by this parser.
protected  long _classBlank
          Bitmask for element class used by this parser.
protected  long _classCics
          Bitmask for element class used by this parser.
protected  long _classComment
          Bitmask for element class used by this parser.
protected  long _classDirective
          Bitmask for element class used by this parser.
protected  long _classDivision
          Bitmask for element class used by this parser.
protected  long _classError
          Bitmask for element class used by this parser.
protected  long _classForwardLink
          Bitmask for element class used by this parser.
protected  long _classPreprocessor
          Bitmask for element class used by this parser.
protected  long _classSection
          Bitmask for element class used by this parser.
protected  long _classSql
          Bitmask for element class used by this parser.
protected  int _currentBytePosition
          The current byte position of the current character (ZERO-based).
protected  int _currentCharacterPosition
          The current character position of the current character (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  boolean _directiveError
          Indicates that the current directive is in error.
protected  int _directiveStartBytePosition
          The character position of the start of the directive token.
protected  int _directiveTokenStartBytePosition
          The byte position of the start of the directive token.
protected  StringBuffer _directiveTokenText
          The current directive token.
protected  int _endElement
          The last element in the current parse range.
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 width 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  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  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 CLASS_AREAA
          Element class used by this parser.
static String CLASS_AREAB
          Element class used by this parser.
static String CLASS_BLANK
          Element class used by this parser.
static String CLASS_BWDLINK
          Element class used by this parser.
static String CLASS_CICS
          Element class used by this parser.
static String CLASS_COMMENT
          Element class used by this parser.
static String CLASS_DIRECTIVE
          Element class used by this parser.
static String CLASS_DIVISION
          Element class used by this parser.
static String CLASS_ERROR
          Element class used by this parser.
static String CLASS_FWDLINK
          Element class used by this parser.
static String CLASS_PREPROCESSOR
          Element class used by this parser.
static String CLASS_SECTION
          Element class used by this parser.
static String CLASS_SQL
          Element class used by this parser.
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 found the word "EXEC".
protected static int PARSE_MODE_PSEUDO_TEXT
          An opening pseudo-text delimiter has been detected.
 
Fields inherited from class com.ibm.lpex.core.LpexCommonParser
ATTRIBUTES_COMMENT, ATTRIBUTES_COMMENT_KEYWORD, ATTRIBUTES_COMMENT1, ATTRIBUTES_DEFAULT, ATTRIBUTES_DIRECTIVE, ATTRIBUTES_ERROR, 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_DDS, LANGUAGE_FORTRAN, LANGUAGE_HLASM, LANGUAGE_HTML, LANGUAGE_JAVA, LANGUAGE_JCL, LANGUAGE_LISP, LANGUAGE_PERL, LANGUAGE_PLI, LANGUAGE_REXX, LANGUAGE_RPG, 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_ERRORS, MSG_POPUP_EXCLUDESELECTION, MSG_POPUP_FILTERVIEWMENU, MSG_POPUP_INSERTMENU, MSG_POPUP_SELECTEDMENU, MSG_POPUP_SHOWALL, MSG_POPUP_SOURCEMENU, PARSE_PENDING_CHANGE_MASK, PARSE_PENDING_NEXT_DELETED_MASK, PARSE_PENDING_NEXT_SHOW_DELETED_MASK, PARSE_PENDING_PREV_DELETED_MASK, PARSE_PENDING_PREV_SHOW_DELETED_MASK, PLATFORM_AWT, PLATFORM_SWT, PLATFORM_SWT_KEY, 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
 
Constructor Summary
CobolParser(LpexView lpexView)
          Constructor for the parser.
 
Method Summary
protected  void addErrorMessage(int element, String message)
          Display an error message for an element.
protected  void addErrorMessage(int element, String message, String argument)
          Display an error message with an argument for an element.
protected  boolean checkSequenceNumbersSetting()
          Check the sequence numbers setting for columns 73 - 80.
protected  void completeCurrentElement()
          Complete the parsing of the current line.
protected  boolean continueParse()
          Returns true if parsing should be continued (we are currently inside a COBOL construct).
protected  int evaluateBeginElement(int element)
          Evaluate a parse range for incremental parse from the specified element up to the top of the document.
protected  int evaluateEndElement(int element)
          Evaluate 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)
          Find the active ParseElement for the specified element.
protected  void flushElements()
          Flush any of the cached elements with which we are finished.
protected  CicsLexer getCicsLexer(LpexCharStream stream)
          Retrieve the CicsLexer.
 String getCommentStyleCharacters()
          Returns the style characters used for styling comments ("cs").
protected  boolean getDirectiveToken()
          Get the next directive token.
 String getLanguage()
          Returns "COBOL", the language supported by this parser.
 String getLanguage(LpexDocumentLocation loc)
          Retrieve a string identifying the language segment at the specified location.
 String getLshToken()
          Get the current token for language-sensitive help (LSH).
protected  void getNSYMBOL()
          Retrieve the current setting for the NSYMBOL compiler option.
protected  String getPopupItems(int popupLocation)
          Retrieve parser's contribution to the popup.
 ResourceBundle getProfile()
          Returns the parser's properties profile resource bundle.
protected  SqlLexer getSqlLexer(LpexCharStream stream)
          Retrieve the SqlLexer.
protected  boolean getToken()
          Get the next token.
protected  void initCurrentElement()
          Initialize the current element for parsing.
protected  void initializeParser()
          Initialize the parser for an LPEX document view: set up style attributes for the styles we need, classes, etc., and initialize the view for the language-sensitive edit features supported.
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 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.
protected  boolean isUserDefinedWord()
          Returns true if the current token is a user-defined word.
protected  void linkElements(int startElement, int endElement)
          Link the specified elements together if necessary.
protected  void linkLexedElements(int startElement, int endElement)
          Link the specified lexed elements if necessary.
protected  int maxDigits()
          Returns the maximum number of digits allowed in a nonnumeric 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()
          Advance to the next character in the current element.
protected  boolean nextTokenCharacter()
          Advance to the next token character.
protected  boolean nextTokenElement()
          Advance 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()
          Perform the parse.
 void parseAll()
          Total parse of the entire document.
protected  void parseCodeToken()
          Parse the current code token (_tokenText).
protected  void parseCommentEntryToken()
          Parse the current comment entry token.
protected  void parseDateFormatIsToken()
          Parse the current date format is clause token.
protected  void parseDateFormatString()
          Parse the current date format.
protected  void parseDateFormatToken()
          Parse the current date format clause token.
protected  void parseDateToken()
          Parse the current date clause token.
protected  void parseDirectiveLine()
          Parse a directive line.
 void parseElement(int element)
          Incremental parse.
protected  void parseErrorToken()
          Parse the current error token.
protected  void parseFunctionToken()
          Parse the current function clause token.
protected  boolean parseIndicatorArea()
          Parse the indicator area.
protected  void parseNonnumericLiteral()
          Parse the current nonnumeric literal.
protected  void parseNumericLiteral()
          Parse the current numeric literal.
protected  void parseOptionalIdParagraphToken()
          Parse the current identification division optional paragraph token.
protected  void parsePictureIsToken()
          Parse the current token in the PICTURE IS clause.
protected  void parsePictureString()
          Parse the current picture string.
protected  void parsePictureToken()
          Parse the current token in the PICTURE clause.
protected  void parsePreprocessorStart()
          Parse the current "EXEC" token.
protected  void parsePreprocessorToken()
          Parse the current preprocessor string token.
protected  void parsePseudoTextStart()
          Parse the current opening pseudo-text delimiter.
protected  void parsePseudoTextToken()
          Parse the current pseudo-text token.
protected  void parseReservedWord()
          Parse the current reserved word.
protected  void parseSeparator()
          Parses the current separator token.
protected  void parseToken()
          Parse the current token.
protected  void parseUserDefinedWord()
          Parse the current user-defined word.
protected  void reInitCurrentElement(int currentCharacterPosition)
          Reinitialize the current element for parsing.
protected  void saveTokenCharacter()
          Save the current token character.
 void setProperty(String key, String value)
          Listen to changes in the NSYMBOL parser property.
 void setStyleAttributes()
          Define parser's style attributes.
protected  void setToken(char styleCharacter)
          Set the style character for the current token.
protected  void setToken(char styleCharacter, long classes)
          Set the style character and classes for the current token.
protected  void setToken(char styleCharacter, long classes, String message)
          Set the style character, classes and error message for the current token.
protected  void setToken(char styleCharacter, long classes, String message, String argument)
          Set the style character, classes, error message and error message argument for the current token.
protected  void setTokenEnd()
          Set the (saved) current character as the end of the current token.
 
Methods inherited from class com.ibm.lpex.core.LpexCommonParser
addMessage, addMessage, addMessage, blockMarkWord, cursorIndent, expandProtoKeyword, getInstallStyleAttributes, getPopupParserItems, getPopupViewItems, getProperty, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isDebuggable, isTokenDelimiter, lineComment, lpexView, matchToken, newLine, openLine, parse, removeMessages, removeMessages, resetParser, setStyle, splitLine, 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 found the word "EXEC". Now it is looking for the word "END-EXEC". If "SQL" or "CICS" is encountered, the appropriate SQL/CICS 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


 

 

CLASS_FWDLINK

public static final String CLASS_FWDLINK

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_BWDLINK

public static final String CLASS_BWDLINK

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_BLANK

public static final String CLASS_BLANK

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_ERROR

public static final String CLASS_ERROR

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_COMMENT

public static final String CLASS_COMMENT

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_DIRECTIVE

public static final String CLASS_DIRECTIVE

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_DIVISION

public static final String CLASS_DIVISION

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_SECTION

public static final String CLASS_SECTION

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_AREAA

public static final String CLASS_AREAA

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_AREAB

public static final String CLASS_AREAB

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_PREPROCESSOR

public static final String CLASS_PREPROCESSOR

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_CICS

public static final String CLASS_CICS

Element class used by this parser.

See Also:
Constant Field Values


 

 

CLASS_SQL

public static final String CLASS_SQL

Element class used by this parser.

See Also:
Constant Field Values


 

 

_classForwardLink

protected long _classForwardLink

Bitmask for element class used by this parser.


 

 

_classBackwardLink

protected long _classBackwardLink

Bitmask for element class used by this parser.


 

 

_classBlank

protected long _classBlank

Bitmask for element class used by this parser.


 

 

_classError

protected long _classError

Bitmask for element class used by this parser.


 

 

_classComment

protected long _classComment

Bitmask for element class used by this parser.


 

 

_classDirective

protected long _classDirective

Bitmask for element class used by this parser.


 

 

_classDivision

protected long _classDivision

Bitmask for element class used by this parser.


 

 

_classSection

protected long _classSection

Bitmask for element class used by this parser.


 

 

_classAreaA

protected long _classAreaA

Bitmask for element class used by this parser.


 

 

_classAreaB

protected long _classAreaB

Bitmask for element class used by this parser.


 

 

_classPreprocessor

protected long _classPreprocessor

Bitmask for element class used by this parser.


 

 

_classCics

protected long _classCics

Bitmask for element class used by this parser.


 

 

_classSql

protected long _classSql

Bitmask for element class used by this parser.


 

 

_classAll

protected long _classAll

Bitmask for element class used by this parser.


 

 

_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).


 

 

_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.


 

 

_currentBytePosition

protected int _currentBytePosition

The current byte position of the current character (ZERO-based).


 

 

_currentCharacterPosition

protected int _currentCharacterPosition

The current character position of the current character (ZERO-based).


 

 

_previousCharacterWidth

protected int _previousCharacterWidth

The width 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 start of the directive token.


 

 

_directiveStartBytePosition

protected int _directiveStartBytePosition

The character position of the start of the directive token.


 

 

_directiveError

protected boolean _directiveError

Indicates that the current directive is in error.


 

 

_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:

  • '\''
  • '"'
  • 'G' - DBCS literal: G"..", or N".." when the NSYMBOL(DBCS) compiler option is in effect
  • 'N' - national literal N".."
  • 'X'
  • 'x' - hex national literal NX".."
  • 'Z'.


 

 

_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.

Constructor Detail

 

 

CobolParser

public CobolParser(LpexView lpexView)

Constructor for the parser. Add all of the parser specifics to the associated LPEX document view. Initializes the LpexView for the parser: it sets up all the style attributes, element classes, etc. for the language-sensitive edit features supported.

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

 

 

parseAll

public void parseAll()

Total parse of the entire document.

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 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, to add and remove error-message show lines (e.g., from a COBOL syntax checker), use the LpexCommonParser methods addMessage() and removeMessages().

Specified by:
parseElement in class LpexCommonParser

Parameters:
element - the element whose committed change triggered the parse, or the element that precedes / follows a deleted block. The parser may identify other neighbouring elements that will have to be reparsed as a unit
See Also:
LpexView.parsePending(int), LpexView.elementParsed(int), Total and incremental parse


 

 

parse

protected void parse()

Perform the parse. This method assumes that _startElement and _endElement have been set. While the parse is performed in here, the initial _endElement may be further extended.

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, to add and remove error-message show lines (e.g., from a COBOL syntax checker), use the LpexCommonParser methods addMessage() and removeMessages().


 

 

reInitCurrentElement

protected void reInitCurrentElement(int currentCharacterPosition)

Reinitialize 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 _currentElement


 

 

initCurrentElement

protected void initCurrentElement()

Initialize 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.


 

 

parseIndicatorArea

protected boolean parseIndicatorArea()

Parse 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 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()

Parse a directive line.


 

 

getDirectiveToken

protected boolean getDirectiveToken()

Get the next directive token.

Returns:
true if a directive token (_directiveTokenText) was found


 

 

completeCurrentElement

protected void completeCurrentElement()

Complete the parsing of the current line.


 

 

flushElements

protected void flushElements()

Flush any of the cached elements with which we are finished.


 

 

findParseElement

protected CobolParser.ParseElement findParseElement(int element)

Find 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()

Get the next token. On exit, the new token is in _tokenText.

Returns:
true a token was found


 

 

setTokenEnd

protected void setTokenEnd()

Set the (saved) current character as the end of the current token.


 

 

nextTokenCharacter

protected boolean nextTokenCharacter()

Advance 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 this point, _currentCharacterPosition will point to the next non-space character (next token), 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()

Advance 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()

Advance 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()

Save the current token character.


 

 

parseToken

protected void parseToken()

Parse the current token. Calls the appropriate parseXxxToken() method based on the current parse mode.


 

 

parseCodeToken

protected void parseCodeToken()

Parse 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.


 

 

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 nonnumeric 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()

Parse 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 parse mode to PREPROCESSOR.


 

 

isUserDefinedWord

protected boolean isUserDefinedWord()

Returns true if the current token is a user-defined word.


 

 

parseUserDefinedWord

protected void parseUserDefinedWord()

Parse 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()

Parse the current nonnumeric literal.


 

 

isPseudoTextStart

protected boolean isPseudoTextStart()

Returns true if the current token is an opening pseudo-text delimiter.


 

 

parsePseudoTextStart

protected void parsePseudoTextStart()

Parse the current opening pseudo-text delimiter.


 

 

parseErrorToken

protected void parseErrorToken()

Parse the current error token.


 

 

parsePseudoTextToken

protected void parsePseudoTextToken()

Parse the current pseudo-text token.


 

 

parsePictureToken

protected void parsePictureToken()

Parse the current token in the PICTURE clause.


 

 

parsePictureIsToken

protected void parsePictureIsToken()

Parse 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()

Parse the current picture string.


 

 

parseOptionalIdParagraphToken

protected void parseOptionalIdParagraphToken()

Parse the current identification division optional paragraph token.


 

 

parseCommentEntryToken

protected void parseCommentEntryToken()

Parse the current comment entry token.


 

 

isFunctionName

protected boolean isFunctionName()

Returns true if the current token is a function name.


 

 

parseFunctionToken

protected void parseFunctionToken()

Parse the current function clause token.


 

 

parseDateToken

protected void parseDateToken()

Parse the current date clause token.


 

 

parseDateFormatToken

protected void parseDateFormatToken()

Parse the current date format clause token.


 

 

parseDateFormatIsToken

protected void parseDateFormatIsToken()

Parse the current date format is clause token.


 

 

parseDateFormatString

protected void parseDateFormatString()

Parse the current date format.


 

 

parsePreprocessorToken

protected void parsePreprocessorToken()

Parse the current preprocessor string token. If it is "END-EXEC", return parse mode to CODE. If it is "SQL" or "CICS", try to activate the appropriate lexer.


 

 

setToken

protected void setToken(char styleCharacter)

Set the style character for the current token.


 

 

setToken

protected void setToken(char styleCharacter,
                        long classes)

Set the style character and classes for the current token.


 

 

setToken

protected void setToken(char styleCharacter,
                        long classes,
                        String message)

Set the style character, classes and error message for the current token.


 

 

setToken

protected void setToken(char styleCharacter,
                        long classes,
                        String message,
                        String argument)

Set the style character, classes, error message and error message argument for the current token.


 

 

linkElements

protected void linkElements(int startElement,
                            int endElement)

Link 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)

Link 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 the parser's properties profile resource bundle.

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)

Retrieve 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

Returns:
one of: LpexCommonParser.LANGUAGE_COBOL, LpexCommonParser.LANGUAGE_CICS, LpexCommonParser.LANGUAGE_SQL
See Also:
LpexCommonParser.getLanguage()


 

 

initializeParser

protected void initializeParser()

Initialize the parser for an LPEX document view: set up style attributes for the styles we need, classes, etc., and initialize the view for the language-sensitive edit features supported.


 

 

checkSequenceNumbersSetting

protected boolean checkSequenceNumbersSetting()

Check the sequence numbers setting for columns 73 - 80. Updates _sequenceNumbers7380 and the format line text.

Returns:
false = no change in the "sequenceNumbers 73 8" setting


 

 

getPopupItems

protected String getPopupItems(int popupLocation)

Retrieve parser's contribution to the popup. This parser contributes to the "Filter view" submenu (Comments, Divisions, Outline, Embedded SQL/CICS, Errors).

Overrides:
getPopupItems in class LpexCommonParser

Parameters:
popupLocation - the location on the popup 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 popup menu, or
null if none


 

 

setStyleAttributes

public void setStyleAttributes()

Define 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), 's' (sequence number), 'i' (indicator area), 'd' (compiler directive), 'e' (error), 'h' (preprocessor string).


 

 

getCommentStyleCharacters

public String getCommentStyleCharacters()

Returns the style characters used for styling comments ("cs"). This is used by compare sessions when the compare.ignoreComments option is in effect.

Overrides:
getCommentStyleCharacters in class LpexCommonParser


 

 

setProperty

public void setProperty(String key,
                        String value)

Listen to changes in the NSYMBOL parser property. This property indicates the NSYMBOL compiler option. The NSYMBOL option is "NATIONAL"/"NAT" (the default), or "DBCS".

Overrides:
setProperty in class LpexCommonParser

Parameters:
key - document parser property name, for example, "proto.doc" for this parser's expansion of the keyword "doc" by the proto action, or "view.proto.doc" to define this property in the current view's instance of the parser
value - parser property value, or null to remove an overriding setting
See Also:
LpexCommonParser.getLanguage(), LpexCommonParser.getProperty(java.lang.String)


 

 

getNSYMBOL

protected void getNSYMBOL()

Retrieve the current setting for the NSYMBOL compiler option. The NSYMBOL option is "NATIONAL"/"NAT" (the default), or "DBCS".


 

 

evaluateBeginElement

protected int evaluateBeginElement(int element)

Evaluate 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)

Evaluate 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)

Display an error message with an argument for an element.


 

 

addErrorMessage

protected void addErrorMessage(int element,
                               String message)

Display an error message for an element.


 

 

getLshToken

public String getLshToken()

Get 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:

  • lexical errors: bad_indicator_error_help, blank_cont_error_help, area_a_cont_error_help, token_too_big_error_help, no_delimiter_error_help, bad_item_error_help, bad_directive_error_help, bad_cont_error_help, empty_literal_error_help, bad_boolean_error_help, bad_hex_error_help, odd_hex_error_help, bad_dbcs_error_help, no_function_name_error_help, bad_date_error_help
  • embedded CICS/SQL: cics_help, sql_help, preprocessor_help
  • comments: comment_help, comment_73_80_help (ILE COBOL)
  • others: indicator_help, comp_op_help, math_op_help, nonnumeric_literal_help, numeric_literal_help, picture_string_help, pseudo_text_help, seqnum_help, separator_help, user_defined_help.

Overrides:
getLshToken in class LpexCommonParser

See Also:
Language-sensitive help


 

 

getSqlLexer

protected SqlLexer getSqlLexer(LpexCharStream stream)

Retrieve the SqlLexer. The parser extending CobolParser to support embedded 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 SQL lexer


 

 

getCicsLexer

protected CicsLexer getCicsLexer(LpexCharStream stream)

Retrieve the CicsLexer. The parser extending CobolParser to support embedded 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 CICS lexer


 

Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD