package jlibs.xml.sax.async; import java.io.IOException; import static java.lang.Character.MAX_HIGH_SURROGATE; import static java.lang.Character.MIN_HIGH_SURROGATE; /** * DON'T EDIT THIS FILE. THIS IS GENERATED BY JLIBS * * @author Santhosh Kumar T */ public final class XMLScanner extends jlibs.nbp.NBParser{ private static final int STRING_IDS[][] = { {}, // dummy one {110, 111}, // no {121, 101, 115}, // yes {115, 116, 97, 110, 100, 97, 108, 111, 110, 101}, // standalone {101, 110, 99, 111, 100, 105, 110, 103}, // encoding {118, 101, 114, 115, 105, 111, 110}, // version {45, 45}, // -- {91, 67, 68, 65, 84, 65, 91}, // [CDATA[ {67, 68, 65, 84, 65}, // CDATA {60, 63, 120, 109, 108}, // <?xml {83, 89, 83, 84, 69, 77}, // SYSTEM {80, 85, 66, 76, 73, 67}, // PUBLIC {78, 79, 84, 65, 84, 73, 79, 78}, // NOTATION {78, 68, 65, 84, 65}, // NDATA {69, 78, 84, 73, 84, 89}, // ENTITY {69, 78, 84, 73, 84}, // ENTIT {78, 77, 84, 79, 75, 69, 78}, // NMTOKEN {35, 80, 67, 68, 65, 84, 65}, // #PCDATA {82, 69, 81, 85, 73, 82, 69, 68}, // REQUIRED {73, 77, 80, 76, 73, 69, 68}, // IMPLIED {70, 73, 88, 69, 68}, // FIXED {65, 84, 84, 76, 73, 83, 84}, // ATTLIST {69, 76, 69, 77, 69, 78, 84}, // ELEMENT {69, 77, 80, 84, 89}, // EMPTY {65, 78, 89}, // ANY {68, 79, 67, 84, 89, 80, 69}, // DOCTYPE {73, 71, 78, 79, 82, 69}, // IGNORE {73, 78, 67, 76, 85, 68, 69}, // INCLUDE }; public static final int RULE_STR_NO = -1; public static final int RULE_STR_YES = -2; public static final int RULE_STR_STANDALONE = -3; public static final int RULE_STR_ENCODING = -4; public static final int RULE_STR_VERSION = -5; public static final int RULE_STR_COMMENT_START = -6; public static final int RULE_STR_CDATA_START = -7; public static final int RULE_STR_CDATA = -8; public static final int RULE_STR_XML = -9; public static final int RULE_STR_SYSTEM = -10; public static final int RULE_STR_PUBLIC = -11; public static final int RULE_STR_NOTATION = -12; public static final int RULE_STR_NDATA = -13; public static final int RULE_STR_ENTITY = -14; public static final int RULE_STR_ENTIT = -15; public static final int RULE_STR_NMTOKEN = -16; public static final int RULE_STR_HASH_PCDATA = -17; public static final int RULE_STR_REQUIRED = -18; public static final int RULE_STR_IMPLIED = -19; public static final int RULE_STR_FIXED = -20; public static final int RULE_STR_ATTLIST = -21; public static final int RULE_STR_ELEMENT = -22; public static final int RULE_STR_EMPTY = -23; public static final int RULE_STR_ANY = -24; public static final int RULE_STR_DOCTYPE = -25; public static final int RULE_STR_IGNORE = -26; public static final int RULE_STR_INCLUDE = -27; /*-------------------------------------------------[ Matchers ]---------------------------------------------------*/ private static boolean DIGIT(int ch){ return ch>='0' && ch<='9'; } private static boolean HEX_DIGIT(int ch){ return (DIGIT(ch)) || (ch>='a' && ch<='f') || (ch>='A' && ch<='F'); } private static boolean ENCODING_START(int ch){ return (ch>='A' && ch<='Z') || (ch>='a' && ch<='z'); } private static boolean ELEM_CONTENT_CHAR(int ch){ return (ch!='<' && ch!='&') && (org.apache.xerces.util.XMLChar.isValid(ch)); } /*-------------------------------------------------[ Rules ]---------------------------------------------------*/ public static final int RULE_EQ = 0; private boolean eq(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=finishAll_WS())==EOC) break; if(ch=='='){ position++; state = 1; }else throw expected(ch, "<WS> OR [=]"); case 1: if(finishAll_WS()==EOC) break; return true; default: throw new Error("impossible state: "+state); } exiting(RULE_EQ, state); return false; } public static final int RULE_YES_NO = 1; private boolean yes_no(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; buffer.push(); if(ch=='n'){ state = 1; if(!matchString(RULE_STR_NO, 0, STRING_IDS[-RULE_STR_NO])) break; }else{ state = 1; if(!matchString(RULE_STR_YES, 0, STRING_IDS[-RULE_STR_YES])) break; } case 1: handler.standalone(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_YES_NO, state); return false; } public static final int RULE_SD_DECL = 2; private boolean sd_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_STANDALONE, 0, STRING_IDS[-RULE_STR_STANDALONE])) break loop; case 1: state = 2; if(!eq(0)) break loop; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; state = 4; if(yes_no(0)) continue; else break loop; }else if(ch=='"'){ position++; state = 3; if(!yes_no(0)) break loop; }else throw expected(ch, "<Q> OR <DQ>"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='"'){ position++; return true; }else throw expected(ch, "<DQ>"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; return true; }else throw expected(ch, "<Q>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_SD_DECL, state); return false; } public static final int RULE_ENC_NAME = 3; private boolean enc_name(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ENCODING_START(ch)){ buffer.push(); buffer.append(input[position++]); state = 1; }else throw expected(ch, "<ENCODING_START>"); case 1: if(finishAll_ENCODING_PART()) break; handler.encoding(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_ENC_NAME, state); return false; } public static final int RULE_ENC_DECL = 4; private boolean enc_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_ENCODING, 0, STRING_IDS[-RULE_STR_ENCODING])) break loop; case 1: state = 2; if(!eq(0)) break loop; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; state = 4; if(enc_name(0)) continue; else break loop; }else if(ch=='"'){ position++; state = 3; if(!enc_name(0)) break loop; }else throw expected(ch, "<Q> OR <DQ>"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='"'){ position++; return true; }else throw expected(ch, "<DQ>"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; return true; }else throw expected(ch, "<Q>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_ENC_DECL, state); return false; } public static final int RULE_VERSION_NUM = 5; private boolean version_num(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='1'){ buffer.push(); buffer.append(input[position++]); state = 1; }else throw expected(ch, "[1]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='.'){ buffer.append(input[position++]); state = 2; }else throw expected(ch, "[\\.]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break; if(DIGIT(ch)){ buffer.append(input[position++]); state = 3; }else throw expected(ch, "<DIGIT>"); case 3: if(finishAll_DIGIT()) break; handler.version(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_VERSION_NUM, state); return false; } public static final int RULE_VERSION_INFO = 6; private boolean version_info(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_VERSION, 0, STRING_IDS[-RULE_STR_VERSION])) break loop; case 1: state = 2; if(!eq(0)) break loop; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; state = 4; if(version_num(0)) continue; else break loop; }else if(ch=='"'){ position++; state = 3; if(!version_num(0)) break loop; }else throw expected(ch, "<Q> OR <DQ>"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='"'){ position++; return true; }else throw expected(ch, "<DQ>"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; return true; }else throw expected(ch, "<Q>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_VERSION_INFO, state); return false; } public static final int RULE_COMMENT = 7; private boolean comment(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; }else throw expected(ch, "[!]"); case 2: state = 3; if(!matchString(RULE_STR_COMMENT_START, 0, STRING_IDS[-RULE_STR_COMMENT_START])) break loop; case 3: buffer.push(); state = 4; case 4: if((ch=codePoint())==EOC) break loop; if(ch=='-'){ buffer.append(input[position++]); state = 5; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "<DASH> OR <CHAR>"); case 5: if((ch=codePoint())==EOC) break loop; if(ch=='-'){ buffer.append(input[position++]); state = 6; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 4; continue; }else throw expected(ch, "<DASH> OR <CHAR>"); case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ buffer.append(input[position++]); handler.comment(buffer.pop(0, 3)); return true; }else throw expected(ch, "[>]"); default: throw new Error("impossible state: "+state); } } exiting(RULE_COMMENT, state); return false; } public static final int RULE_CDATA_END = 8; private boolean cdata_end(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=codePoint())==EOC) break loop; if(ch==']'){ buffer.append(input[position++]); state = 1; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "<BRACKET_CLOSE> OR <CHAR>"); case 1: if((ch=codePoint())==EOC) break loop; if(ch==']'){ buffer.append(input[position++]); state = 2; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 0; continue; }else throw expected(ch, "<BRACKET_CLOSE> OR <CHAR>"); case 2: if((ch=finishAll(codePoint(), ']'))==EOC) break loop; if(ch=='>'){ buffer.append(input[position++]); return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 0; continue; }else throw expected(ch, "<BRACKET_CLOSE> OR <GT> OR <CHAR>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_CDATA_END, state); return false; } public static final int RULE_CDATA = 9; private boolean cdata(int state) throws Exception{ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_CDATA_START, 0, STRING_IDS[-RULE_STR_CDATA_START])) break; case 1: buffer.push(); state = 2; if(!cdata_end(0)) break; case 2: handler.cdata(buffer.pop(0, 3)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_CDATA, state); return false; } public static final int RULE_NAME = 10; private boolean name(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ if(buffer.isBuffering()) buffer.append(input[position]); position++; state = 1; }else throw expected(ch, "<NAME_START>"); case 1: if(finishAll_NAME_PART()) break; return true; default: throw new Error("impossible state: "+state); } exiting(RULE_NAME, state); return false; } public static final int RULE_PI = 11; private boolean pi(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='?'){ position++; buffer.push(); state = 2; if(!ncname(0)) break loop; }else throw expected(ch, "[?]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ handler.piTarget(buffer.pop(0, 0)); consume(ch); state = 4; continue; }else if(ch=='?'){ handler.piTarget(buffer.pop(0, 0)); handler.piData(); position++; state = 3; }else throw expected(ch, "<WS> OR [?]"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ position++; return true; }else throw expected(ch, "[>]"); case 4: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 5; case 5: if((ch=codePoint())==EOC) break loop; if(ch=='?'){ buffer.append(input[position++]); state = 6; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "[?] OR <CHAR>"); case 6: if((ch=finishAll(codePoint(), '?'))==EOC) break loop; if(ch=='>'){ handler.piData(buffer.pop(0, 1)); position++; return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 5; continue; }else throw expected(ch, "[?] OR [>] OR <CHAR>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_PI, state); return false; } public static final int RULE_NCNAME = 12; private boolean ncname(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNCNameStart(ch)){ buffer.append(input[position++]); state = 1; }else throw expected(ch, "<NCNAME_START>"); case 1: if(finishAll_NCNAME_PART()) break; return true; default: throw new Error("impossible state: "+state); } exiting(RULE_NCNAME, state); return false; } public static final int RULE_QNAME = 13; private boolean qname(int state) throws Exception{ int ch; switch(state){ case 0: buffer.push(); buffer.push(); state = 1; if(!ncname(0)) break; case 1: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch==':'){ handler.prefix(buffer.pop(0, 0)); buffer.append(input[position++]); state = 2; if(!ncname(0)) break; }else{ buffer.pop(0, 0); handler.qname(buffer.pop(0, 0)); return true; } case 2: handler.qname(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_QNAME, state); return false; } public static final int RULE_REFERENCE = 14; private boolean reference(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='&'){ position++; state = 1; }else throw expected(ch, "[\\&]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='#'){ position++; state = 3; continue; }else{ buffer.push(); state = 2; if(!name(0)) break loop; } case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==';'){ buffer.append(input[position++]); handler.entityReference(buffer.pop(0, 1)); return !stop; }else throw expected(ch, "[;]"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='x'){ position++; handler.hexCode(); state = 6; continue; }else if(DIGIT(ch)){ handler.asciiCode(); buffer.push(); buffer.append(input[position++]); state = 4; }else throw expected(ch, "[x] OR <DIGIT>"); case 4: if(finishAll_DIGIT()) break loop; state = 5; case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==';'){ buffer.append(input[position++]); handler.charReference(buffer.pop(0, 1)); return true; }else throw expected(ch, "[;]"); case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(HEX_DIGIT(ch)){ buffer.push(); buffer.append(input[position++]); state = 7; }else throw expected(ch, "<HEX_DIGIT>"); case 7: if(finishAll_HEX_DIGIT()) break loop; state = 5; continue; default: throw new Error("impossible state: "+state); } } exiting(RULE_REFERENCE, state); return false; } public static final int RULE_ATTR = 15; private boolean attr(int state) throws Exception{ switch(state){ case 0: state = 1; if(!qname(0)) break; case 1: state = 2; if(!eq(0)) break; case 2: state = 3; if(!value(0)) break; case 3: handler.attributeEnd(); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_ATTR, state); return false; } public static final int RULE_VALUE = 16; private boolean value(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ handler.valueStart(); position++; state = 3; continue; }else if(ch=='"'){ handler.valueStart(); position++; state = 1; }else throw expected(ch, "<Q> OR <DQ>"); case 1: buffer.push(); state = 2; case 2: if((ch=finishAll_ATTR_DQ_CONTENT())==EOC) break loop; if(ch=='"'){ handler.rawValue(buffer.pop(0, 0)); position++; handler.valueEnd(); return true; }else{ handler.rawValue(buffer.pop(0, 0)); state = 1; if(reference(0)) continue; else break loop; } case 3: buffer.push(); state = 4; case 4: if((ch=finishAll_ATTR_Q_CONTENT())==EOC) break loop; if(ch=='\''){ handler.rawValue(buffer.pop(0, 0)); position++; handler.valueEnd(); return true; }else{ handler.rawValue(buffer.pop(0, 0)); state = 3; if(reference(0)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_VALUE, state); return false; } public static final int RULE_ELEM_ATTRS = 17; private boolean elem_attrs(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!qname(0)) break loop; case 1: handler.attributesStart(); state = 2; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else{ return true; } case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNCNameStart(ch)){ state = 2; if(attr(0)) continue; else break loop; }else{ return true; } default: throw new Error("impossible state: "+state); } } exiting(RULE_ELEM_ATTRS, state); return false; } public static final int RULE_XDECL = 18; private boolean xdecl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_XML, 0, STRING_IDS[-RULE_STR_XML])) break loop; case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break loop; state = 3; if(!version_info(0)) break loop; case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 6; continue; }else{ state = 4; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='?'){ position++; state = 5; }else throw expected(ch, "[?]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ handler.xdeclEnd(); position++; return true; }else throw expected(ch, "[>]"); case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch=='e'){ state = 9; if(enc_decl(0)) continue; else break loop; }else if(ch=='?'){ state = 4; continue; }else{ state = 7; } case 7: state = 8; if(!sd_decl(0)) break loop; case 8: if(finishAll_WS()==EOC) break loop; state = 4; continue; case 9: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 10; }else{ state = 4; continue; } case 10: if((ch=finishAll_WS())==EOC) break loop; if(ch=='s'){ state = 7; continue; }else{ state = 4; continue; } default: throw new Error("impossible state: "+state); } } exiting(RULE_XDECL, state); return false; } public static final int RULE_MISC = 19; private boolean misc(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 1; continue; } addToLookAhead(ch); if(ch!=EOF){ if((ch=codePoint())==EOC) break loop; addToLookAhead(ch); } if(laLen==2){ if(la[0]=='<'){ if(ch=='!'){ resetLookAhead(); return comment(0); } } } resetLookAhead(); return pi(0); case 1: if(finishAll_WS()==EOC) break loop; return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_MISC, state); return false; } public static final int RULE_SYTEM_LITERAL = 20; private boolean sytem_literal(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ position++; buffer.push(); state = 2; continue; }else if(ch=='"'){ position++; buffer.push(); state = 1; }else throw expected(ch, "<Q> OR <DQ>"); case 1: if((ch=codePoint())==EOC) break loop; if(ch=='"'){ handler.systemID(buffer.pop(0, 0)); position++; return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "<DQ> OR <CHAR>"); case 2: if((ch=codePoint())==EOC) break loop; if(ch=='\''){ handler.systemID(buffer.pop(0, 0)); position++; return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "<Q> OR <CHAR>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_SYTEM_LITERAL, state); return false; } public static final int RULE_PUBID_LITERAL = 21; private boolean pubid_literal(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='"'){ position++; buffer.push(); state = 2; continue; }else if(ch=='\''){ position++; buffer.push(); state = 1; }else throw expected(ch, "<DQ> OR <Q>"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch=='\''){ handler.publicID(buffer.pop(0, 0)); position++; return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isPubid(ch)){ consume(ch); continue; }else throw expected(ch, "<Q> OR <PUBID_CHAR>"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch=='"'){ handler.publicID(buffer.pop(0, 0)); position++; return true; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isPubid(ch)){ consume(ch); continue; }else throw expected(ch, "<DQ> OR <PUBID_CHAR>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_PUBID_LITERAL, state); return false; } public static final int RULE_SYSTEM_ID = 22; private boolean system_id(int state) throws Exception{ int ch; switch(state){ case 0: state = 1; if(!matchString(RULE_STR_SYSTEM, 0, STRING_IDS[-RULE_STR_SYSTEM])) break; case 1: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break; return sytem_literal(0); default: throw new Error("impossible state: "+state); } exiting(RULE_SYSTEM_ID, state); return false; } public static final int RULE_PUBLIC_ID = 23; private boolean public_id(int state) throws Exception{ int ch; switch(state){ case 0: state = 1; if(!matchString(RULE_STR_PUBLIC, 0, STRING_IDS[-RULE_STR_PUBLIC])) break; case 1: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break; return pubid_literal(0); default: throw new Error("impossible state: "+state); } exiting(RULE_PUBLIC_ID, state); return false; } public static final int RULE_NOTATION_DECL = 24; private boolean notation_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; if(!matchString(RULE_STR_NOTATION, 0, STRING_IDS[-RULE_STR_NOTATION])) break loop; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else throw expected(ch, "<WS>"); case 3: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 4; if(!ncname(0)) break loop; case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ handler.notationName(buffer.pop(0, 0)); consume(ch); state = 5; }else throw expected(ch, "<WS>"); case 5: if((ch=finishAll_WS())==EOC) break loop; if(ch=='P'){ state = 8; if(public_id(0)) continue; else break loop; }else{ state = 6; if(!system_id(0)) break loop; } case 6: if(finishAll_WS()==EOC) break loop; state = 7; case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ position++; handler.notationEnd(); return true; }else throw expected(ch, "[>]"); case 8: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 9; }else{ state = 7; continue; } case 9: if((ch=finishAll_WS())==EOC) break loop; if(ch=='>'){ state = 7; continue; }else{ state = 6; if(sytem_literal(0)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_NOTATION_DECL, state); return false; } public static final int RULE_EXTERNAL_ID = 25; private boolean external_id(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='P'){ state = 1; if(!public_id(0)) break; }else{ return system_id(0); } case 1: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break; return sytem_literal(0); default: throw new Error("impossible state: "+state); } exiting(RULE_EXTERNAL_ID, state); return false; } public static final int RULE_PE_REFERENCE = 26; private boolean pe_reference(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='%'){ position++; buffer.push(); state = 1; if(!name(0)) break; }else throw expected(ch, "[%]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch==';'){ handler.peReference(buffer.pop(0, 0)); position++; return !stop; }else throw expected(ch, "[;]"); default: throw new Error("impossible state: "+state); } exiting(RULE_PE_REFERENCE, state); return false; } public static final int RULE_NDATA_DECL = 27; private boolean ndata_decl(int state) throws Exception{ int ch; switch(state){ case 0: state = 1; if(!matchString(RULE_STR_NDATA, 0, STRING_IDS[-RULE_STR_NDATA])) break; case 1: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break; buffer.push(); state = 3; if(!name(0)) break; case 3: handler.notationReference(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_NDATA_DECL, state); return false; } public static final int RULE_PE_DEF = 28; private boolean pe_def(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='P'){ return external_id(0); }else if(ch=='S'){ return external_id(0); }else{ return entity_value(0); } default: throw new Error("impossible state: "+state); } exiting(RULE_PE_DEF, state); return false; } public static final int RULE_ENTITY_VALUE = 29; private boolean entity_value(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='\''){ handler.valueStart(); handler.entityValue(); position++; state = 3; continue; }else if(ch=='"'){ handler.valueStart(); handler.entityValue(); position++; state = 1; }else throw expected(ch, "<Q> OR <DQ>"); case 1: buffer.push(); state = 2; case 2: if((ch=finishAll_ENTITY_DQ_CONTENT())==EOC) break loop; if(ch=='"'){ handler.rawValue(buffer.pop(0, 0)); position++; handler.valueEnd(); return true; }else if(ch=='&'){ handler.rawValue(buffer.pop(0, 0)); state = 1; if(reference(0)) continue; else break loop; }else{ handler.rawValue(buffer.pop(0, 0)); state = 1; if(pe_reference(0)) continue; else break loop; } case 3: buffer.push(); state = 4; case 4: if((ch=finishAll_ENTITY_Q_CONTENT())==EOC) break loop; if(ch=='\''){ handler.rawValue(buffer.pop(0, 0)); position++; handler.valueEnd(); return true; }else if(ch=='&'){ handler.rawValue(buffer.pop(0, 0)); state = 3; if(reference(0)) continue; else break loop; }else{ handler.rawValue(buffer.pop(0, 0)); state = 3; if(pe_reference(0)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_ENTITY_VALUE, state); return false; } public static final int RULE_ENTITY_DECL = 30; private boolean entity_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; if(!matchString(RULE_STR_ENTITY, 0, STRING_IDS[-RULE_STR_ENTITY])) break loop; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else throw expected(ch, "<WS>"); case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch=='%'){ position++; state = 7; continue; }else{ buffer.push(); state = 4; if(!ncname(0)) break loop; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ handler.entityName(buffer.pop(0, 0)); consume(ch); state = 5; }else throw expected(ch, "<WS>"); case 5: if(finishAll_WS()==EOC) break loop; state = 6; if(!entity_def(0)) break loop; case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch=='>'){ position++; handler.entityEnd(); return true; }else throw expected(ch, "<WS> OR [>]"); case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 8; }else throw expected(ch, "<WS>"); case 8: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 9; if(!ncname(0)) break loop; case 9: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ handler.paramEntityName(buffer.pop(0, 0)); consume(ch); state = 10; }else throw expected(ch, "<WS>"); case 10: if(finishAll_WS()==EOC) break loop; state = 11; if(!pe_def(0)) break loop; case 11: if((ch=finishAll_WS())==EOC) break loop; if(ch=='>'){ position++; handler.paramEntityEnd(); return true; }else throw expected(ch, "<WS> OR [>]"); default: throw new Error("impossible state: "+state); } } exiting(RULE_ENTITY_DECL, state); return false; } public static final int RULE_ENTITY_DEF = 31; private boolean entity_def(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='P'){ state = 1; if(!external_id(0)) break; }else if(ch=='S'){ state = 1; if(!external_id(0)) break; }else{ return entity_value(0); } case 1: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else{ return true; } case 2: if((ch=finishAll_WS())==EOC) break; if(ch=='N'){ return ndata_decl(0); }else{ return true; } default: throw new Error("impossible state: "+state); } exiting(RULE_ENTITY_DEF, state); return false; } public static final int RULE_TOKENIZED_TYPE = 32; private boolean tokenized_type(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='E'){ state = 7; if(matchString(RULE_STR_ENTIT, 0, STRING_IDS[-RULE_STR_ENTIT])) continue; else break loop; }else if(ch=='I'){ position++; state = 2; continue; }else{ state = 1; if(!matchString(RULE_STR_NMTOKEN, 0, STRING_IDS[-RULE_STR_NMTOKEN])) break loop; } case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='S'){ position++; handler.nmtokensAttribute(); return true; }else{ handler.nmtokenAttribute(); return true; } case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='D'){ position++; state = 3; }else throw expected(ch, "[D]"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='R'){ position++; state = 4; }else{ handler.idAttribute(); return true; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='E'){ position++; state = 5; }else throw expected(ch, "[E]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='F'){ position++; state = 6; }else throw expected(ch, "[F]"); case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='S'){ position++; handler.idRefsAttribute(); return true; }else{ handler.idRefAttribute(); return true; } case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='Y'){ position++; handler.entityAttribute(); return true; }else if(ch=='I'){ position++; state = 8; }else throw expected(ch, "[Y] OR [I]"); case 8: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='E'){ position++; state = 9; }else throw expected(ch, "[E]"); case 9: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='S'){ position++; handler.entitiesAttribute(); return true; }else throw expected(ch, "[S]"); default: throw new Error("impossible state: "+state); } } exiting(RULE_TOKENIZED_TYPE, state); return false; } public static final int RULE_NMTOKEN = 33; private boolean nmtoken(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch!=EOF && org.apache.xerces.util.XMLChar.isName(ch)){ buffer.append(input[position++]); state = 1; }else throw expected(ch, "<NAME_PART>"); case 1: if(finishAll_NAME_PART()) break; return true; default: throw new Error("impossible state: "+state); } exiting(RULE_NMTOKEN, state); return false; } public static final int RULE_ENUMERATION = 34; private boolean enumeration(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='('){ handler.enumerationAttribute(); position++; state = 1; }else throw expected(ch, "[(]"); case 1: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 2; if(!nmtoken(0)) break loop; case 2: handler.attributeEnumValue(buffer.pop(0, 0)); state = 3; case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 5; continue; }else{ state = 4; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==')'){ position++; return true; }else throw expected(ch, "[)]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='|'){ position++; state = 6; }else throw expected(ch, "[|]"); case 6: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 7; if(!nmtoken(0)) break loop; case 7: handler.attributeEnumValue(buffer.pop(0, 0)); state = 8; case 8: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 5; continue; }else{ state = 4; continue; } default: throw new Error("impossible state: "+state); } } exiting(RULE_ENUMERATION, state); return false; } public static final int RULE_MIXED = 35; private boolean mixed(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_HASH_PCDATA, 0, STRING_IDS[-RULE_STR_HASH_PCDATA])) break loop; case 1: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 4; continue; } if(ch=='%'){ if(pe_reference(0)) continue; else break loop; } addToLookAhead(ch); if(ch!=EOF){ if((ch=codePoint())==EOC) break loop; addToLookAhead(ch); } if(laLen==2){ if(la[0]==')'){ if(ch=='*'){ resetLookAhead(); state = 2; continue; } consume(FROM_LA); resetLookAhead(); return true; } } throw expected(ch, "<WS> OR [|] OR [%] OR [)][*] OR [)]<EOF>"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==')'){ position++; state = 3; }else throw expected(ch, "[)]"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='*'){ position++; return true; }else throw expected(ch, "[*]"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='|'){ position++; state = 5; }else throw expected(ch, "[|]"); case 5: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ state = 6; if(!name(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 4; continue; }else if(ch==')'){ state = 2; continue; }else{ if(pe_reference(0)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_MIXED, state); return false; } public static final int RULE_NOTATION_TYPE = 36; private boolean notation_type(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: handler.notationAttribute(); state = 1; if(!matchString(RULE_STR_NOTATION, 0, STRING_IDS[-RULE_STR_NOTATION])) break loop; case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if((ch=finishAll_WS())==EOC) break loop; if(ch=='('){ position++; state = 3; }else throw expected(ch, "<WS> OR [(]"); case 3: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 4; if(!name(0)) break loop; case 4: handler.attributeNotationValue(buffer.pop(0, 0)); state = 5; case 5: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 7; continue; }else{ state = 6; } case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==')'){ position++; return true; }else throw expected(ch, "[)]"); case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='|'){ position++; state = 8; }else throw expected(ch, "[|]"); case 8: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 9; if(!name(0)) break loop; case 9: handler.attributeNotationValue(buffer.pop(0, 0)); state = 10; case 10: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 7; continue; }else{ state = 6; continue; } default: throw new Error("impossible state: "+state); } } exiting(RULE_NOTATION_TYPE, state); return false; } public static final int RULE_ENUMERATED_TYPE = 37; private boolean enumerated_type(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='N'){ return notation_type(0); }else{ return enumeration(0); } default: throw new Error("impossible state: "+state); } exiting(RULE_ENUMERATED_TYPE, state); return false; } public static final int RULE_ATT_TYPE = 38; private boolean att_type(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='C'){ state = 1; if(matchString(RULE_STR_CDATA, 0, STRING_IDS[-RULE_STR_CDATA])) continue; else break loop; } if(ch=='('){ return enumerated_type(0); } int available0 = limit-position+(marker==EOF ? 1 : 0); if(available0>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='N'){ if(ch=='O'){ return enumerated_type(0); } } }else if(marker==EOC) break loop; return tokenized_type(0); case 1: handler.cdataAttribute(); return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_ATT_TYPE, state); return false; } public static final int RULE_DEFAULT_DECL = 39; private boolean default_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='#'){ position++; state = 2; continue; }else{ state = 1; if(!value(0)) break loop; } case 1: handler.attributeDefaultValue(); return true; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='R'){ handler.attributeRequired(); return matchString(RULE_STR_REQUIRED, 0, STRING_IDS[-RULE_STR_REQUIRED]); }else if(ch=='I'){ handler.attributeImplied(); return matchString(RULE_STR_IMPLIED, 0, STRING_IDS[-RULE_STR_IMPLIED]); }else{ state = 3; if(!matchString(RULE_STR_FIXED, 0, STRING_IDS[-RULE_STR_FIXED])) break loop; } case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 4; }else throw expected(ch, "<WS>"); case 4: if(finishAll_WS()==EOC) break loop; state = 5; if(!value(0)) break loop; case 5: handler.attributeFixedValue(); return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_DEFAULT_DECL, state); return false; } public static final int RULE_ATT_DEF = 40; private boolean att_def(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: buffer.push(); state = 1; if(!name(0)) break loop; case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ handler.dtdAttribute(buffer.pop(0, 0)); consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if(finishAll_WS()==EOC) break loop; state = 3; if(!att_type(0)) break loop; case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 4; }else{ if(pe_reference(0)) continue; else break loop; } case 4: if((ch=finishAll_WS())==EOC) break loop; if(ch=='%'){ if(pe_reference(0)) continue; else break loop; }else{ return default_decl(0); } default: throw new Error("impossible state: "+state); } } exiting(RULE_ATT_DEF, state); return false; } public static final int RULE_ATT_LIST_DECL = 41; private boolean att_list_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; if(!matchString(RULE_STR_ATTLIST, 0, STRING_IDS[-RULE_STR_ATTLIST])) break loop; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else{ if(pe_reference(0)) continue; else break loop; } case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ buffer.push(); state = 4; if(!name(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; handler.dtdAttributesStart(buffer.pop(0, 0)); if(ch=='>'){ state = 8; continue; }else{ state = 5; } case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 6; }else{ if(pe_reference(0)) continue; else break loop; } case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ state = 7; if(!att_def(0)) break loop; }else if(ch=='>'){ state = 8; continue; }else{ if(pe_reference(0)) continue; else break loop; } case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ state = 8; }else{ state = 5; continue; } case 8: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ position++; return true; }else throw expected(ch, "[>]"); default: throw new Error("impossible state: "+state); } } exiting(RULE_ATT_LIST_DECL, state); return false; } public static final int RULE_CHILDREN = 42; private boolean children(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='('){ position++; state = 1; }else throw expected(ch, "[(]"); case 1: if((ch=finishAll_WS())==EOC) break loop; if(ch=='('){ state = 2; if(!children(0)) break loop; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ state = 2; if(!name_cardinality(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 2: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 8; continue; }else if(ch==','){ state = 5; continue; }else if(ch==')'){ state = 3; }else{ if(pe_reference(0)) continue; else break loop; } case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==')'){ position++; state = 4; }else throw expected(ch, "[)]"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='?' || ch=='+' || ch=='*'){ position++; return true; }else{ return true; } case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==','){ position++; state = 6; }else throw expected(ch, "[,]"); case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ state = 7; if(!name_cardinality(0)) break loop; }else if(ch=='('){ state = 7; if(!children(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 7: if((ch=finishAll_WS())==EOC) break loop; if(ch==','){ state = 5; continue; }else if(ch==')'){ state = 3; continue; }else{ if(pe_reference(0)) continue; else break loop; } case 8: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='|'){ position++; state = 9; }else throw expected(ch, "[|]"); case 9: if((ch=finishAll_WS())==EOC) break loop; if(ch=='('){ state = 10; if(!children(0)) break loop; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ state = 10; if(!name_cardinality(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 10: if((ch=finishAll_WS())==EOC) break loop; if(ch=='|'){ state = 8; continue; }else if(ch==')'){ state = 3; continue; }else{ if(pe_reference(0)) continue; else break loop; } case 11: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='('){ state = 2; if(children(0)) continue; else break loop; }else{ state = 2; if(name_cardinality(0)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_CHILDREN, state); return false; } public static final int RULE_NAME_CARDINALITY = 43; private boolean name_cardinality(int state) throws Exception{ int ch; switch(state){ case 0: state = 1; if(!name(0)) break; case 1: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='?' || ch=='*' || ch=='+'){ position++; return true; }else{ return true; } default: throw new Error("impossible state: "+state); } exiting(RULE_NAME_CARDINALITY, state); return false; } public static final int RULE_DECL_SEP = 44; private boolean decl_sep(int state) throws Exception{ int ch; switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 1; }else{ handler.peReferenceOutsideMarkup(); return pe_reference(0); } case 1: if(finishAll_WS()==EOC) break; return true; default: throw new Error("impossible state: "+state); } exiting(RULE_DECL_SEP, state); return false; } public static final int RULE_MARKUP_DECL = 45; private boolean markup_decl(int state) throws Exception{ int ch; switch(state){ case 0: int available0 = limit-position+(marker==EOF ? 1 : 0); if(available0>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch=='?'){ return pi(0); } } }else if(marker==EOC) break; if(available0>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='A'){ return att_list_decl(0); } if(ch=='N'){ return notation_decl(0); } if(ch=='-'){ return comment(0); } } } }else if(marker==EOC) break; if(available0>=4){ ch = limit==position+3 ? EOF : input[position+3]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(input[position+2]=='E'){ if(ch=='L'){ return element_decl(0); } } } } }else if(marker==EOC) break; return entity_decl(0); default: throw new Error("impossible state: "+state); } exiting(RULE_MARKUP_DECL, state); return false; } public static final int RULE_ELEMENT_DECL = 46; private boolean element_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; if(!matchString(RULE_STR_ELEMENT, 0, STRING_IDS[-RULE_STR_ELEMENT])) break loop; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else{ if(pe_reference(0)) continue; else break loop; } case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isNameStart(ch)){ buffer.push(); state = 4; if(!name(0)) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 4: handler.dtdElement(buffer.pop(0, 0)); state = 5; case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 6; }else{ if(pe_reference(0)) continue; else break loop; } case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch=='('){ position++; state = 8; continue; }else if(ch=='E'){ handler.notMixed(); state = 7; if(!matchString(RULE_STR_EMPTY, 0, STRING_IDS[-RULE_STR_EMPTY])) break loop; }else if(ch=='A'){ state = 7; if(!matchString(RULE_STR_ANY, 0, STRING_IDS[-RULE_STR_ANY])) break loop; }else{ if(pe_reference(0)) continue; else break loop; } case 7: if((ch=finishAll_WS())==EOC) break loop; if(ch=='>'){ position++; return true; }else{ if(pe_reference(0)) continue; else break loop; } case 8: if((ch=finishAll_WS())==EOC) break loop; if(ch=='%'){ if(pe_reference(0)) continue; else break loop; }else if(ch=='#'){ state = 7; if(mixed(0)) continue; else break loop; }else{ handler.notMixed(); state = 7; if(children(11)) continue; else break loop; } default: throw new Error("impossible state: "+state); } } exiting(RULE_ELEMENT_DECL, state); return false; } public static final int RULE_INT_SUBSET = 47; private boolean int_subset(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='%'){ state = 1; if(!decl_sep(0)) break loop; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ state = 1; if(!decl_sep(0)) break loop; }else{ state = 1; if(!markup_decl(0)) break loop; } case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='%'){ state = 0; continue; } if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ state = 0; continue; } int available1 = limit-position+(marker==EOF ? 1 : 0); if(available1>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch=='?'){ state = 0; continue; } } }else if(marker==EOC) break loop; if(available1>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='A'){ state = 0; continue; } if(ch=='N'){ state = 0; continue; } if(ch=='-'){ state = 0; continue; } } } }else if(marker==EOC) break loop; if(available1>=4){ ch = limit==position+3 ? EOF : input[position+3]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(input[position+2]=='E'){ if(ch=='L'){ state = 0; continue; } if(ch=='N'){ state = 0; continue; } } } } }else if(marker==EOC) break loop; return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_INT_SUBSET, state); return false; } public static final int RULE_DOCTYPE_DECL = 48; private boolean doctype_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; if(!matchString(RULE_STR_DOCTYPE, 0, STRING_IDS[-RULE_STR_DOCTYPE])) break loop; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 3; }else throw expected(ch, "<WS>"); case 3: if(finishAll_WS()==EOC) break loop; buffer.push(); state = 4; if(!name(0)) break loop; case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; handler.dtdRoot(buffer.pop(0, 0)); if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 9; continue; }else{ state = 5; } case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; handler.dtdStart(); if(ch=='['){ position++; state = 7; if(int_subset(0)) continue; else break loop; }else{ state = 6; } case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ position++; handler.dtdEnd(); return !stop; }else throw expected(ch, "[>]"); case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch==']'){ position++; state = 8; }else throw expected(ch, "[\\]]"); case 8: if(finishAll_WS()==EOC) break loop; state = 6; continue; case 9: if((ch=finishAll_WS())==EOC) break loop; if(ch=='P'){ state = 10; if(!external_id(0)) break loop; }else if(ch=='S'){ state = 10; if(!external_id(0)) break loop; }else{ state = 5; continue; } case 10: if(finishAll_WS()==EOC) break loop; state = 5; continue; default: throw new Error("impossible state: "+state); } } exiting(RULE_DOCTYPE_DECL, state); return false; } public static final int RULE_DOCUMENT = 49; private boolean document(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: int available0 = limit-position+(marker==EOF ? 1 : 0); if(available0>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch!=EOF && org.apache.xerces.util.XMLChar.isNCNameStart(ch)){ state = 2; continue; } } }else if(marker==EOC) break loop; if(available0>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='D'){ state = 1; if(doctype_decl(0)) continue; else break loop; } } } }else if(marker==EOC) break loop; if(misc(0)) continue; else break loop; case 1: int available1 = limit-position+(marker==EOF ? 1 : 0); if(available1>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch!=EOF && org.apache.xerces.util.XMLChar.isNCNameStart(ch)){ state = 2; continue; } } }else if(marker==EOC) break loop; if(misc(0)) continue; else break loop; case 2: state = 3; if(!elem(0)) break loop; case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ if(misc(0)) continue; else break loop; } int available3 = limit-position+(marker==EOF ? 1 : 0); if(available3>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch=='!'){ if(misc(0)) continue; else break loop; } if(ch=='?'){ if(misc(0)) continue; else break loop; } } }else if(marker==EOC) break loop; return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_DOCUMENT, state); return false; } public static final int RULE_ELEM = 50; private boolean elem(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; if(!elem_attrs(0)) break loop; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='/'){ position++; state = 3; continue; }else if(ch=='>'){ position++; handler.attributesEnd(); state = 2; if(!elem_content(0)) break loop; }else throw expected(ch, "[/] OR [>]"); case 2: handler.rootElementEnd(); return true; case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ handler.attributesEnd(); position++; handler.elementEnd(); return true; }else throw expected(ch, "[>]"); default: throw new Error("impossible state: "+state); } } exiting(RULE_ELEM, state); return false; } public static final int RULE_ELEM_CONTENT = 51; private boolean elem_content(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: buffer.push(); state = 1; case 1: if((ch=finishAll_ELEM_CONTENT_CHAR_NBRACE())==EOC) break loop; if(ch==']'){ buffer.append(input[position++]); state = 8; continue; }else{ state = 2; } case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; handler.characters(buffer.pop(0, 0)); if(ch=='<'){ position++; state = 3; }else if(ch=='&'){ state = 0; if(reference(0)) continue; else break loop; }else{ return true; } case 3: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 7; continue; }else if(ch=='/'){ handler.endingElem(); position++; state = 6; if(matchString(0, dynamicStringToBeMatched)) continue; else break loop; }else if(ch=='?'){ state = 0; if(pi(1)) continue; else break loop; }else{ state = 4; if(!elem_attrs(0)) break loop; } case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='/'){ position++; state = 5; }else if(ch=='>'){ position++; handler.attributesEnd(); state = 0; continue; }else throw expected(ch, "[/] OR [>]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ handler.attributesEnd(); position++; handler.elementEnd(); state = 0; continue; }else throw expected(ch, "[>]"); case 6: if((ch=finishAll_WS())==EOC) break loop; if(ch=='>'){ position++; handler.elementEnd(); state = 0; if(pop) return true; continue; }else throw expected(ch, "<WS> OR [>]"); case 7: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='-'){ state = 0; if(comment(2)) continue; else break loop; }else{ state = 0; if(cdata(0)) continue; else break loop; } case 8: if((ch=codePoint())==EOC) break loop; if(ch==']'){ buffer.append(input[position++]); state = 9; }else if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ consume(ch); state = 1; continue; }else{ state = 2; continue; } case 9: if((ch=finishAll(codePoint(), ']'))==EOC) break loop; if(ch=='>'){ buffer.append(input[position++]); throw handler.fatalError("Text may not contain a literal ']]>' sequence"); }else if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ consume(ch); state = 1; continue; }else{ state = 2; continue; } default: throw new Error("impossible state: "+state); } } exiting(RULE_ELEM_CONTENT, state); return false; } public static final int RULE_TEXT_DECL = 52; private boolean text_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_XML, 0, STRING_IDS[-RULE_STR_XML])) break loop; case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 2; }else throw expected(ch, "<WS>"); case 2: if((ch=finishAll_WS())==EOC) break loop; if(ch=='v'){ state = 6; if(version_info(0)) continue; else break loop; }else{ state = 3; } case 3: state = 4; if(!enc_decl(0)) break loop; case 4: if((ch=finishAll_WS())==EOC) break loop; if(ch=='?'){ position++; state = 5; }else throw expected(ch, "<WS> OR [?]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='>'){ handler.xdeclEnd(); position++; return true; }else throw expected(ch, "[>]"); case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; increment = 1; if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ consume(ch); state = 7; }else throw expected(ch, "<WS>"); case 7: if(finishAll_WS()==EOC) break loop; state = 3; continue; default: throw new Error("impossible state: "+state); } } exiting(RULE_TEXT_DECL, state); return false; } public static final int RULE_IGNORE_SECT = 53; private boolean ignore_sect(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: state = 1; if(!matchString(RULE_STR_IGNORE, 0, STRING_IDS[-RULE_STR_IGNORE])) break loop; case 1: if((ch=finishAll_WS())==EOC) break loop; if(ch=='['){ position++; state = 2; }else throw expected(ch, "<WS> OR [\\[]"); case 2: state = 3; case 3: if((ch=codePoint())==EOC) break loop; if(ch==']'){ position++; state = 7; continue; }else if(ch=='<'){ state = 4; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); continue; }else throw expected(ch, "[\\]] OR [<] OR <CHAR>"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 5; }else throw expected(ch, "[<]"); case 5: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 6; }else{ state = 3; continue; } case 6: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='['){ position++; state = 3; if(ignore_sect(2)) continue; else break loop; }else{ state = 3; continue; } case 7: if((ch=codePoint())==EOC) break loop; if(ch==']'){ position++; state = 8; }else if(ch=='<'){ state = 4; continue; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 3; continue; }else throw expected(ch, "[\\]] OR [<] OR <CHAR>"); case 8: if((ch=finishAll(codePoint(), ']'))==EOC) break loop; if(ch=='>'){ position++; return true; }else if(ch=='<'){ state = 4; continue; }else if(ch!=EOF && org.apache.xerces.util.XMLChar.isValid(ch)){ consume(ch); state = 3; continue; }else throw expected(ch, "[\\]] OR [>] OR [<] OR <CHAR>"); default: throw new Error("impossible state: "+state); } } exiting(RULE_IGNORE_SECT, state); return false; } public static final int RULE_EXT_SUBSET_DECL = 54; private boolean ext_subset_decl(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='%'){ state = 1; continue; } if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ state = 1; continue; } int available0 = limit-position+(marker==EOF ? 1 : 0); if(available0>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch=='?'){ state = 1; continue; } } }else if(marker==EOC) break loop; if(available0>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='A'){ state = 1; continue; } if(ch=='N'){ state = 1; continue; } if(ch=='-'){ state = 1; continue; } if(ch=='['){ state = 1; continue; } } } }else if(marker==EOC) break loop; if(available0>=4){ ch = limit==position+3 ? EOF : input[position+3]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(input[position+2]=='E'){ if(ch=='L'){ state = 1; continue; } if(ch=='N'){ state = 1; continue; } } } } }else if(marker==EOC) break loop; return true; case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='%'){ state = 2; if(decl_sep(0)) continue; else break loop; } if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ state = 2; if(decl_sep(0)) continue; else break loop; } int available1 = limit-position+(marker==EOF ? 1 : 0); if(available1>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='['){ state = 2; if(conditional_sect(0)) continue; else break loop; } } } }else if(marker==EOC) break loop; state = 2; if(markup_decl(0)) continue; else break loop; case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='%'){ state = 1; continue; } if(ch!=EOF && org.apache.xerces.util.XMLChar.isSpace(ch)){ state = 1; continue; } int available2 = limit-position+(marker==EOF ? 1 : 0); if(available2>=2){ ch = limit==position+1 ? EOF : input[position+1]; if(input[position]=='<'){ if(ch=='?'){ state = 1; continue; } } }else if(marker==EOC) break loop; if(available2>=3){ ch = limit==position+2 ? EOF : input[position+2]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(ch=='A'){ state = 1; continue; } if(ch=='N'){ state = 1; continue; } if(ch=='-'){ state = 1; continue; } if(ch=='['){ state = 1; continue; } } } }else if(marker==EOC) break loop; if(available2>=4){ ch = limit==position+3 ? EOF : input[position+3]; if(input[position]=='<'){ if(input[position+1]=='!'){ if(input[position+2]=='E'){ if(ch=='L'){ state = 1; continue; } if(ch=='N'){ state = 1; continue; } } } } }else if(marker==EOC) break loop; return true; default: throw new Error("impossible state: "+state); } } exiting(RULE_EXT_SUBSET_DECL, state); return false; } public static final int RULE_CONDITIONAL_SECT = 55; private boolean conditional_sect(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='<'){ position++; state = 1; }else throw expected(ch, "[<]"); case 1: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='!'){ position++; state = 2; }else throw expected(ch, "[!]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break loop; if(ch=='['){ position++; state = 3; }else throw expected(ch, "[\\[]"); case 3: if((ch=finishAll_WS())==EOC) break loop; if(ch=='%'){ if(pe_reference(0)) continue; else break loop; } addToLookAhead(ch); if(ch!=EOF){ if((ch=codePoint())==EOC) break loop; addToLookAhead(ch); } if(laLen==2){ if(la[0]=='I'){ if(ch=='G'){ resetLookAhead(); return ignore_sect(0); } } } resetLookAhead(); return include_sect(0); default: throw new Error("impossible state: "+state); } } exiting(RULE_CONDITIONAL_SECT, state); return false; } public static final int RULE_INCLUDE_SECT = 56; private boolean include_sect(int state) throws Exception{ int ch; switch(state){ case 0: state = 1; if(!matchString(RULE_STR_INCLUDE, 0, STRING_IDS[-RULE_STR_INCLUDE])) break; case 1: if((ch=finishAll_WS())==EOC) break; if(ch=='['){ position++; state = 2; if(!ext_subset_decl(0)) break; }else throw expected(ch, "<WS> OR [\\[]"); case 2: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch==']'){ position++; state = 3; }else throw expected(ch, "[\\]]"); case 3: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch==']'){ position++; state = 4; }else throw expected(ch, "[\\]]"); case 4: if((ch=position==limit ? marker : input[position])==EOC) break; if(ch=='>'){ position++; return true; }else throw expected(ch, "[>]"); default: throw new Error("impossible state: "+state); } exiting(RULE_INCLUDE_SECT, state); return false; } public static final int RULE_EXTERNAL_ENTITY_VALUE = 57; private boolean external_entity_value(int state) throws Exception{ int ch; switch(state){ case 0: buffer.push(); state = 1; case 1: if(finishAll_CHAR()==EOC) break; handler.externalEntityValue(buffer.pop(0, 0)); return true; default: throw new Error("impossible state: "+state); } exiting(RULE_EXTERNAL_ENTITY_VALUE, state); return false; } public static final int RULE_INT_VALUE = 58; private boolean int_value(int state) throws Exception{ int ch; loop: while(true){ switch(state){ case 0: if((ch=codePoint())==EOC) break loop; if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ state = 3; continue; }else if(ch=='&'){ state = 1; }else{ return true; } case 1: state = 2; if(!reference(0)) break loop; case 2: if((ch=codePoint())==EOC) break loop; if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ state = 3; }else if(ch=='&'){ state = 1; continue; }else{ return true; } case 3: buffer.push(); state = 4; case 4: if((ch=codePoint())==EOC) break loop; if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ consume(ch); state = 5; }else throw expected(ch, "<ELEM_CONTENT_CHAR>"); case 5: if((ch=codePoint())==EOC) break loop; if(ch=='&'){ handler.rawValue(buffer.pop(0, 0)); state = 1; continue; }else if(ch!=EOF && ELEM_CONTENT_CHAR(ch)){ state = 4; continue; }else{ handler.rawValue(buffer.pop(0, 0)); return true; } default: throw new Error("impossible state: "+state); } } exiting(RULE_INT_VALUE, state); return false; } private int finishAll_WS() throws IOException{ int ch; asciiLoop: while(true){ while(position<limit){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; } else if(org.apache.xerces.util.XMLChar.isSpace(ch)){ position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } return codePoint(); } private boolean finishAll_ENCODING_PART() throws IOException{ int _position = position; while(position<limit){ char ch = input[position]; if((ENCODING_START(ch)) || (DIGIT(ch)) || (ch=='.' || ch=='_' || ch=='-')) ++position; else break; } int len = position-_position; if(len>0) buffer.append(input, _position, len); return position==limit && marker==EOC; } private boolean finishAll_DIGIT() throws IOException{ int _position = position; while(position<limit){ char ch = input[position]; if(DIGIT(ch)) ++position; else break; } int len = position-_position; if(len>0) buffer.append(input, _position, len); return position==limit && marker==EOC; } private boolean finishAll_NAME_PART() throws IOException{ int _position = position; while(position<limit){ char ch = input[position]; if(org.apache.xerces.util.XMLChar.isName(ch)) ++position; else break; } int len = position-_position; if(len>0 && buffer.isBuffering()) buffer.append(input, _position, len); return position==limit && marker==EOC; } private boolean finishAll_NCNAME_PART() throws IOException{ int _position = position; while(position<limit){ char ch = input[position]; if(org.apache.xerces.util.XMLChar.isNCName(ch)) ++position; else break; } int len = position-_position; if(len>0) buffer.append(input, _position, len); return position==limit && marker==EOC; } private boolean finishAll_HEX_DIGIT() throws IOException{ int _position = position; while(position<limit){ char ch = input[position]; if(HEX_DIGIT(ch)) ++position; else break; } int len = position-_position; if(len>0) buffer.append(input, _position, len); return position==limit && marker==EOC; } private int finishAll_ATTR_DQ_CONTENT() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if((ch!='<' && ch!='&' && ch!='"') && (org.apache.xerces.util.XMLChar.isValid(ch))){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && (ch!='<' && ch!='&' && ch!='"') && (org.apache.xerces.util.XMLChar.isValid(ch))) consume(ch); else return ch; } } private int finishAll_ATTR_Q_CONTENT() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if((ch!='<' && ch!='&' && ch!='\'') && (org.apache.xerces.util.XMLChar.isValid(ch))){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && (ch!='<' && ch!='&' && ch!='\'') && (org.apache.xerces.util.XMLChar.isValid(ch))) consume(ch); else return ch; } } private int finishAll_ENTITY_DQ_CONTENT() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if((ch!='%' && ch!='&' && ch!='"') && (org.apache.xerces.util.XMLChar.isValid(ch))){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && (ch!='%' && ch!='&' && ch!='"') && (org.apache.xerces.util.XMLChar.isValid(ch))) consume(ch); else return ch; } } private int finishAll_ENTITY_Q_CONTENT() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if((ch!='%' && ch!='&' && ch!='\'') && (org.apache.xerces.util.XMLChar.isValid(ch))){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && (ch!='%' && ch!='&' && ch!='\'') && (org.apache.xerces.util.XMLChar.isValid(ch))) consume(ch); else return ch; } } private int finishAll_ELEM_CONTENT_CHAR_NBRACE() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if((ch!='<' && ch!='&' && ch!=']') && (org.apache.xerces.util.XMLChar.isValid(ch))){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && (ch!='<' && ch!='&' && ch!=']') && (org.apache.xerces.util.XMLChar.isValid(ch))) consume(ch); else return ch; } } private int finishAll_CHAR() throws IOException{ int ch; while(true){ asciiLoop: while(true){ char chars[] = buffer.array(); int max = position + chars.length-buffer.count; if(limit<max) max = limit; while(position<max){ ch = input[position]; if(ch=='\r'){ line++; linePosition = ++position; chars[buffer.count++] = coalesceNewLines ? '\n' : '\r'; } else if(ch=='\n'){ linePosition = ++position; char lastChar = position==start+1 ? this.lastChar : input[position-2]; if(lastChar!='\r') line++; else if(coalesceNewLines) continue; chars[buffer.count++] = '\n'; } else if(org.apache.xerces.util.XMLChar.isValid(ch)){ chars[buffer.count++] = (char)ch; position++; }else if(ch>=MIN_HIGH_SURROGATE && ch<=MAX_HIGH_SURROGATE) break asciiLoop; else{ increment = 1; return ch; } } if(position==limit) return marker; buffer.expandCapacity(1); } ch = codePoint(); if(ch>=0 && org.apache.xerces.util.XMLChar.isValid(ch)) consume(ch); else return ch; } } @Override protected final boolean callRule(int rule, int state) throws Exception{ if(SHOW_STATS) callRuleCount++; if(rule<0){ if(rule==RULE_DYNAMIC_STRING_MATCH) return matchString(state, dynamicStringToBeMatched); else return matchString(rule, state, STRING_IDS[-rule]); } switch(rule){ case 0: return eq(state); case 1: return yes_no(state); case 2: return sd_decl(state); case 3: return enc_name(state); case 4: return enc_decl(state); case 5: return version_num(state); case 6: return version_info(state); case 7: return comment(state); case 8: return cdata_end(state); case 9: return cdata(state); case 10: return name(state); case 11: return pi(state); case 12: return ncname(state); case 13: return qname(state); case 14: return reference(state); case 15: return attr(state); case 16: return value(state); case 17: return elem_attrs(state); case 18: return xdecl(state); case 19: return misc(state); case 20: return sytem_literal(state); case 21: return pubid_literal(state); case 22: return system_id(state); case 23: return public_id(state); case 24: return notation_decl(state); case 25: return external_id(state); case 26: return pe_reference(state); case 27: return ndata_decl(state); case 28: return pe_def(state); case 29: return entity_value(state); case 30: return entity_decl(state); case 31: return entity_def(state); case 32: return tokenized_type(state); case 33: return nmtoken(state); case 34: return enumeration(state); case 35: return mixed(state); case 36: return notation_type(state); case 37: return enumerated_type(state); case 38: return att_type(state); case 39: return default_decl(state); case 40: return att_def(state); case 41: return att_list_decl(state); case 42: return children(state); case 43: return name_cardinality(state); case 44: return decl_sep(state); case 45: return markup_decl(state); case 46: return element_decl(state); case 47: return int_subset(state); case 48: return doctype_decl(state); case 49: return document(state); case 50: return elem(state); case 51: return elem_content(state); case 52: return text_decl(state); case 53: return ignore_sect(state); case 54: return ext_subset_decl(state); case 55: return conditional_sect(state); case 56: return include_sect(state); case 57: return external_entity_value(state); case 58: return int_value(state); default: throw new Error("impossible rule: "+stack[free-2]); } } @Override public void onSuccessful() throws Exception{ handler.onSuccessful(); } @Override public Exception fatalError(String message){ return handler.fatalError(message); } protected final jlibs.xml.sax.async.AsyncXMLReader handler; public XMLScanner(jlibs.xml.sax.async.AsyncXMLReader handler, int startingRule){ super(4, startingRule); this.handler = handler; } }