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.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 (e.g., by the active base profile) to an action different from nullAction are not redefined in here.

Editor actions modified by this document parser:

Template expansion (proto action, Ctrl+R) for an empty document and for the following keywords is provided in this document parser's profile:

Parser properties used directly by this document parser:


Field Summary
 
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
PliParser(LpexView lpexView)
          Constructor for the parser.
 
Method Summary
 String[] compileOptionKeywords()
          Return a list of the compile-time options defined in this parser.
 String getCommentStyleCharacters()
          Return 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()
          Retrieve the left margin used to parse the document.
 String getLshToken()
          Get the current token for language-sensitive help (LSH).
 String getNamesCharacters()
          Retrieve the extra characters for names used in the parsing of this document.
 String getNotCharacters()
          Retrieve the characters for the logical NOT operator used in the parsing of this document.
 String getOrCharacters()
          Retrieve the characters for the logical OR operator used in the parsing of this document.
protected  String getPopupItems(int popupLocation)
          Retrieve parser's contribution to the popup.
 ResourceBundle getProfile()
          Returns this parser's profile resource bundle.
 String getProperty(String key)
          Extend LpexCommonParser's getProperty() to substitute the arguments for key PROTOKEY_EMPTY.
 int getRightMargin()
          Retrieve the right margin used to parse the document.
protected  com.ibm.lpex.pli.Keyword isKeyword(com.ibm.lpex.cc.Token token)
          Check 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)
          Check whether the given token is a PL/I keyword of a particular attribute.
 boolean isTokenDelimiter(char ch)
          Return true if the specified character is a token delimiter.
 String[] keywords()
          Return a list of the PL/I keywords defined in this parser.
protected  LpexDocumentLocation matchToken(LpexDocumentLocation loc)
          Match PL/I constructs (e.g., "PROC" - "END").
protected  String nextKeyword()
          Retrieve the next keyword-definition line.
 void parseAll()
          Total parse of the entire document.
 void parseElement(int element)
          Incremental parse.
 void setStyleAttributes()
          Define parser's style attributes.
 
Methods inherited from class com.ibm.lpex.core.LpexCommonParser
addMessage, addMessage, addMessage, blockMarkWord, cursorIndent, expandProtoKeyword, getInstallStyleAttributes, getPopupParserItems, getPopupViewItems, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isDebuggable, lineComment, lpexView, newLine, openLine, parse, 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
 

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 - the (first) 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


 

 

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

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


 

 

getPopupItems

protected String getPopupItems(int popupLocation)

Retrieve parser's contribution to the popup. This parser contributes to the "Filter view" submenu (Procedures, Logic outline, Preprocessor statements, Includes, Extensions, 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. 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()

Return the style character used for styling comments ("c"). This is used by compare sessions when the compare.ignoreComments option is in effect.

Overrides:
getCommentStyleCharacters in class LpexCommonParser


 

 

matchToken

protected LpexDocumentLocation matchToken(LpexDocumentLocation loc)

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

Return true if the specified character is a token delimiter.

Overrides:
isTokenDelimiter in class LpexCommonParser

See Also:
LpexCommonParser.getToken(com.ibm.lpex.core.LpexDocumentLocation)


 

 

nextKeyword

protected String nextKeyword()

Retrieve the next keyword-definition line. This method is being called repeatedly to set up the parser's static keyword tables, until it returns null.

The method can 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:

  • embedded messages: message_help
  • embedded CICS/SQL statements: cics_help, sql_help
  • comments: comment_help
  • others: comp_op_help, label_help, literal_help, math_op_help, number_help, symbol_help.

Overrides:
getLshToken in class LpexCommonParser

See Also:
Language-sensitive help


 

 

getProperty

public String getProperty(String key)

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


 

 

getLeftMargin

public int getLeftMargin()

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

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

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

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

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

Return a list of the compile-time options defined in this parser.

See Also:
keywords()


 

 

keywords

public String[] keywords()

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

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

Check 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


 

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