|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.lpex.core.LpexCommonParser | +--com.ibm.lpex.cobol.CobolParser
Document parser for COBOL.
Actions added by this tokenizer: comments, divisions, areaA, preprocessor for selective views of the document: comments, divisions, a logical outline, embedded SQL/CICS.
Inner 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 java.lang.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 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 java.lang.StringBuffer |
_tokenText
The current token. |
static java.lang.String |
CLASS_AREAA
Element class used by this parser. |
static java.lang.String |
CLASS_AREAB
Element class used by this parser. |
static java.lang.String |
CLASS_BLANK
Element class used by this parser. |
static java.lang.String |
CLASS_BWDLINK
Element class used by this parser. |
static java.lang.String |
CLASS_CICS
Element class used by this parser. |
static java.lang.String |
CLASS_COMMENT
Element class used by this parser. |
static java.lang.String |
CLASS_DIRECTIVE
Element class used by this parser. |
static java.lang.String |
CLASS_DIVISION
Element class used by this parser. |
static java.lang.String |
CLASS_ERROR
Element class used by this parser. |
static java.lang.String |
CLASS_FWDLINK
Element class used by this parser. |
static java.lang.String |
CLASS_PREPROCESSOR
Element class used by this parser. |
static java.lang.String |
CLASS_SECTION
Element class used by this parser. |
static java.lang.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 used. |
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,
java.lang.String message)
Display an error message for an element. |
protected void |
addErrorMessage(int element,
java.lang.String message,
java.lang.String argument)
Display an error message with an argument for an element. |
protected void |
completeCurrentElement()
Complete the parsing of the current line. |
protected boolean |
continueParse()
Return 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 file. |
protected int |
evaluateEndElement(int element)
Evaluate a parse range for incremental parse from the specified element to the bottom of the file. |
protected CobolWords.Word |
findDirective()
Return 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. |
protected boolean |
getDirectiveToken()
Get the next directive token. |
java.lang.String |
getHelpPage()
Retrieve the name of the COBOL help page that the parser identifies as appropriate for the currently selected token |
java.lang.String |
getLanguage()
Returns "COBOL", the language supported by this parser. |
java.lang.String |
getLanguage(LpexDocumentLocation loc)
Retrieve a string identifying the language segment at the specified location. |
java.lang.String |
getPopupViewItems()
Return parser's items for the popup View submenu: comments, divisions, areaA, preprocessor statements. |
java.util.ResourceBundle |
getProfile()
Return 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()
Return true if the current token is a comma or semicolon. |
protected boolean |
isDirectiveLine()
Return true if the current line is a directive line. |
protected boolean |
isFunctionName()
Return true if the current token is a function name. |
protected boolean |
isNonnumericLiteral()
Return true if the current token is a nonnumeric literal. |
protected boolean |
isNumericLiteral()
Return true if the current token is a numeric literal. |
protected boolean |
isPeriod()
Return true if the current token is a period. |
protected boolean |
isPreprocessorStart()
Return true if the current token is "EXEC". |
protected boolean |
isPseudoTextStart()
Return true if the current token is an opening
pseudo-text delimiter. |
protected boolean |
isReservedWord()
Return true if the current token is a reserved word. |
protected boolean |
isSeparator()
Return true if the current token is a separator. |
protected boolean |
isUserDefinedWord()
Return 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 int |
maxDigits()
Return the maximum number of digits allowed in a nonnumeric literal. |
protected int |
maxExponent()
Return the maximum number of digits allowed in the exponent of a floating-point literal. |
protected int |
maxMantissa()
Return the maximum number of digits allowed in the mantissa of a floating-point literal. |
protected int |
maxPicture()
Return 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 java.lang.String |
nonnumericLiteralTypes()
Return 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. |
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 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()
Parse 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 |
setStyleAttributes(boolean colours)
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,
java.lang.String message)
Set the style character, classes and error message for the current token. |
protected void |
setToken(char styleCharacter,
long classes,
java.lang.String message,
java.lang.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, blockMarkWord, cursorIndent, getAutoIndent, getPopupParserItems, getProperty, getToken, indentText, indentText, isTokenDelimiter, lpexView, matchToken, newLine, openLine, parse, proto, removeMessages, resetParser, setAutoIndent, setErrorMessages, setProperty, setStyle, splitLine, styleString, terminateParser, textIndent, 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 java.lang.String CLASS_FWDLINK
public static final java.lang.String CLASS_BWDLINK
public static final java.lang.String CLASS_BLANK
public static final java.lang.String CLASS_ERROR
public static final java.lang.String CLASS_COMMENT
public static final java.lang.String CLASS_DIRECTIVE
public static final java.lang.String CLASS_DIVISION
public static final java.lang.String CLASS_SECTION
public static final java.lang.String CLASS_AREAA
public static final java.lang.String CLASS_AREAB
public static final java.lang.String CLASS_PREPROCESSOR
public static final java.lang.String CLASS_CICS
public static final java.lang.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 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 java.lang.StringBuffer _directiveTokenText
protected int _directiveTokenStartBytePosition
protected int _directiveStartBytePosition
protected boolean _directiveError
protected int _parseMode
protected CobolParser.TokenFragment _firstTokenFragment
protected CobolParser.TokenFragment _lastTokenFragment
protected java.lang.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)
lpexView
- the LPEX document view associated with this parserMethod Detail |
public void parseAll()
parseAll
in class LpexCommonParser
public void parseElement(int element)
parseElement
in class LpexCommonParser
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 unitprotected void parse()
protected void reInitCurrentElement(int currentCharacterPosition)
protected void initCurrentElement()
protected CobolWords.Word findDirective()
protected boolean isDirectiveLine()
protected void parseDirectiveLine()
protected boolean getDirectiveToken()
true
if a directive token (_directiveTokenText)
was foundprotected void completeCurrentElement()
protected void flushElements()
protected CobolParser.ParseElement findParseElement(int element)
null
if there is no ParseElement for the given elementprotected boolean continueParse()
true
if parsing should be continued (we are currently
inside a COBOL construct).protected boolean getToken()
true
a token was foundprotected void setTokenEnd()
protected boolean nextTokenCharacter()
true
if the next token character is contiguous to the
current token characterprotected boolean nextTokenElement()
true
if another token element was found, or
false
if no more token elements are found within the
current parse rangeprotected void nextCharacter()
protected void saveTokenCharacter()
protected void parseToken()
protected void parseCodeToken()
protected boolean isSeparator()
true
if the current token is a separator.protected boolean isCommaOrSemicolon()
true
if the current token is a comma or semicolon.protected boolean isPeriod()
true
if the current token is a period.protected void parseSeparator()
protected boolean isReservedWord()
true
if the current token is a reserved word.protected void parseReservedWord()
protected boolean isNumericLiteral()
true
if the current token is a numeric literal.protected int maxDigits()
protected int maxMantissa()
protected int maxExponent()
protected void parseNumericLiteral()
protected boolean isPreprocessorStart()
true
if the current token is "EXEC".protected void parsePreprocessorStart()
protected boolean isUserDefinedWord()
protected void parseUserDefinedWord()
protected java.lang.String nonnumericLiteralTypes()
protected boolean isNonnumericLiteral()
true
if the current token is a nonnumeric literal.protected void parseNonnumericLiteral()
protected boolean isPseudoTextStart()
true
if the current token is an opening
pseudo-text delimiter.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()
true
if the current token is a function name.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, java.lang.String message)
protected void setToken(char styleCharacter, long classes, java.lang.String message, java.lang.String argument)
protected void linkElements(int startElement, int endElement)
startElement
and endElement
are the same element.
Multiple elements belonging to one construct are doubly-linked with the
_classForwardLink and _classBackwardLink.public java.util.ResourceBundle getProfile()
getProfile
in class LpexCommonParser
com.ibm.lpex.core.LpexCommonParser
LpexCommonParser.getProperty(java.lang.String)
public java.lang.String getLanguage()
getLanguage
in class LpexCommonParser
LpexCommonParser.LANGUAGE_COBOL
public java.lang.String getLanguage(LpexDocumentLocation loc)
getLanguage
in class LpexCommonParser
protected void initializeParser()
public java.lang.String getPopupViewItems()
getPopupViewItems
in class LpexCommonParser
com.ibm.lpex.core.LpexCommonParser
LpexCommonParser.getPopupParserItems()
public void setStyleAttributes(boolean colours)
setStyleAttributes
in class LpexCommonParser
colours
- true
= token highlighting,
false
= no token highlightingpublic java.lang.String getHelpPage()
getHelpPage
in class LpexCommonParser
com.ibm.lpex.core.LpexParser
LpexCommonParser.getHelpPage()
protected int evaluateBeginElement(int element)
protected int evaluateEndElement(int element)
protected void addErrorMessage(int element, java.lang.String message, java.lang.String argument)
protected void addErrorMessage(int element, java.lang.String message)
protected SqlLexer getSqlLexer(LpexCharStream stream)
stream
- input character stream for the SQL lexerprotected CicsLexer getCicsLexer(LpexCharStream stream)
stream
- input character stream for the CICS lexer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |