SWT LPEX
v3.0.5

com.ibm.lpex.pli
Class PliParser

java.lang.Object
  extended bycom.ibm.lpex.core.LpexCommonParser
      extended bycom.ibm.lpex.pli.PliParser
All Implemented Interfaces:
LpexConstants, LpexParser

public class PliParser
extends LpexCommonParser

Document parser for PL/I.

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

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

Editor actions modified by this document parser:

Parser properties handled directly by this parser:


Field Summary
protected static int LEXER_CICS
          Identifier for the embedded EXEC CICS statements lexer.
protected static int LEXER_DLI
          Identifier for the embedded EXEC DLI statements lexer.
protected static int LEXER_PLI
          Identifier for the PL/I lexer (subparser).
protected static int LEXER_SQL
          Identifier for the embedded EXEC SQL statements lexer.
 
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_DLI, 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_INSERT_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
PliParser(LpexView lpexView)
          Constructor for the parser.
 
Method Summary
 String[] compileOptionKeywords()
          Returns a list of the compile-time options defined in this parser.
 String getCommentStyleCharacters()
          Returns the style character used for styling comments ("c").
 String getLanguage()
          Returns "PLI", the language supported by this parser (PL/I).
 String getLanguage(LpexDocumentLocation loc)
          Returns a string identifying the language segment at the specified location.
 int getLeftMargin()
          Returns the left margin used to parse the document.
protected  LpexSubparser getLexer(int lexer, LpexCharStream lexerStream)
          Returns the specified subparser.
 String getLshToken()
          Get the current token for language-sensitive help (LSH).
 String getNamesCharacters()
          Returns the extra characters for names used in the parsing of this document.
 String getNotCharacters()
          Returns the characters for the logical NOT operator used in the parsing of this document.
 String getOrCharacters()
          Returns the characters for the logical OR operator used in the parsing of this document.
protected  String getPopupItems(int popupLocation)
          Returns this parser's contribution to the popup.
 ResourceBundle getProfile()
          Returns this parser's profile resource bundle.
 String getProperty(String key)
          Extends LpexCommonParser's getProperty() to substitute the arguments for key PROTOKEY_EMPTY.
 int getRightMargin()
          Returns the right margin used to parse the document.
protected  com.ibm.lpex.pli.Keyword isKeyword(com.ibm.lpex.cc.Token token)
          Returns whether the given token is a non compile-option PL/I keyword.
protected  com.ibm.lpex.pli.Keyword isKeyword(com.ibm.lpex.cc.Token token, int attribute)
          Returns whether the given token is a PL/I keyword of a particular attribute.
 boolean isTokenDelimiter(char ch)
          Returns whether the specified character is a token delimiter.
 String[] keywords()
          Returns a list of the PL/I keywords defined in this parser.
protected  LpexDocumentLocation matchToken(LpexDocumentLocation loc)
          Matches PL/I constructs (e.g., "PROC" - "END").
protected  String nextKeyword()
          Retrieves the next keyword-definition line.
 void parseAll()
          Total parse of the entire document.
 void parseElement(int element)
          Incremental parse.
 void setStyleAttributes()
          Defines parser's style attributes.
 
Methods inherited from class com.ibm.lpex.core.LpexCommonParser
addDocumentMessage, addMessage, addMessage, addMessage, blockMarkWord, copyDocumentMessages, cursorIndent, defineFilterAction, expandProtoKeyword, getInstallStyleAttributes, getPopupParserItems, getPopupViewItems, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isDebuggable, lineComment, lpexView, newLine, openLine, parse, propertySet, removeDocumentMessages, removeMessages, removeMessages, resetParser, setProperty, 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

LEXER_PLI

protected static final int LEXER_PLI
Identifier for the PL/I lexer (subparser).

See Also:
Constant Field Values

LEXER_SQL

protected static final int LEXER_SQL
Identifier for the embedded EXEC SQL statements lexer.

See Also:
Constant Field Values

LEXER_CICS

protected static final int LEXER_CICS
Identifier for the embedded EXEC CICS statements lexer.

See Also:
Constant Field Values

LEXER_DLI

protected static final int LEXER_DLI
Identifier for the embedded EXEC DLI statements lexer.

See Also:
Constant Field Values
Constructor Detail

PliParser

public PliParser(LpexView lpexView)
Constructor for the parser. Adds all of the parser specifics to the LPEX document view. It initializes the view for the parser: it sets up the style attributes, 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. Done initially, after a document has been loaded in LPEX, and after an updateProfile command has been issued.

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

parseElement

public void parseElement(int element)
Incremental parse.

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

getProfile

public ResourceBundle getProfile()
Returns this parser's profile resource bundle.

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

getLanguage

public String getLanguage()
Returns "PLI", the language supported by this parser (PL/I).

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

getLanguage

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

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

getPopupItems

