|
LPEX 4.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.lpex.core.LpexCommonParser com.ibm.lpex.cpp.CppParser
public class CppParser
Document parser for C/C++. This class is extended by various C/C++ document parsers for specific systems/platforms and embedded SQL/CICS/DLI support.
Editor actions and assigned keys added by this document parser:
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 action modified by this document parser:
Parser properties handled directly by this parser:
TODO
)bidi
case, do, doc, for, if, main, switch, try, while
.
CppParserOS2
,
CppParserWIN
,
CppParserAIX
,
CppSqlParser
,
CppSqlParserOS2
,
CppSqlParserWIN
,
CppSqlParserAIX
Field Summary | |
---|---|
protected static String |
CLASS_BRACE
C/C++ parser element class. |
protected static String |
CLASS_BWDLINK
C/C++ parser element class. |
protected static String |
CLASS_CASE
C/C++ parser element class. |
protected static String |
CLASS_CICS
C/C++ parser element class. |
protected static String |
CLASS_CLASS
C/C++ parser element class. |
protected static String |
CLASS_CODE
C/C++ parser element class. |
protected static String |
CLASS_COMMENT
C/C++ parser element class. |
protected static String |
CLASS_COMMENTTASK
C/C++ parser element class. |
protected static String |
CLASS_CONTROL
C/C++ parser element class. |
protected static String |
CLASS_DEBUGGABLE
C/C++ parser element class. |
protected static String |
CLASS_DLI
C/C++ parser element class. |
protected static String |
CLASS_ERROR
C/C++ parser element class. |
protected static String |
CLASS_FUNCTION
C/C++ parser element class. |
protected static String |
CLASS_FWDLINK
C/C++ parser element class. |
protected static String |
CLASS_INCLUDE
C/C++ parser element class. |
protected static String |
CLASS_SEMICOLON
C/C++ parser element class. |
protected static String |
CLASS_SPACE
C/C++ parser element class. |
protected static String |
CLASS_SQL
C/C++ parser element class. |
Constructor Summary | |
---|---|
CppParser(LpexView lpexView)
Constructor for the parser. |
Method Summary | |
---|---|
protected void |
addErrorMessage(int element,
String message)
Displays an embedded error message for an element. |
LpexSubparser |
getCicsLexer(LpexCharStream lexerStream)
Returns the CICS lexer. |
String |
getCommentStyleCharacters()
Returns the style characters used for styling comments ("c$"). |
protected LpexSubparser |
getDliLexer(LpexCharStream lexerStream)
Returns the DLI lexer. |
String |
getLanguage()
Returns "CPP" , the language supported by this parser (C/C++). |
String |
getLanguage(LpexDocumentLocation loc)
Returns a string identifying the language segment at the specified location. |
String |
getLshToken()
Returns the current token for language-sensitive help (LSH). |
protected String |
getPopupItem(String key)
|
protected String |
getPopupItems(int popupLocation)
Returns this parser's contribution to the popup. |
ResourceBundle |
getProfile()
Returns this parser's profile resource bundle. |
SqlLexer |
getSqlLexer(LpexCharStream lexerStream)
Returns the SQL lexer. |
protected LpexCharStream |
getStream()
Returns the character stream used by the parser. |
protected void |
initParser()
Initializes the parser. |
boolean |
isCLibraryFunction(Token token)
Returns whether the specified token is a C library function. |
boolean |
isDebuggable(int line)
Returns whether the specified document line is debuggable. |
boolean |
isExtensionKeyword(Token token)
Returns whether the specified token is an extension keyword. |
boolean |
isTokenDelimiter(char ch)
Returns whether the specified character is a token delimiter. |
boolean |
isWordCharacter(int element,
int position)
Redefines word characters for adequate word navigation in C/C++ documents. |
void |
parseAll()
Total parse of the entire document. |
void |
parseElement(int element)
Incremental parse. |
protected void |
propertySet(String key)
Listens to changes to the taskTags parser property in this view. |
protected boolean |
setLexer(int newLexer)
Sets or changes the active lexer. |
void |
setStyleAttributes()
Defines this parser's style attributes. |
Methods inherited from class com.ibm.lpex.core.LpexCommonParser |
---|
addDocumentMessage, addMessage, addMessage, addMessage, blockMarkWord, copyDocumentMessages, cursorIndent, defineFilterAction, defineFilterAction, expandProtoKeyword, getInstallStyleAttributes, getProperty, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isPrimaryParser, lineComment, lpexView, matchToken, newLine, openLine, parse, 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 |
---|
protected static final String CLASS_CODE
protected static final String CLASS_DEBUGGABLE
protected static final String CLASS_SPACE
protected static final String CLASS_FWDLINK
protected static final String CLASS_BWDLINK
protected static final String CLASS_SEMICOLON
protected static final String CLASS_FUNCTION
protected static final String CLASS_BRACE
protected static final String CLASS_ERROR
protected static final String CLASS_COMMENT
protected static final String CLASS_COMMENTTASK
protected static final String CLASS_INCLUDE
protected static final String CLASS_CASE
protected static final String CLASS_CONTROL
protected static final String CLASS_CLASS
protected static final String CLASS_SQL
protected static final String CLASS_CICS
protected static final String CLASS_DLI
Constructor Detail |
---|
public CppParser(LpexView lpexView)
lpexView
- the document view associated with this parserMethod Detail |
---|
protected void initParser()
initParser
in class LpexCommonParser
public void parseAll()
parseAll
in class LpexCommonParser
public void parseElement(int element)
parseElement
in class LpexCommonParser
element
- an element affected by a committed change in this viewLpexView.parsePending(int)
,
LpexView.elementParsed(int)
,
Total and incremental parsepublic ResourceBundle getProfile()
getProfile
in class LpexCommonParser
LpexCommonParser.getProperty(java.lang.String)
,
Parser propertiespublic String getLanguage()
"CPP"
, the language supported by this parser (C/C++).
getLanguage
in class LpexCommonParser
LpexCommonParser.LANGUAGE_CCPP
public String getLanguage(LpexDocumentLocation loc)
getLanguage
in class LpexCommonParser
loc
- document location
LpexCommonParser.getLanguage()
,
Mixed content documentsprotected void propertySet(String key)
propertySet
in class LpexCommonParser
key
- base name of the parser property that was set, for example "autoIndent"LpexCommonParser.setProperty(String,String)
,
LpexCommonParser.getProperty(java.lang.String)
,
Parser propertiesprotected String getPopupItems(int popupLocation)
getPopupItems
in class LpexCommonParser
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
null
if noneLpexCommonParser.defineFilterAction(java.lang.String, java.lang.String)
protected String getPopupItem(String key)
public void setStyleAttributes()
'_'
(layout blanks),
'k'
(keyword),
'r'
(keyword return),
'x'
(extension keyword),
'i'
(identifier),
'n'
(integer/character literal),
'l'
(floating-point literal),
'q'
(string literal),
'o'
(operator),
'p'
(punctuation),
't'
(continuation character),
'c'
(comment),
'$'
(comment task tag),
'f'
(C library function),
'b'
(brace),
'h'
(CPP directive),
'e'
(error).
public String getCommentStyleCharacters()
getCommentStyleCharacters
in class LpexCommonParser
public boolean isDebuggable(int line)
isDebuggable
in class LpexCommonParser
line
- a line inside the document section that is currently loaded
in the editorpublic boolean isTokenDelimiter(char ch)
isTokenDelimiter
in class LpexCommonParser
ch
- character queried, for example ')'LpexCommonParser.getToken(com.ibm.lpex.core.LpexDocumentLocation)
,
LpexCommonParser.tokenBegin(com.ibm.lpex.core.LpexDocumentLocation)
,
LpexCommonParser.tokenEnd(com.ibm.lpex.core.LpexDocumentLocation)
public boolean isWordCharacter(int element, int position)
isWordCharacter
in class LpexCommonParser
element
- an element in the document section currently loaded in the editorposition
- ONE-based position in the element textprotected final LpexCharStream getStream()
protected void addErrorMessage(int element, String message)
element
- the text element in errormessage
- error message key in LPEX's Resources.propertiespublic boolean isExtensionKeyword(Token token)
A document parser subclassing CppParser may extend this method to check for extension keywords available on its target system / platform. Other extensions (such as for a particular project or compiler) may also be supported in this manner.
CppParser has no particular system or platform flavour, therefore it
always returns false
.
token
- the token being queried: token.beginLine, token.beginColumn,
token.endLine, and token.endColumn identify its location (ONE-based
elements and positions in the associated document view)public boolean isCLibraryFunction(Token token)
A document parser subclassing CppParser may extend this method to check for C library and extension C library functions available on its target system / platform.
The implementation of this method in CppParser returns true
for the ANSI C library functions.
token
- the token being queried: token.beginLine, token.beginColumn,
token.endLine, and token.endColumn identify its location (ONE-based
elements and positions in the associated document view)protected boolean setLexer(int newLexer)
newLexer
- the new lexer, one of: LEXER_CPP, LEXER_SQL, LEXER_CICS, or LEXER_DLI
public SqlLexer getSqlLexer(LpexCharStream lexerStream)
The implementation of this method provided by the CppParser class does
nothing, except return null
.
lexerStream
- input character stream for the lexerpublic LpexSubparser getCicsLexer(LpexCharStream lexerStream)
The implementation of this method provided by the CppParser class does
nothing, except return null
.
lexerStream
- input character stream for the lexerprotected LpexSubparser getDliLexer(LpexCharStream lexerStream)
The implementation of this method provided by the CppParser class does
nothing, except return null
.
lexerStream
- input character stream for the lexerpublic String getLshToken()
null
is returned, the LSH implementation should display a default language help panel.
In addition to language keywords, this parser generates the following LSH 'tokens' for special situations:
getLshToken
in class LpexCommonParser
|
LPEX 4.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |