com.ibm.lpex.html
Class HtmlParser
java.lang.Object
  
com.ibm.lpex.core.LpexCommonParser
      
com.ibm.lpex.html.HtmlParser
- All Implemented Interfaces: 
 - LpexConstants, LpexParser
 
- public class HtmlParser
- extends LpexCommonParser
  
Document parser for HTML.
 
Actions and their assigned keys added by this document parser:
 
  - htmlAmp (Ctrl+&) - to insert an ampersand
   character entity reference (&)
  
 - htmlB (Ctrl+B) - to set the bold text style to the
   currently selected text
  
 - htmlGt (Ctrl+>) - to insert a greater-than sign
   character entity reference (>)
  
 - htmlHrefs - for a selective view of the hyperlink references
   defined in the document
  
 - htmlI (Ctrl+I) - to set the italic text style to the
   currently selected text
  
 - htmlLt (Ctrl+<) - to insert a less-than sign
   character entity reference (<)
  
 - htmlNbsp (Ctrl+Space) - to insert a non-breaking space
   character entity reference ( )
  
 - htmlQuot (Ctrl+") - to insert a double-quote
   character entity reference (")
  
 - htmlTag (Ctrl+G) - to prompt for an element name, and insert a
   start-end pair of tags for this element around the currently selected text.
 
 
 
Keys already defined (e.g., by the active base profile) to an action
 different from nullAction are not redefined in here.
 
Command added by this document parser: 
 
  - htmlTag - to insert a start-end pair of tags for the specified element
   around the currently selected text.
 
 
 
Default editor action modified by this document parser:
 
  - contextHome - to skip comment-defining characters when determining
   the start of the text.
 
 
 
Template expansion (Ctrl+R) for an empty document and for the following
 keywords is provided in this parser's Profile.properties:
 
 
| 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
 | 
 
 
 
| Methods inherited from class com.ibm.lpex.core.LpexCommonParser | 
| addMessage, addMessage, addMessage, blockMarkWord, cursorIndent, expandProtoKeyword, getInstallStyleAttributes, getLanguage, getLshToken, getPopupParserItems, getPopupViewItems, getProperty, getStyleName, getStyles, getTextIndent, getToken, getTokenLocation, indentText, indentText, indentText, isDebuggable, lineComment, lpexView, matchToken, 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
 | 
 
 
 
HtmlParser
public HtmlParser(LpexView lpexView)
- Constructor for the parser.
 Adds all of the parser specifics to the LPEX document view.
 Initializes the view for the parser:  sets up all the style attributes,
 classes, etc. for the language-sensitive edit features supported.
 - Parameters:
 - lpexView - the document view associated with this parser
 
 
 
parseAll
public void parseAll()
- Total parse of the entire document.
 Done initially, after a document has been loaded in LPEX, or after an
 updateProfile command.
- 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 the parser's properties profile resource bundle.
- Overrides:
 - getProfile in class LpexCommonParser
 
 
- See Also:
 - LpexCommonParser.getProperty(java.lang.String), 
Parser properties
 
 
 
 
 
getLanguage
public String getLanguage()
- Returns "HTML", the language supported by this parser.
- Overrides:
 - getLanguage in class LpexCommonParser
 
 
- See Also:
 - LpexCommonParser.LANGUAGE_HTML
 
 
 
 
 
contextStartPosition
public static int contextStartPosition(LpexView lpexView,
                                       long commentClass)
- Query the start of text in the current element of the specified view.
 Determines the position of the first non-whitespace character / end of line
 for the contextHome action.  It will skip a comment-start indicator
 "<!--" styled with the comment style character 'c' in an element of class
 commentClass.
 
This method is only suitable for the HTML, XML, and XSL document parsers.
- Returns:
 - position in element's text, or 
         0 if there is no visible element in lpexView 
 
 
 
 
getPopupItems
protected String getPopupItems(int popupLocation)
- Retrieve parser's contribution to the popup.
 This parser contributes to the "Filter view" submenu (HTML References),
 and adds an "Insert" submenu.
- 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.
 The following style characters are set:
 '_' (layout blanks),
 't' (text),
 '=' (equal),
 'k' (tag name),
 'u' (unrecognized tag),
 'd' (tag delimiter),
 'a' (tag attribute name),
 'v' (tag attribute value),
 'c' (comment),
 'e' (error).
 
 
 
 
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
 
 
 
 
 
 
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)
 
 
 
 
 
tagSelection
public static void tagSelection(LpexView v,
                                String tag)
- Add a <tag> and </tag> pair to the selected text.
 The tags are inserted at the cursor location if no selection is in effect
 in this view.
- Parameters:
 - v - document view
- tag - HTML tag to add, e.g., "b"