protected String getPopupItems(int popupLocation)
Returns this parser's contribution to the popup. This parser contributes to the Filter view submenu (Procedures, Logic outline, Preprocessor statements, Includes, Extensions, SQL/CICS/DLI, Errors).

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

setStyleAttributes

public void setStyleAttributes()
Defines parser's style attributes. Unscanned text uses the default style character '!'. The following style characters are set: '_' (layout blanks), 'a' (variable/procedure name), 'u' (label), 's' (language symbol), 'g' (extension), '?' (outside margins), 'c' (comment), 'e' (error), 'k' (keyword), 'b' (built-in function), 'n' (numeric), 'l' (literal), 'q' (preprocessor keyword), 'r' (preprocessor '?').


getCommentStyleCharacters

public String getCommentStyleCharacters()
Returns the style character used for styling comments ("c").

Overrides:
getCommentStyleCharacters in class LpexCommonParser

matchToken

protected LpexDocumentLocation matchToken(LpexDocumentLocation loc)
Matches PL/I constructs (e.g., "PROC" - "END").

Overrides:
matchToken in class LpexCommonParser
Parameters:
loc - document location of the token to match
Returns:
matching-token location (with loc adjusted to include the entire original token), or null if not a matchable token, or original loc if no match found for the token

isTokenDelimiter

public boolean isTokenDelimiter(char ch)
Returns whether the specified character is a token delimiter.

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

nextKeyword

protected String nextKeyword()
Retrieves the next keyword-definition line. This method is being called repeatedly to set up the parser's static keyword tables, until it returns null.

This method may be extended by a subclassing parser to add custom keywords.


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:

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

getProperty

public String getProperty(String key)
Extends LpexCommonParser's getProperty() to substitute the arguments for key PROTOKEY_EMPTY. Argument {0} is blanks for the default left margin, {1} is for the procedure name (this substitution is based on the name parameter of the document).

Specified by:
getProperty in interface LpexParser
Overrides:
getProperty in class LpexCommonParser
Parameters:
key - property name, for example, "proto.doc" for this parser's expansion of the keyword "doc" by the proto action, or "view.proto.doc" for this property as defined in the current view's instance of the parser
See Also:
LpexCommonParser.getLanguage(), LpexCommonParser.getProfile(), Parser properties

getLeftMargin

public int getLeftMargin()
Returns the left margin used to parse the document. The default left margin is defined by the parser property leftMargin. The actual left margin used by the parser may be set by PROCESS statements in the document itself.


getRightMargin

public int getRightMargin()
Returns the right margin used to parse the document. The default right margin is defined by the parser property rightMargin. The actual right margin used by the parser may be set by PROCESS statements in the document itself.


getNotCharacters

public String getNotCharacters()
Returns the characters for the logical NOT operator used in the parsing of this document. The default extra NOT characters are defined by the parser property not. The actual characters used by the parser may be set by PROCESS statements in the document itself.


getOrCharacters

public String getOrCharacters()
Returns the characters for the logical OR operator used in the parsing of this document. The default extra OR characters are defined by the parser property or. The actual characters used by the parser may be set by PROCESS statements in the document itself.


getNamesCharacters

public String getNamesCharacters()
Returns the extra characters for names used in the parsing of this document. The default characters for names are defined by the parser property names. The actual characters used by the parser may be set by PROCESS statements in the document itself.


compileOptionKeywords

public String[] compileOptionKeywords()
Returns a list of the compile-time options defined in this parser.

See Also:
keywords()

keywords

public String[] keywords()
Returns a list of the PL/I keywords defined in this parser.

See Also:
compileOptionKeywords()

isKeyword

protected com.ibm.lpex.pli.Keyword isKeyword(com.ibm.lpex.cc.Token token)
Returns whether the given token is a non compile-option PL/I keyword.

Parameters:
token - token to check
Returns:
Keyword, or
null if it is not a PL/I keyword

isKeyword

protected com.ibm.lpex.pli.Keyword isKeyword(com.ibm.lpex.cc.Token token,
                                             int attribute)
Returns whether the given token is a PL/I keyword of a particular attribute.

Parameters:
token - token to check
attribute - its attribute
Returns:
Keyword, or
null if it is not a PL/I keyword of this attribute

getLexer

protected LpexSubparser getLexer(int lexer,
                                 LpexCharStream lexerStream)
Returns the specified subparser. This method constructs and returns a lexer object for parsing embedded EXEC SQL, EXEC CICS, or EXEC DLI statements.

The default implementation of this method currently returns null for a LEXER_DLI request.

Parameters:
lexer - lexer requested (LEXER_SQL / LEXER_CICS / LEXER_DLI)
lexerStream - input character stream for the lexer

SWT LPEX
v3.0.5

(C) Copyright IBM Corporation 1998, 2005.  All Rights Reserved.