|
SWT LPEX v3.0.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.lpex.core.LpexCommonParser
com.ibm.lpex.cobol.CobolParser
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. |
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 |
protected static final int PARSE_MODE_CODE
protected static final int PARSE_MODE_PSEUDO_TEXT
protected static final int PARSE_MODE_PICTURE
protected static final int PARSE_MODE_PICTURE_IS
protected static final int PARSE_MODE_OPTIONAL_ID_PARAGRAPH
protected static final int PARSE_MODE_COMMENT_ENTRY
protected static final int PARSE_MODE_FUNCTION
protected static final int PARSE_MODE_DATE
protected static final int PARSE_MODE_DATE_FORMAT
protected static final int PARSE_MODE_DATE_FORMAT_IS
protected static final int PARSE_MODE_PREPROCESSOR
protected static final int PARSE_MODE_LAST
public static final String CLASS_FWDLINK
public static final String CLASS_BWDLINK
public static final String CLASS_BLANK
public static final String CLASS_ERROR
public static final String CLASS_COMMENT
public static final String CLASS_DIRECTIVE
public static final String CLASS_DIVISION
public static final String CLASS_SECTION
public static final String CLASS_AREAA
public static final String CLASS_AREAB
public static final String CLASS_PREPROCESSOR
public static final String CLASS_CICS
public static final String CLASS_SQL
protected long _classForwardLink
protected long _classBackwardLink
protected long _classBlank
protected long _classError
protected long _classComment
protected long _classDirective
protected long _classDivision
protected long _classSection
protected long _classAreaA
protected long _classAreaB
protected long _classPreprocessor
protected long _classCics
protected long _classSql
protected long _classAll
protected boolean _nSymbolNational
protected int _startElement
protected int _endElement
protected int _currentElement
protected int _currentBytePosition
protected int _currentCharacterPosition
protected int _previousCharacterWidth
protected boolean _currentElementCompleted
protected CobolParser.ParseElement _parseElements
protected CobolParser.ParseElement _freeParseElements
protected int _saveTokenCharacterElement
protected int _saveTokenCharacterBytePosition
protected int _saveTokenCharacterPosition
protected char _saveTokenCharacter
protected boolean _saveTokenCharacterValid
protected StringBuffer _directiveTokenText
protected int _directiveTokenStartBytePosition
protected int _directiveStartBytePosition
protected boolean _directiveError
protected int _parseMode
protected CobolParser.TokenFragment _firstTokenFragment
protected CobolParser.TokenFragment _lastTokenFragment
protected StringBuffer _tokenText
protected boolean _inNonnumericLiteral
protected boolean _tokenHasDelimiter
protected CobolWords.Word _reservedWord
protected int _integerLength
protected int _decimalLength
protected int _exponentLength
protected boolean _dbcsUserDefinedWord
protected char _nonnumericLiteralType
protected char _nonnumericLiteralDelimiter
protected int _nonnumericLiteralLength
protected boolean _nonnumericLiteralHasClosingDelimiter
protected boolean _nonnumericLiteralHasNonhexadecimal
protected boolean _nonnumericLiteralHasNonbinary
protected boolean _nonnumericLiteralHasDBCS
protected boolean _nonnumericLiteralHasSBCS
protected int _multiTokenStartElement
Constructor Detail |
public CobolParser(LpexView lpexView)
Method Detail |
public void parseAll()
public void parseElement(int element)
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().
protected void parse()
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().
protected void reInitCurrentElement(int currentCharacterPosition)
protected void initCurrentElement()
A directive or comment line will be parsed in its entirety before this method returns.
protected boolean parseIndicatorArea()
protected CobolWords.Word findDirective()
protected boolean isDirectiveLine()
protected void parseDirectiveLine()
protected boolean getDirectiveToken()
protected void completeCurrentElement()
protected void flushElements()
protected CobolParser.ParseElement findParseElement(int element)
protected boolean continueParse()
protected boolean getToken()
protected void setTokenEnd()
protected boolean nextTokenCharacter()
protected boolean nextTokenElement()
protected void nextCharacter()
protected void saveTokenCharacter()
protected void parseToken()
protected void parseCodeToken()
protected boolean isSeparator()
protected boolean isCommaOrSemicolon()
protected boolean isPeriod()
protected void parseSeparator()
protected boolean isReservedWord()
protected void parseReservedWord()
protected boolean isNumericLiteral()
protected int maxDigits()
protected int maxMantissa()
protected int maxExponent()
protected void parseNumericLiteral()
protected boolean isPreprocessorStart()
protected void parsePreprocessorStart()
protected boolean isUserDefinedWord()
protected void parseUserDefinedWord()
protected String nonnumericLiteralTypes()
protected boolean isNonnumericLiteral()
protected void parseNonnumericLiteral()
protected boolean isPseudoTextStart()
protected void parsePseudoTextStart()
protected void parseErrorToken()
protected void parsePseudoTextToken()
protected void parsePictureToken()
protected void parsePictureIsToken()
protected int maxPicture()
protected void parsePictureString()
protected void parseOptionalIdParagraphToken()
protected void parseCommentEntryToken()
protected boolean isFunctionName()
protected void parseFunctionToken()
protected void parseDateToken()
protected void parseDateFormatToken()
protected void parseDateFormatIsToken()
protected void parseDateFormatString()
protected void parsePreprocessorToken()
protected void setToken(char styleCharacter)
protected void setToken(char styleCharacter, long classes)
protected void setToken(char styleCharacter, long classes, String message)
protected void setToken(char styleCharacter, long classes, String message, String argument)
protected void linkElements(int startElement, int endElement)
Multiple elements belonging to one construct are doubly-linked with the _classForwardLink and _classBackwardLink.
protected void linkLexedElements(int startElement, int endElement)
public ResourceBundle getProfile()
public String getLanguage()
public String getLanguage(LpexDocumentLocation loc)
protected void initializeParser()
protected boolean checkSequenceNumbersSetting()
protected String getPopupItems(int popupLocation)
public void setStyleAttributes()
public String getCommentStyleCharacters()
public void setProperty(String key, String value)
protected void getNSYMBOL()
protected int evaluateBeginElement(int element)
protected int evaluateEndElement(int element)
protected void addErrorMessage(int element, String message, String argument)
protected void addErrorMessage(int element, String message)
public String getLshToken()
In addition to language keywords, this parser generates the following 'tokens' for special situations:
protected SqlLexer getSqlLexer(LpexCharStream stream)
protected CicsLexer getCicsLexer(LpexCharStream stream)
|
SWT LPEX v3.0.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |