home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
jfc.bin
/
html-3.2.jj
< prev
next >
Wrap
Text File
|
1998-02-26
|
28KB
|
1,401 lines
options {
/*
DEBUG_PARSER = true;
DEBUG_LOOKAHEAD = true;
DEBUG_TOKEN_MANAGER = true;
*/
STATIC = false;
USER_CHAR_STREAM=true;
}
PARSER_BEGIN(html32)
/*
* @(#)html-3.2.jj 1.18 97/12/03
*
* Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
/*
* @version 1.18 12/03/97
* @author Makarand Gokhale
*/
package com.sun.java.swing.text.html;
/**
* An HTML parser class, derived from the grammar shipped
* with JavaCC. This must be built with the -NOSTATIC option
* Add the appropriate callback to do the actions using HTMLParserCallback
* Interface. By Default this will do nothing
*
* The productions call into a method to deal with the action.
* These methods are called XXXAction where XXX is the name of
* the production. This allows the grammer to be used for
* multiple things without a maintenance burdon.
*
* @version 1.18 12/03/97
* @author Makarand Gokhale
* @author Timothy Prinzing
*/
import java.net.*;
import java.io.*;
class html32 {
private HTMLParserCallback callback;
private int listdepth = 0;
public void setCallback(HTMLParserCallback cb){
callback = cb;
}
public static void main(String args[]) {
html32 t;
if(args.length > 0 ) {
System.out.println("Reading from URL:"+args[0]);
try {
URL u = new URL(args[0]);
InputStream is = u.openStream();
t = new html32(new java.io.InputStreamReader(is));
t.setCallback(new HTMLParserCallbackDefault());
} catch ( Exception e) {
System.out.println("UEL Exception "+e);
System.out.println("URL Open failed, Reading from standard input...");
t = new html32(new java.io.InputStreamReader(System.in));
t.setCallback(new HTMLParserCallbackDefault());
}
}
else {
System.out.println("Reading from standard input...");
t = new html32(new java.io.InputStreamReader(System.in));
t.setCallback(new HTMLParserCallbackDefault());
}
HTMLParserCallbackDefault.bDoDebug = true;
try {
t.html();
System.out.println("Thank you.");
} catch (Exception e) {
System.out.println("Oops.");
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public html32(java.io.Reader reader){
this(new ReaderCharStream(reader,1,1));
}
public void ReInit(java.io.Reader reader){
ReInit(new ReaderCharStream(reader,1,1));
}
}
PARSER_END(html32)
// ================================================================
SKIP :
{
< "<!" ( ~[">"] )* ">" >
// :::) MG NON HTML STD 07/30/97 Skip Extra Tag within a comment
| < "<!" ( ~[">"] )* ">" ( ~["<",">"] )* ">" >
}
SPECIAL_TOKEN :
{
<WHITESPACES: ( " " | "\t" | "\n" | "\r" )+ >
}
TOKEN :
{
<STAGO: "<" | "<" ( " " | "\t" | "\n" | "\r")* "<" > : TAG
| <ETAGO: "</" > : TAG
| <PCDATA: ( ~["<"] )+ | "<" ("=" | ">" | "<" | " ") (~["<"])+ >
}
<TAG> TOKEN [IGNORE_CASE] :
{
<A: "a" > : ATTLIST
| <ADDRESS: "address" > : ATTLIST
| <APPLET: "applet" > : ATTLIST
| <AREA: "area" > : ATTLIST
| <B: "b" > : ATTLIST
| <BASE: "base" > : ATTLIST
| <BASEFONT: "basefont" > : ATTLIST
| <BIG: "big" > : ATTLIST
| <BLOCKQUOTE: "blockquote" > : ATTLIST
| <BODY: "body" > : ATTLIST
| <BR: "br" > : ATTLIST
| <CAPTION: "caption" > : ATTLIST
| <CENTER: "center" > : ATTLIST
| <CITE: "cite" > : ATTLIST
| <CODE: "code" > : ATTLIST
| <DD: "dd" > : ATTLIST
| <DFN: "dfn" > : ATTLIST
| <DIR: "dir" > : ATTLIST
| <DIV: "div" > : ATTLIST
| <DL: "dl" > : ATTLIST
| <DT: "dt" > : ATTLIST
| <EM: "em" > : ATTLIST
| <FONT: "font" > : ATTLIST
| <FORM: "form" > : ATTLIST
| <H1: "h1" > : ATTLIST
| <H2: "h2" > : ATTLIST
| <H3: "h3" > : ATTLIST
| <H4: "h4" > : ATTLIST
| <H5: "h5" > : ATTLIST
| <H6: "h6" > : ATTLIST
| <HEAD: "head" > : ATTLIST
| <HR: "hr" > : ATTLIST
| <HTML: "html" > : ATTLIST
| <I: "i" > : ATTLIST
| <IMG: "img" > : ATTLIST
| <INPUT: "input" > : ATTLIST
| <ISINDEX: "isindex" > : ATTLIST
| <KBD: "kbd" > : ATTLIST
| <LI: "li" > : ATTLIST
| <LINK: "link" > : ATTLIST
| <MAP: "map" > : ATTLIST
| <MENU: "menu" > : ATTLIST
| <META: "meta" > : ATTLIST
| <OL: "ol" > : ATTLIST
| <OPTION: "option" > : ATTLIST
| <P: "p" > : ATTLIST
| <PARAM: "param" > : ATTLIST
| <PRE: "pre" > : ATTLIST
| <PROMPT: "prompt" > : ATTLIST
| <SAMP: "samp" > : ATTLIST
| <SCRIPT: "script" > : ATTLIST
| <SELECT: "select" > : ATTLIST
| <SMALL: "small" > : ATTLIST
| <STRIKE: "strike" > : ATTLIST
| <S: "s" > : ATTLIST
| <STRONG: "strong" > : ATTLIST
| <STYLE: "style" > : ATTLIST
| <SUB: "sub" > : ATTLIST
| <SUP: "sup" > : ATTLIST
| <TABLE: "table" > : ATTLIST
| <TD: "td" > : ATTLIST
| <TEXTAREA: "textarea" > : ATTLIST
| <TH: "th" > : ATTLIST
| <TITLE: "title" > : ATTLIST
| <TR: "tr" > : ATTLIST
| <TT: "tt" > : ATTLIST
| <U: "u" > : ATTLIST
| <UL: "ul" > : ATTLIST
| <VAR: "var" > : ATTLIST
| <UNKNOWN: (["a"-"z", "A"-"Z","0"-"9"])+ > : ATTLIST
}
<ATTLIST> SKIP :
{
< ( " " | "\t" | "\n" | "\r" )+ >
| < ( ~["a"-"z","A"-"Z","_","-",".","0"-"9","<",">","/","="])+ >
| < "--" > : ATTCOMM
}
<ATTLIST> TOKEN :
{
<TAGC: ">" > : DEFAULT
| <A_EQ: "=" > : ATTRVAL
| <#ALPHA: ["a"-"z","A"-"Z","_","-","."] >
| <#NUM: ["0"-"9"] >
| <#ALPHANUM: <ALPHA> | <NUM> >
| <A_NAME: <ALPHA> ( <ALPHANUM> )* >
| <ETAGOO: "</" > : TAG
| <STAGOO: "<" > : TAG
}
<ATTRVAL> SKIP :
{
< " " | "\t" | "\n" | "\r" >
}
<ATTRVAL> TOKEN :
{
<CDATA: "'" ( ~["'"] )* "'"
| "\"" ( ~["\""] )* "\""
| ( ~[">", "\"", "'", " ", "\t", "\n", "\r"] )+
> : ATTLIST
}
<ATTCOMM> SKIP :
{
< ( ~["-"] )+ >
| < "-" ( ~["-"] )+ >
| < "--" > : ATTLIST
}
// ================================================================
void pcdata() :
{
Token t;
}
{
t=<PCDATA>
{
callback.pcdataAction(t.image);
}
}
void attribute() :
{
Token n, v = null;
}
{
n=<A_NAME> [ <A_EQ> v=<CDATA> ]
{
String value = (v != null) ? v.image : null;
if ((value != null) && value.startsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
callback.attributeAction(n.image, value);
}
}
void attlist() : {}
{
( attribute() )+
}
void Eheading() : {}
{
LOOKAHEAD(2) h1()
| LOOKAHEAD(2) h2()
| LOOKAHEAD(2) h3()
| LOOKAHEAD(2) h4()
| LOOKAHEAD(2) h5()
| h6()
}
void Epreformatted() : {}
{
pre()
}
void Elist() : {}
{
LOOKAHEAD(2) ul()
| LOOKAHEAD(2) ol()
| LOOKAHEAD(2) dir()
| LOOKAHEAD(2) menu()
| LOOKAHEAD({ listdepth == 0 && getToken(2).kind == LI } ) impliedul()
}
void Efont() : {}
{
LOOKAHEAD(2) tt()
| LOOKAHEAD(2) i()
| LOOKAHEAD(2) b()
| LOOKAHEAD(2) u()
| LOOKAHEAD(2) strike()
| LOOKAHEAD(2) big()
| LOOKAHEAD(2) small()
| LOOKAHEAD(2) sub()
| sup()
}
void Ephrase() : {}
{
LOOKAHEAD(2) em()
| LOOKAHEAD(2) strong()
| LOOKAHEAD(2) dfn()
| LOOKAHEAD(2) code()
| LOOKAHEAD(2) samp()
| LOOKAHEAD(2) kbd()
| LOOKAHEAD(2) _var()
| cite()
}
void Especial() : {}
{
LOOKAHEAD(2) a()
| LOOKAHEAD(2) img()
| LOOKAHEAD(2) applet()
| LOOKAHEAD(2) font()
| LOOKAHEAD(2) basefont()
| LOOKAHEAD(2) br()
| LOOKAHEAD(2) script()
| map()
}
void Eform() : {}
{
LOOKAHEAD(2) input()
| LOOKAHEAD(2) select()
| textarea()
}
JAVACODE
void whitespace()
{
Token t ;
t = getToken(1);
if( t != null){
if (t.specialToken != null){
Token tmp_t = t.specialToken;
while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken;
while (tmp_t != null) {
callback.whitespaceAction(tmp_t.image);
tmp_t = tmp_t.next;
}
}
}
}
void Etext() : {}
{
LOOKAHEAD(2) Efont()
| LOOKAHEAD(2) Ephrase()
| LOOKAHEAD(2) Especial()
| LOOKAHEAD(2) Eform()
| pcdata()
}
void tt() : {}
{
<STAGO> <TT> [ attlist() ] [<TAGC>] { callback.ttOpenAction();}
( Etext() )*
try {
etag() <TT> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.ttCloseAction(); }
}
void i() : {}
{
<STAGO> <I> [ attlist() ] [<TAGC>] { callback.iOpenAction(); }
( Etext() )*
try {
etag() <I> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.iCloseAction(); }
}
void b() : {}
{
<STAGO> <B> [ attlist() ] [<TAGC>] { callback.bOpenAction(); }
(LOOKAHEAD(2) Etext() )*
try {
etag() <B> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.bCloseAction(); }
}
void u() : {}
{
<STAGO> <U> [ attlist() ] [<TAGC>] { callback.uOpenAction(); }
( Etext() )*
try {
etag() <U> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.uCloseAction(); }
}
void strike() : {}
{
<STAGO> (<STRIKE> | <S>) [ attlist() ] [<TAGC>] { callback.strikeOpenAction(); }
( Etext() )*
try {
etag() ( <STRIKE> | <S> ) <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.strikeCloseAction(); }
}
void big() : {}
{
<STAGO> <BIG> [ attlist() ] [<TAGC>] { callback.bigOpenAction();}
( Etext() )*
try {
etag() <BIG> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.bigCloseAction();}
}
void small() : {}
{
<STAGO> <SMALL> [ attlist() ] [<TAGC>] { callback.smallOpenAction();}
( Etext() )*
try {
etag() <SMALL> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.smallCloseAction();}
}
void sub() : {}
{
<STAGO> <SUB> [ attlist() ] [<TAGC>] { callback.subOpenAction();}
( Etext() )*
try {
etag() <SUB> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.subCloseAction();}
}
void sup() : {}
{
<STAGO> <SUP> [ attlist() ] [<TAGC>] { callback.supOpenAction();}
( Etext() )*
try {
etag() <SUP> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.supCloseAction();}
}
void em() : {}
{
<STAGO> <EM> [ attlist() ] [<TAGC>] { callback.emOpenAction();}
( Etext() )*
try {
etag() <EM> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.emCloseAction();}
}
void strong() : {}
{
<STAGO> <STRONG> [ attlist() ] [<TAGC>] { callback.strongOpenAction();}
( Etext() )*
try {
etag() <STRONG> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.strongCloseAction();}
}
void dfn() : {}
{
<STAGO> <DFN> [ attlist() ] [<TAGC>] { callback.dfnOpenAction();}
( Etext() )*
try {
etag() <DFN> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.dfnCloseAction();}
}
void code() : {}
{
<STAGO> <CODE> [ attlist() ] [<TAGC>] { callback.codeOpenAction();}
(LOOKAHEAD(2) Etext() )*
try {
etag() <CODE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.codeCloseAction();}
}
void samp() : {}
{
<STAGO> <SAMP> [ attlist() ] [<TAGC>] { callback.sampOpenAction();}
( Etext() )*
try {
etag() <SAMP> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.sampCloseAction();}
}
void kbd() : {}
{
<STAGO> <KBD> [ attlist() ] [<TAGC>] { callback.kbdOpenAction();}
( Etext() )*
try {
etag() <KBD> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.kbdCloseAction();}
}
void _var() : {}
{
<STAGO> <VAR> [ attlist() ] [<TAGC>] { callback.varOpenAction();}
( Etext() )*
try {
etag() <VAR> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.varCloseAction();}
}
void cite() : {}
{
<STAGO> <CITE> [ attlist() ] [<TAGC>] {callback.citeOpenAction();}
( Etext() )*
try {
etag() <CITE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.citeCloseAction();}
}
void font() : {}
{
<STAGO> <FONT> [ attlist() ] [<TAGC>] { callback.fontOpenAction(); }
( Etext() )*
try {
etag() <FONT> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.fontCloseAction();}
}
void basefont() : {}
{
<STAGO> <BASEFONT> [ attlist() ] [<TAGC>] { callback.basefontAction();}
}
void br() : {}
{
<STAGO> <BR> [ attlist() ] [<TAGC>] { callback.brAction();}
}
void Eblock() : {}
{
LOOKAHEAD(2) p()
| LOOKAHEAD(2) Elist()
| LOOKAHEAD(2) Epreformatted()
| LOOKAHEAD(2) dl()
| LOOKAHEAD(2) div()
| LOOKAHEAD(2) center()
| LOOKAHEAD(2) blockquote()
| LOOKAHEAD(2) form()
| LOOKAHEAD(2) isindex()
| LOOKAHEAD(2) hr()
| LOOKAHEAD(2) table()
}
void Eflow() : {}
{
(LOOKAHEAD(2)
( LOOKAHEAD(2) Eblock()
| impliedParagraph()
)
)*
}
void impliedParagraph() : {}
{
{ callback.blockOpenAction("impliedp"); } ( LOOKAHEAD(2) Etext() )+
{ callback.blockCloseAction("impliedp"); }
}
void Ebody_content() : {}
{
( LOOKAHEAD(2)
( LOOKAHEAD(2) Eheading()
| LOOKAHEAD(2) Eblock()
| LOOKAHEAD(2) address()
| LOOKAHEAD(2) impliedParagraph()
)
)*
}
int _Ebody_content() :
{
// MG 09/03/97 Try to Get the nextToken. If error then we must have
// reached end of file so return -1
Token t1=null,t2=null;
try {
t1 = getToken(1);
}catch(Exception e){
return -1;
}
}
{
// Try matching a Body Element and its children
// At this point if a body element is not found
// then return without matching and hope that the
// including production will handle this error appropriately
( LOOKAHEAD(2)
( LOOKAHEAD(2) Eheading()
| LOOKAHEAD(2) Eblock()
| LOOKAHEAD(2) address()
| LOOKAHEAD(2) impliedParagraph()
)
)?
{
// Get the next token. If we cannot get the next token
// a match must have occured, and we have hit the end of file
// So return -2
try{
t2 = getToken(1);
}
catch (Exception e){
return -2;
}
if(t1.beginLine == t2.beginLine && t1.beginColumn == t2.beginColumn)
return 0;
else
return 1;
}
}
void body_content() :
{
Token t1,t2;
int parseVal=0;
}
{
{
try {
while(parseVal == 0 ){
try {
parseVal=_Ebody_content();
}catch(ParseException pe){
}
if(parseVal >= 0 ){
t1 = getToken(1);
t2 = getToken(2);
if(t1.kind == ETAGO){
if(t2.kind == BODY || t2.kind == HTML)
break;
else
SkipToken(2);
}
else
SkipToken(1);
}
}
}catch (ParseException e) {
System.out.println("Exception:"+e);
}
}
}
void body() :
{
Token t1,t2;
}
{
[ LOOKAHEAD(2) <STAGO> <BODY> [ attlist() ] [<TAGC>] ]{ callback.bodyOpenAction();}
{
try {
while(true){
// Get the next Body Content
Ebody_content();
t1 = getToken(1);
t2 = getToken(2);
// Skip Over Tokens that are not end HTML or Body Tag
// and continue
if(t1.kind == ETAGO){
if(t2.kind == BODY || t2.kind == HTML)
break;
else
SkipToken(2);
}
else
SkipToken(1);
}
}catch (ParseException e) {
System.out.println("Exception:"+e);
}
}
[ LOOKAHEAD(2) etag() <BODY> [<TAGC>] ]{ callback.bodyCloseAction();}
}
// MG 091197 To Parse in buffered mode
JAVACODE
void handleException() {
int ret=SkipEndToken();
}
JAVACODE
int SkipEndToken() {
Token t, tOld;
int num =0;
t = getToken(1);
tOld = getToken(0);
if(t.kind == ETAGO) num =3;
else if(tOld.kind == ETAGO) num =2;
SkipToken(num);
return num;
}
JAVACODE
void SkipToken(int num) {
Token t;
try {
for(int i=0; i < num; i++)
t = getNextToken();
}catch (Exception e){
}catch (Error e){
}
}
void _body() : {}
{
[ LOOKAHEAD(2) <STAGO> <BODY> [ attlist() ] [<TAGC>] ]
}
void address() : {}
{
<STAGO> <ADDRESS> [ attlist() ] [<TAGC>] { callback.addressOpenAction();}
( LOOKAHEAD(2) Etext() | p() )*
try {
etag() <ADDRESS> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.addressCloseAction();}
}
void div() : {}
{
<STAGO> <DIV> [ attlist() ] [<TAGC>] { callback.divOpenAction();}
Ebody_content()
try {
etag() <DIV> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.divCloseAction();}
}
void center() : {}
{
<STAGO> <CENTER> [ attlist() ] [<TAGC>] { callback.centerOpenAction();}
Ebody_content()
try {
etag() <CENTER> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.centerCloseAction();}
}
void etag(): {}
{
(<ETAGO> | <ETAGOO>)
}
// exclusion exception: a()
void a() : {}
{
<STAGO> <A> [ attlist() ] [<TAGC>]
{ callback.aOpenAction(); }
( LOOKAHEAD(2) Etext() )*
try {
etag() <A> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.aCloseAction();}
}
void map() : {}
{
<STAGO> <MAP> [ attlist() ] [<TAGC>] { callback.mapOpenAction();}
( area() )*
try {
etag() <MAP> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.mapCloseAction();}
}
void area() : {}
{
<STAGO> <AREA> [ attlist() ] [<TAGC>] { callback.areaAction();}
}
void link() : {}
{
<STAGO> <LINK> [ attlist() ] [<TAGC>] { callback.linkAction();}
}
void img() : {}
{
<STAGO> <IMG> [ attlist() ] [<TAGC>] { callback.imgAction(); }
}
// inclusion exception: param()
void applet() : {}
{
<STAGO> <APPLET> [ attlist() ] [<TAGC>] { callback.appletOpenAction();}
( LOOKAHEAD(2) param() | Etext() )*
try {
etag() <APPLET> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.appletCloseAction();}
}
void param() : {}
{
<STAGO> <PARAM> [ attlist() ] [<TAGC>] { callback.paramAction();}
}
void hr() : {}
{
<STAGO> <HR> [ attlist() ] [<TAGC>] { callback.hrAction(); }
}
void p() : {}
{
<STAGO> <P> [ attlist() ] [<TAGC>] { callback.blockOpenAction("p"); }
( LOOKAHEAD(2) Etext() )* [ LOOKAHEAD(2) etag() <P> <TAGC> ]
{ callback.blockCloseAction("p"); }
}
void h1() : {}
{
<STAGO> <H1> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h1"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H1
try {
etag() <H2> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h1"); }
}
void h2() : {}
{
<STAGO> <H2> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h2"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H2
try {
etag() <H2> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h2"); }
}
void h3() : {}
{
<STAGO> <H3> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h3"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H3
try {
etag() <H3> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h3"); }
}
void h4() : {}
{
<STAGO> <H4> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h4"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H4
try {
etag() <H4> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h4"); }
}
void h5() : {}
{
<STAGO> <H5> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h5"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H5
try {
etag() <H5> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h5"); }
}
void h6() : {}
{
<STAGO> <H6> [ attlist() ] [<TAGC>] { callback.blockOpenAction("h6"); }
( LOOKAHEAD(2) Etext() )*
// MG 09/03/97 Try matching the end tag. If it fails to match end tag
// move on as we got everything we need from H6
try {
etag() <H6> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockCloseAction("h6"); }
}
// exclusion exception: img(), big(), small(), sub(), sup(), font()
void pre() : {}
{
<STAGO> <PRE> [ attlist() ] [<TAGC>] { callback.preOpenAction();}
whitespace()
( LOOKAHEAD(2) Etext() whitespace() )*
try {
etag() <PRE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.preCloseAction(); }
}
void blockquote() : {}
{
<STAGO> <BLOCKQUOTE> [ attlist() ] [<TAGC>] { callback.blockquoteOpenAction();}
Ebody_content()
try {
etag() <BLOCKQUOTE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.blockquoteCloseAction(); }
}
void dl() : {}
{
<STAGO> <DL> [ attlist() ] [<TAGC>] { callback.dlOpenAction(); }
( LOOKAHEAD(2) ( LOOKAHEAD(2) dt()
| LOOKAHEAD(2) dd()
)
)*
try {
etag() <DL> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.dlCloseAction(); }
}
void dt() : {}
{
<STAGO> <DT> [ attlist() ] [<TAGC>] { callback.dtOpenAction(); }
( LOOKAHEAD(2) Etext() )*
[ LOOKAHEAD(2) etag() <DT> <TAGC> ] { callback.dtCloseAction(); }
}
void dd() : {}
{
<STAGO> <DD> [ attlist() ] [<TAGC>] { callback.ddOpenAction(); }
Eflow() [ LOOKAHEAD(2) etag() <DD> <TAGC> ] { callback.ddCloseAction(); }
}
void ol() : {}
{
<STAGO> <OL> [ attlist() ] [<TAGC>] { callback.olOpenAction(); listdepth++; }
( LOOKAHEAD(2) li() )*
try {
etag() <OL> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.olCloseAction(); listdepth--;}
}
void ul() : {}
{
<STAGO> <UL> [ attlist() ] [<TAGC>] { callback.ulOpenAction(); listdepth++; }
( LOOKAHEAD(2) li() )*
try {
etag() <UL> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.ulCloseAction(); listdepth--;}
}
void impliedul() : {}
{
{
if(listdepth > 0 )
return;
}
{ callback.ulOpenAction(); listdepth++; }
( LOOKAHEAD(2) li() )*
try {
etag() <UL> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.ulCloseAction(); listdepth--;}
}
// exclusion exception: Eblock()
void dir() : {}
{
<STAGO> <DIR> [ attlist() ] [<TAGC>] { callback.dirOpenAction(); listdepth++;}
( LOOKAHEAD(2) li() )*
try {
etag() <DIR> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.dirCloseAction(); listdepth--; }
}
// exclusion exception: Eblock()
void menu() : {}
{
<STAGO> <MENU> [ attlist() ] [<TAGC>] { callback.menuOpenAction(); listdepth++; }
( LOOKAHEAD(2) li() )*
try {
etag() <MENU> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.menuCloseAction(); listdepth--;}
}
void li() : {}
{
<STAGO> <LI> [ attlist() ] [<TAGC>] { callback.liOpenAction(); }
Eflow() [ LOOKAHEAD(2) etag() <LI> <TAGC> ] { callback.liCloseAction(); }
}
// exclusion exception: form()
void form() : {}
{
<STAGO> <FORM> [ attlist() ] [<TAGC>] { callback.formOpenAction();}
Ebody_content()
try {
etag() <FORM> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.formCloseAction(); }
}
void input() : {}
{
<STAGO> <INPUT> [ attlist() ] [<TAGC>] { callback.inputAction();}
}
void select() : {}
{
<STAGO> <SELECT> [ attlist() ] [<TAGC>] { callback.selectOpenAction();}
( option() )+
try {
etag() <SELECT> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.selectCloseAction(); }
}
void option() : {}
{
<STAGO> <OPTION> [ attlist() ] [<TAGC>] { callback.optionOpenAction();}
( pcdata() )*
[ LOOKAHEAD(2) etag() <OPTION> <TAGC> ]{ callback.optionCloseAction();}
}
void textarea() : {}
{
<STAGO> <TEXTAREA> [ attlist() ] [<TAGC>] { callback.textareaOpenAction();}
( pcdata() )*
try {
etag() <TEXTAREA> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.textareaCloseAction(); }
}
void table() : {}
{
<STAGO> <TABLE> [ attlist() ] [<TAGC>] { callback.tableOpenAction();}
[ LOOKAHEAD(2) caption() ] ( tr() )+
try {
etag() <TABLE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.tableCloseAction(); }
}
void tr() : {}
{
<STAGO> <TR> [ attlist() ] [<TAGC>] { callback.trOpenAction();}
( LOOKAHEAD(2) ( LOOKAHEAD(2) th() | td()) )*
[ LOOKAHEAD(2) etag() <TR> <TAGC> ]{ callback.trCloseAction();}
}
void th() : {}
{
<STAGO> <TH> [ attlist() ] [<TAGC>] { callback.thOpenAction();}
Ebody_content()
[ LOOKAHEAD(2) etag() <TH> <TAGC> ]{ callback.thCloseAction();}
}
void td() : {}
{
<STAGO> <TD> [ attlist() ] [<TAGC>] { callback.tdOpenAction();}
Ebody_content()
[ LOOKAHEAD(2) etag() <TD> <TAGC> ]{ callback.tdCloseAction();}
}
void caption() : {}
{
<STAGO> <CAPTION> [ attlist() ] [<TAGC>] { callback.captionOpenAction();}
( Etext() )*
try {
etag() <CAPTION> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.captionCloseAction(); }
}
// This is a hack to fake the inclusion exceptions within HEAD
// elements.
void Ehead_misc() : {}
{
(LOOKAHEAD(2)
( LOOKAHEAD(2) script()
| LOOKAHEAD(2) style()
| LOOKAHEAD(2) meta()
| link()
)
)*
}
// inclusion exception: Ehead_misc
// should use & connector: title() & (isindex())? & base()?
void head() : {}
{
[ LOOKAHEAD(2) <STAGO> <HEAD> [ attlist() ] [<TAGC>] ]{ callback.headOpenAction();}
Ehead_misc()
[ LOOKAHEAD(2) title() ]
Ehead_misc()
[ LOOKAHEAD(2) isindex() ]
Ehead_misc()
[ LOOKAHEAD(2) base() ]
Ehead_misc()
[ LOOKAHEAD(2) etag() <HEAD> <TAGC> ]{ callback.headCloseAction();}
}
// exclusion exception: Ehead_misc()
void title() : {}
{
<STAGO> <TITLE> [ attlist() ] [<TAGC>] { callback.titleOpenAction();}
( pcdata() )*
try {
etag() <TITLE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.titleCloseAction(); }
}
void isindex() : {}
{
<STAGO> <ISINDEX> [ attlist() ] [<TAGC>] { callback.isindexAction();}
}
void base() : {}
{
<STAGO> <BASE> [ attlist() ] [<TAGC>] { callback.baseAction();}
}
void meta() : {}
{
<STAGO> <META> [ attlist() ] [<TAGC>] { callback.metaAction();}
// <<<>>> MG 07/30/97 NON HTMLSTD Skip a META End Tag
[LOOKAHEAD(2) etag() <META> <TAGC>]
}
// exclusion exception: Ehead_misc()
void style() : {}
{
<STAGO> <STYLE> [ attlist() ] [<TAGC>] { callback.styleOpenAction();}
( pcdata() )*
try {
etag() <STYLE> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.styleCloseAction(); }
}
// exclusion exception: Ehead_misc()
void script() : {}
{
<STAGO> <SCRIPT> [ attlist() ] [<TAGC>] { callback.scriptOpenAction();}
( pcdata() )*
try {
etag() <SCRIPT> <TAGC>
}
catch (ParseException e) {
handleException();
}
{ callback.scriptCloseAction(); }
}
// MG 091197 Parse in buffered mode
void _html() : {}
{
[ LOOKAHEAD(2) <STAGO> <HTML> [ attlist() ] [<TAGC>] ]{ callback.htmlOpenAction();}
head()
}
// MG Called to Parse Close independently
void _htmlclose():{}
{
[ LOOKAHEAD(2) etag() <HTML> <TAGC> ]{ callback.htmlCloseAction();}
}
void html() : {}
{
[ LOOKAHEAD(2) <STAGO> <HTML> [ attlist() ] [<TAGC>] ] { callback.htmlOpenAction();}
head() body()
[ LOOKAHEAD(2) etag() <HTML> <TAGC> ]{ callback.htmlCloseAction();}
}
/* end */