0001: //### This file created by BYACC 1.8(/Java extension 1.1)
0002: //### Java capabilities added 7 Jan 97, Bob Jamison
0003: //### Updated : 27 Nov 97 -- Bob Jamison, Joe Nieten
0004: //### 01 Jan 98 -- Bob Jamison -- fixed generic semantic constructor
0005: //### 01 Jun 99 -- Bob Jamison -- added Runnable support
0006: //### 06 Aug 00 -- Bob Jamison -- made state variables class-global
0007: //### 03 Jan 01 -- Bob Jamison -- improved flags, tracing
0008: //### 16 May 01 -- Bob Jamison -- added custom stack sizing
0009: //### 04 Mar 02 -- Yuval Oren -- improved java performance, added options
0010: //### Please send bug reports to rjamison@lincom-asg.com
0011: //### static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
0012:
0013: //#line 2 "Piccolo.y"
0014: package com.bluecast.xml;
0015:
0016: import org.xml.sax.*;
0017: import org.xml.sax.helpers.*;
0018: import org.xml.sax.ext.*;
0019: import java.io.*;
0020: import java.net.MalformedURLException;
0021: import com.bluecast.util.*;
0022: import com.bluecast.io.*;
0023: import java.util.*;
0024:
0025: /*
0026: * $Id: Piccolo.y,v 1.10 2004/07/11 09:37:37 yuvalo Exp $
0027: *
0028: * 2003-06-10 - MODIFIED to provide access to <?xml?> definition
0029: * and startLocator
0030: *
0031: * (C) Copyright 2002-2004 by Yuval Oren. All rights reserved.
0032: *
0033: * Licensed under the Apache License, Version 2.0 (the "License");
0034: * you may not use this file except in compliance with the License.
0035: * You may obtain a copy of the License at
0036: *
0037: * http://www.apache.org/licenses/LICENSE-2.0
0038: *
0039: * Unless required by applicable law or agreed to in writing, software
0040: * distributed under the License is distributed on an "AS IS" BASIS,
0041: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0042: * See the License for the specific language governing permissions and
0043: * limitations under the License.
0044: */
0045:
0046: /**
0047: * Piccolo is a small, high-performance SAX1 and SAX2 XML parser.
0048: * As per the SAX2 specification, namespace handling is on by
0049: * default. You can improve performance by turning it off.
0050: *
0051: * Note that if used in SAX1 mode, namespace handling is
0052: * automatically turned off.
0053: */
0054: //#line 57 "Piccolo.java"
0055:
0056: public class Piccolo implements org.xml.sax.Parser,
0057: org.xml.sax.Locator, org.xml.sax.XMLReader {
0058:
0059: boolean yydebug; //do I want debug output?
0060: int yynerrs; //number of errors so far
0061: int yyerrflag; //was there an error?
0062: int yychar; //the current working character
0063:
0064: //########## MESSAGES ##########
0065: //###############################################################
0066: // method: debug
0067: //###############################################################
0068: void debug(String msg) {
0069: if (yydebug)
0070: System.out.println(msg);
0071: }
0072:
0073: //########## STATE STACK ##########
0074: final static int YYSTACKSIZE = 500; //maximum stack size
0075: int statestk[] = new int[YYSTACKSIZE]; //state stack
0076: int stateptr;
0077: int stateptrmax; //highest index of stackptr
0078: int statemax; //state when highest index reached
0079: //###############################################################
0080: // methods: state stack push,pop,drop,peek
0081: //###############################################################
0082:
0083: final void state_push(int state) {
0084: try {
0085: stateptr++;
0086: statestk[stateptr] = state;
0087: } catch (ArrayIndexOutOfBoundsException e) {
0088: int oldsize = statestk.length;
0089: int newsize = oldsize * 2;
0090: int[] newstack = new int[newsize];
0091: System.arraycopy(statestk, 0, newstack, 0, oldsize);
0092: statestk = newstack;
0093: statestk[stateptr] = state;
0094: }
0095: }
0096:
0097: final int state_pop() {
0098: return statestk[stateptr--];
0099: }
0100:
0101: final void state_drop(int cnt) {
0102: stateptr -= cnt;
0103: }
0104:
0105: final int state_peek(int relative) {
0106: return statestk[stateptr - relative];
0107: }
0108:
0109: //###############################################################
0110: // method: init_stacks : allocate and prepare stacks
0111: //###############################################################
0112: final boolean init_stacks() {
0113: stateptr = -1;
0114: val_init();
0115: return true;
0116: }
0117:
0118: //###############################################################
0119: // method: dump_stacks : show n levels of the stacks
0120: //###############################################################
0121: void dump_stacks(int count) {
0122: int i;
0123: System.out.println("=index==state====value= s:" + stateptr
0124: + " v:" + valptr);
0125: for (i = 0; i < count; i++)
0126: System.out.println(" " + i + " " + statestk[i]
0127: + " " + valstk[i]);
0128: System.out.println("======================");
0129: }
0130:
0131: //########## SEMANTIC VALUES ##########
0132: //## **user defined:String
0133: String yytext;//user variable to return contextual strings
0134: String yyval; //used to return semantic vals from action routines
0135: String yylval;//the 'lval' (result) I got from yylex()
0136: String valstk[] = new String[YYSTACKSIZE];
0137: int valptr;
0138:
0139: //###############################################################
0140: // methods: value stack push,pop,drop,peek.
0141: //###############################################################
0142: final void val_init() {
0143: yyval = new String();
0144: yylval = new String();
0145: valptr = -1;
0146: }
0147:
0148: final void val_push(String val) {
0149: try {
0150: valptr++;
0151: valstk[valptr] = val;
0152: } catch (ArrayIndexOutOfBoundsException e) {
0153: int oldsize = valstk.length;
0154: int newsize = oldsize * 2;
0155: String[] newstack = new String[newsize];
0156: System.arraycopy(valstk, 0, newstack, 0, oldsize);
0157: valstk = newstack;
0158: valstk[valptr] = val;
0159: }
0160: }
0161:
0162: final String val_pop() {
0163: return valstk[valptr--];
0164: }
0165:
0166: final void val_drop(int cnt) {
0167: valptr -= cnt;
0168: }
0169:
0170: final String val_peek(int relative) {
0171: return valstk[valptr - relative];
0172: }
0173:
0174: //#### end semantic value section ####
0175: public final static short CDATA = 257;
0176: public final static short TAG_END = 258;
0177: public final static short PI = 259;
0178: public final static short NAME = 260;
0179: public final static short STRING = 261;
0180: public final static short EQ = 262;
0181: public final static short OPEN_TAG = 263;
0182: public final static short CLOSE_TAG = 264;
0183: public final static short EMPTY_TAG = 265;
0184: public final static short WHITESPACE = 266;
0185: public final static short DTD_START = 267;
0186: public final static short DTD_START_SKIPEXTERNAL = 268;
0187: public final static short SYSTEM = 269;
0188: public final static short PUBLIC = 270;
0189: public final static short REQUIRED = 271;
0190: public final static short IMPLIED = 272;
0191: public final static short FIXED = 273;
0192: public final static short LPAREN = 274;
0193: public final static short RPAREN = 275;
0194: public final static short LBRACKET = 276;
0195: public final static short PIPE = 277;
0196: public final static short ENTITY_DECL_START = 278;
0197: public final static short ATTLIST_START = 279;
0198: public final static short NOTATION_START = 280;
0199: public final static short RBRACKET_END = 281;
0200: public final static short DOUBLE_RBRACKET_END = 282;
0201: public final static short PERCENT = 283;
0202: public final static short ENUMERATION = 284;
0203: public final static short NOTATION = 285;
0204: public final static short ID = 286;
0205: public final static short IDREF = 287;
0206: public final static short IDREFS = 288;
0207: public final static short ENTITY = 289;
0208: public final static short ENTITIES = 290;
0209: public final static short NMTOKEN = 291;
0210: public final static short NMTOKENS = 292;
0211: public final static short ENTITY_REF = 293;
0212: public final static short ENTITY_END = 294;
0213: public final static short INTERNAL_ENTITY_REF = 295;
0214: public final static short EXTERNAL_ENTITY_REF = 296;
0215: public final static short SKIPPED_ENTITY_REF = 297;
0216: public final static short PREFIXED_NAME = 298;
0217: public final static short UNPREFIXED_NAME = 299;
0218: public final static short NDATA = 300;
0219: public final static short COMMENT = 301;
0220: public final static short CONDITIONAL_START = 302;
0221: public final static short IGNORED_CONDITIONAL_START = 303;
0222: public final static short INCLUDE = 304;
0223: public final static short IGNORE = 305;
0224: public final static short MODIFIER = 306;
0225: public final static short PCDATA = 307;
0226: public final static short ELEMENT_DECL_START = 308;
0227: public final static short EMPTY = 309;
0228: public final static short ANY = 310;
0229: public final static short STAR = 311;
0230: public final static short COMMA = 312;
0231: public final static short QUESTION = 313;
0232: public final static short PLUS = 314;
0233: public final static short XML_DOC_DECL = 315;
0234: public final static short XML_TEXT_DECL = 316;
0235: public final static short XML_DOC_OR_TEXT_DECL = 317;
0236: public final static short YYERRCODE = 256;
0237: final static short yylhs[] = { -1, 0, 0, 1, 1, 1, 5, 5, 3, 3, 3, 4,
0238: 4, 7, 7, 7, 8, 8, 9, 9, 2, 2, 2, 2, 2, 2, 12, 12, 14, 14,
0239: 10, 10, 10, 13, 13, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
0240: 15, 15, 20, 20, 21, 21, 22, 22, 16, 16, 16, 16, 16, 16, 18,
0241: 18, 17, 23, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26,
0242: 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 19, 28, 28, 28, 28,
0243: 29, 29, 29, 29, 30, 30, 30, 34, 34, 36, 36, 35, 35, 35, 35,
0244: 31, 31, 33, 33, 32, 32, 32, 32, 6, 6, 6, 6, 6, 6, 6, 6, 6,
0245: 6, };
0246: final static short yylen[] = { 2, 4, 3, 1, 1, 0, 1, 1, 1, 3, 2, 2,
0247: 0, 1, 1, 1, 1, 2, 0, 1, 4, 3, 4, 3, 6, 2, 2, 4, 7, 9, 3, 3,
0248: 5, 3, 5, 0, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 3, 2, 3, 2, 0,
0249: 4, 7, 7, 11, 8, 8, 11, 7, 9, 4, 3, 0, 3, 5, 5, 5, 5, 7, 7,
0250: 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 5, 7, 1, 5, 7, 1, 1, 1, 1, 6,
0251: 5, 10, 2, 2, 2, 2, 5, 5, 1, 4, 3, 3, 3, 2, 4, 2, 4, 2, 1,
0252: 1, 1, 0, 0, 4, 4, 5, 4, 2, 2, 2, 2, 2, };
0253: final static short yydefred[] = { 0, 3, 4, 0, 0, 14, 113, 8, 13, 0,
0254: 0, 15, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 2, 0, 25, 10, 0,
0255: 6, 7, 35, 0, 26, 35, 122, 119, 113, 9, 118, 121, 113, 0,
0256: 120, 16, 30, 0, 0, 31, 0, 1, 11, 0, 0, 0, 21, 35, 0, 0, 0,
0257: 40, 36, 37, 38, 39, 41, 63, 0, 23, 0, 0, 0, 113, 0, 17, 0,
0258: 0, 20, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 35, 51, 0, 0,
0259: 22, 27, 117, 114, 0, 115, 0, 0, 0, 0, 32, 0, 0, 0, 0, 62,
0260: 0, 0, 0, 0, 16, 48, 50, 0, 0, 0, 0, 0, 116, 0, 0, 33, 0,
0261: 24, 0, 0, 0, 47, 49, 45, 46, 51, 0, 0, 0, 64, 61, 28, 0, 0,
0262: 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 87, 0, 88, 89, 0, 0, 0, 0,
0263: 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 93, 96, 0, 0, 0, 0,
0264: 0, 0, 0, 0, 0, 0, 0, 0, 110, 109, 111, 94, 95, 73, 0, 0,
0265: 74, 75, 76, 77, 78, 79, 80, 0, 0, 29, 53, 0, 54, 0, 0, 0,
0266: 0, 59, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 85, 0, 0, 0, 0,
0267: 0, 56, 57, 0, 0, 0, 101, 0, 102, 103, 105, 0, 0, 107, 83,
0268: 0, 0, 71, 65, 67, 0, 72, 66, 68, 0, 0, 0, 60, 0, 0, 0, 0,
0269: 100, 0, 0, 0, 0, 0, 0, 90, 0, 98, 0, 0, 81, 0, 0, 69, 70,
0270: 55, 58, 0, 0, 0, 0, 0, 84, 82, 0, 92, };
0271: final static short yydgoto[] = { 3, 4, 12, 26, 23, 30, 18, 59, 104,
0272: 46, 15, 27, 16, 79, 17, 60, 61, 62, 63, 64, 89, 90, 117,
0273: 65, 92, 138, 202, 244, 154, 173, 174, 181, 190, 182, 183,
0274: 184, 185, };
0275: final static short yysindex[] = { -120, 0, 0, 0, 181, 0, 0, 0, 0,
0276: -213, -166, 0, -250, -248, 181, 0, -10, -206, -119, -239,
0277: -188, -248, -250, 0, -248, 0, 0, -41, 0, 0, 0, -16, 0, 0,
0278: 0, 0, 0, 0, 0, 0, 0, -10, 0, 0, 0, 165, -237, 0, 225, 0, 0,
0279: -194, -194, -194, 0, 0, -10, -223, -194, 0, 0, 0, 0, 0, 0,
0280: 0, -7, 0, 18, 102, 117, 0, 127, 0, -194, -194, 0, -194,
0281: -194, -137, -146, -88, -54, 77, 0, 77, -194, -194, -209, 0,
0282: 0, -24, -194, 0, 0, 0, 0, 142, 0, -108, -76, -53, -15, 0,
0283: -135, -117, -194, -79, 0, -194, 77, -66, -59, 0, 0, 0, 43,
0284: -139, -194, -147, -32, 0, -194, -194, 0, -194, 0, 204, 227,
0285: 232, 0, 0, 0, 0, 0, -264, -194, -194, 0, 0, 0, 15, 76,
0286: -194, -194, 210, -194, -194, -194, -133, -103, -86, 0, 0,
0287: -194, 0, 0, 106, 106, 198, 198, -194, 0, 16, -235, 35,
0288: -194, -194, -192, 97, 92, 0, -103, 0, 0, 106, 106, 106,
0289: -55, -55, 55, 106, 106, -194, -194, -194, 113, 0, 0, 0, 0,
0290: 0, 0, -194, -194, 0, 0, 0, 0, 0, 0, 0, -194, -194, 0, 0,
0291: -194, 0, 123, 130, -194, -194, 0, -194, -55, 106, 106, 0,
0292: -194, -194, -194, 49, -251, 116, 0, 135, -39, 44, 143, 67,
0293: 0, 0, 68, 76, 144, 0, -28, 0, 0, 0, -194, -55, 0, 0, -194,
0294: -194, 0, 0, 0, -194, 0, 0, 0, -194, -194, -194, 0, 89,
0295: -194, -55, -194, 0, 112, 135, 103, 109, 148, 152, 0, 135,
0296: 0, -194, 65, 0, -194, -194, 0, 0, 0, 0, -194, 168, 169,
0297: 119, 150, 0, 0, 131, 0, };
0298: final static short yyrindex[] = { 191, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0299: 0, 0, 0, 452, 0, 0, 52, 0, 0, 202, 0, 452, 0, 0, 452, 0, 0,
0300: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167, 0, 0, 0,
0301: 208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -80, 0, 0, 0, 0, 0, 0,
0302: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, 0,
0303: 0, -50, 0, -12, 193, 193, 0, 0, 0, 0, 202, 0, 0, 0, 0, 0,
0304: 0, 0, 0, 0, 0, 0, -153, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0,
0305: 0, 0, 208, 0, 0, -178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0306: 0, 0, 0, 0, 0, 0, 0, 0, 202, 202, 0, 0, 0, 202, 0, 31, 160,
0307: 0, 0, 202, 0, 0, -25, -25, 0, 0, -178, 0, 0, 208, 0, 202,
0308: 202, 0, 0, 0, 0, 0, 0, 0, -13, 17, -263, 170, 0, 0, -263,
0309: -263, 200, -186, 200, 0, 0, 0, 0, 0, 0, 0, 218, 0, 0, 0, 0,
0310: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, -164, 0,
0311: -258, -200, 0, 164, -164, -164, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0312: 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, -124, 0, 0, 0, 164, 218, 0,
0313: 0, 0, 0, 0, 0, 0, 0, 202, 202, 0, 42, 218, 0, -252, 0, 0,
0314: 0, 0, 0, 0, 0, 0, 0, 0, 176, 0, 0, 218, 164, 0, 0, 0, 0,
0315: 164, 0, 0, 0, 0, 0, 0, 0, 0, };
0316: final static short yygindex[] = { 0, 0, 467, 300, 328, 27, 125,
0317: 244, -19, -51, 0, 46, 0, 28, 0, 0, 0, 0, 0, 0, 411, 412,
0318: 369, 0, 0, 0, 344, 66, 0, 370, 371, -130, -152, -128, 248,
0319: -174, 267, };
0320: final static int YYTABLESIZE = 508;
0321: final static short yytable[] = { 45, 48, 150, 112, 217, 157, 191,
0322: 158, 106, 5, 151, 5, 112, 6, 112, 7, 8, 106, 8, 106, 175,
0323: 76, 176, 99, 191, 213, 240, 43, 105, 219, 220, 73, 80, 81,
0324: 82, 111, 112, 44, 88, 91, 217, 120, 175, 43, 176, 152, 153,
0325: 19, 215, 112, 216, 11, 32, 11, 106, 99, 100, 113, 101, 102,
0326: 18, 241, 31, 219, 220, 206, 108, 260, 71, 88, 33, 140, 43,
0327: 119, 73, 108, 66, 108, 43, 68, 18, 86, 87, 84, 215, 271,
0328: 216, 127, 47, 99, 129, 18, 163, 165, 20, 86, 87, 170, 18,
0329: 135, 180, 83, 85, 186, 141, 19, 142, 19, 210, 145, 204, 18,
0330: 108, 18, 106, 208, 209, 159, 160, 73, 73, 19, 19, 19, 19,
0331: 164, 18, 168, 169, 43, 110, 73, 221, 222, 223, 116, 18,
0332: 107, 34, 103, 35, 126, 225, 133, 36, 37, 38, 39, 18, 171,
0333: 18, 136, 137, 122, 19, 144, 146, 148, 73, 19, 234, 69, 235,
0334: 172, 134, 70, 72, 236, 237, 238, 134, 151, 108, 167, 177,
0335: 226, 40, 41, 73, 35, 178, 128, 42, 227, 228, 123, 35, 229,
0336: 179, 259, 73, 232, 233, 262, 263, 1, 97, 2, 35, 35, 35, 35,
0337: 35, 266, 267, 177, 109, 269, 124, 272, 130, 214, 73, 73,
0338: 35, 35, 35, 131, 5, 179, 281, 35, 35, 282, 283, 8, 139, 73,
0339: 35, 284, 264, 42, 42, 112, 265, 245, 118, 51, 52, 53, 54,
0340: 112, 73, 5, 42, 106, 125, 257, 14, 258, 8, 73, 5, 106, 55,
0341: 56, 22, 24, 14, 8, 11, 57, 51, 52, 53, 24, 22, 58, 24, 43,
0342: 43, 51, 52, 53, 205, 108, 161, 5, 67, 55, 56, 73, 43, 108,
0343: 8, 11, 57, 93, 55, 56, 44, 44, 58, 207, 11, 57, 51, 52, 53,
0344: 94, 91, 58, 5, 44, 13, 246, 28, 29, 91, 8, 73, 35, 21, 55,
0345: 56, 247, 248, 249, 35, 11, 57, 51, 52, 53, 239, 132, 58,
0346: 254, 255, 275, 35, 35, 35, 73, 73, 280, 5, 162, 55, 56, 17,
0347: 17, 73, 8, 11, 57, 35, 35, 35, 49, 212, 58, 50, 35, 35, 51,
0348: 52, 53, 211, 34, 35, 35, 218, 73, 276, 36, 95, 38, 39, 73,
0349: 277, 224, 55, 56, 34, 73, 35, 241, 11, 57, 36, 230, 38, 39,
0350: 34, 58, 35, 273, 231, 274, 36, 242, 38, 39, 286, 243, 274,
0351: 40, 41, 34, 268, 35, 256, 42, 250, 36, 278, 38, 39, 73,
0352: 279, 96, 40, 41, 251, 252, 253, 187, 42, 188, 189, 98, 40,
0353: 41, 113, 287, 113, 274, 42, 285, 113, 73, 113, 113, 74, 75,
0354: 121, 40, 41, 18, 5, 18, 288, 42, 6, 240, 7, 8, 9, 10, 5,
0355: 97, 12, 18, 5, 192, 5, 5, 5, 5, 18, 113, 113, 113, 73, 143,
0356: 19, 18, 113, 18, 73, 166, 193, 77, 78, 18, 73, 16, 18, 77,
0357: 78, 25, 11, 194, 195, 196, 197, 198, 199, 200, 201, 73, 5,
0358: 43, 77, 78, 77, 78, 73, 114, 115, 77, 147, 149, 203, 155,
0359: 156, 270, 261, };
0360: final static short yycheck[] = { 19, 20, 266, 266, 178, 135, 158,
0361: 135, 266, 259, 274, 259, 275, 263, 277, 265, 266, 275, 266,
0362: 277, 150, 258, 150, 275, 176, 177, 277, 266, 79, 181, 182,
0363: 266, 51, 52, 53, 86, 87, 276, 57, 58, 214, 92, 172, 266,
0364: 172, 309, 310, 260, 178, 312, 178, 301, 258, 301, 312, 74,
0365: 75, 266, 77, 78, 312, 312, 16, 215, 216, 300, 266, 241, 41,
0366: 88, 276, 122, 266, 92, 266, 275, 30, 277, 266, 33, 258,
0367: 304, 305, 56, 214, 259, 214, 106, 276, 275, 109, 277, 143,
0368: 144, 260, 304, 305, 148, 276, 118, 151, 55, 56, 154, 123,
0369: 258, 125, 260, 300, 128, 161, 275, 312, 277, 260, 166, 167,
0370: 136, 137, 266, 266, 274, 275, 276, 277, 144, 312, 146, 147,
0371: 266, 84, 266, 183, 184, 185, 89, 260, 283, 257, 276, 259,
0372: 258, 193, 282, 263, 264, 265, 266, 312, 282, 274, 298, 299,
0373: 261, 307, 127, 128, 129, 266, 312, 211, 36, 213, 266, 303,
0374: 40, 41, 218, 219, 220, 303, 274, 260, 145, 260, 194, 295,
0375: 296, 266, 259, 266, 260, 301, 202, 203, 261, 266, 206, 274,
0376: 240, 266, 210, 211, 244, 245, 315, 71, 317, 278, 279, 280,
0377: 281, 282, 254, 255, 260, 260, 258, 261, 260, 276, 266, 266,
0378: 266, 294, 295, 296, 276, 259, 274, 271, 301, 302, 274, 275,
0379: 266, 258, 266, 308, 280, 249, 281, 282, 258, 253, 274, 260,
0380: 278, 279, 280, 281, 266, 266, 259, 294, 258, 261, 275, 4,
0381: 277, 266, 266, 259, 266, 295, 296, 12, 13, 14, 266, 301,
0382: 302, 278, 279, 280, 21, 22, 308, 24, 281, 282, 278, 279,
0383: 280, 258, 258, 261, 259, 294, 295, 296, 266, 294, 266, 266,
0384: 301, 302, 294, 295, 296, 281, 282, 308, 258, 301, 302, 278,
0385: 279, 280, 281, 258, 308, 259, 294, 4, 261, 316, 317, 266,
0386: 266, 266, 259, 12, 295, 296, 271, 272, 273, 266, 301, 302,
0387: 278, 279, 280, 275, 282, 308, 260, 260, 263, 278, 279, 280,
0388: 266, 266, 269, 259, 261, 295, 296, 309, 310, 266, 266, 301,
0389: 302, 294, 295, 296, 21, 258, 308, 24, 301, 302, 278, 279,
0390: 280, 261, 257, 308, 259, 307, 266, 261, 263, 264, 265, 266,
0391: 266, 261, 258, 295, 296, 257, 266, 259, 312, 301, 302, 263,
0392: 258, 265, 266, 257, 308, 259, 275, 258, 277, 263, 275, 265,
0393: 266, 275, 260, 277, 295, 296, 257, 311, 259, 258, 301, 261,
0394: 263, 258, 265, 266, 266, 258, 294, 295, 296, 271, 272, 273,
0395: 311, 301, 313, 314, 294, 295, 296, 257, 275, 259, 277, 301,
0396: 260, 263, 266, 265, 266, 269, 270, 294, 295, 296, 275, 259,
0397: 277, 311, 301, 263, 277, 265, 266, 267, 268, 259, 275, 0,
0398: 277, 263, 257, 265, 266, 267, 268, 258, 294, 295, 296, 266,
0399: 261, 258, 307, 301, 276, 266, 261, 274, 269, 270, 275, 266,
0400: 307, 260, 269, 270, 14, 301, 285, 286, 287, 288, 289, 290,
0401: 291, 292, 266, 301, 266, 269, 270, 269, 270, 266, 88, 88,
0402: 269, 270, 134, 160, 135, 135, 259, 241, };
0403: final static short YYFINAL = 3;
0404: final static short YYMAXTOKEN = 317;
0405: final static String yyname[] = { "end-of-file", null, null, null,
0406: null, null, null, null, null, null, null, null, null, null,
0407: null, null, null, null, null, null, null, null, null, null,
0408: null, null, null, null, null, null, null, null, null, null,
0409: null, null, null, null, null, null, null, null, null, null,
0410: null, null, null, null, null, null, null, null, null, null,
0411: null, null, null, null, null, null, null, null, null, null,
0412: null, null, null, null, null, null, null, null, null, null,
0413: null, null, null, null, null, null, null, null, null, null,
0414: null, null, null, null, null, null, null, null, null, null,
0415: null, null, null, null, null, null, null, null, null, null,
0416: null, null, null, null, null, null, null, null, null, null,
0417: null, null, null, null, null, null, null, null, null, null,
0418: null, null, null, null, null, null, null, null, null, null,
0419: null, null, null, null, null, null, null, null, null, null,
0420: null, null, null, null, null, null, null, null, null, null,
0421: null, null, null, null, null, null, null, null, null, null,
0422: null, null, null, null, null, null, null, null, null, null,
0423: null, null, null, null, null, null, null, null, null, null,
0424: null, null, null, null, null, null, null, null, null, null,
0425: null, null, null, null, null, null, null, null, null, null,
0426: null, null, null, null, null, null, null, null, null, null,
0427: null, null, null, null, null, null, null, null, null, null,
0428: null, null, null, null, null, null, null, null, null, null,
0429: null, null, null, null, null, null, null, null, null, null,
0430: null, null, null, null, null, null, null, null, null, null,
0431: null, null, null, "CDATA", "TAG_END", "PI", "NAME",
0432: "STRING", "EQ", "OPEN_TAG", "CLOSE_TAG", "EMPTY_TAG",
0433: "WHITESPACE", "DTD_START", "DTD_START_SKIPEXTERNAL",
0434: "SYSTEM", "PUBLIC", "REQUIRED", "IMPLIED", "FIXED",
0435: "LPAREN", "RPAREN", "LBRACKET", "PIPE",
0436: "ENTITY_DECL_START", "ATTLIST_START", "NOTATION_START",
0437: "RBRACKET_END", "DOUBLE_RBRACKET_END", "PERCENT",
0438: "ENUMERATION", "NOTATION", "ID", "IDREF", "IDREFS",
0439: "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS", "ENTITY_REF",
0440: "ENTITY_END", "INTERNAL_ENTITY_REF", "EXTERNAL_ENTITY_REF",
0441: "SKIPPED_ENTITY_REF", "PREFIXED_NAME", "UNPREFIXED_NAME",
0442: "NDATA", "COMMENT", "CONDITIONAL_START",
0443: "IGNORED_CONDITIONAL_START", "INCLUDE", "IGNORE",
0444: "MODIFIER", "PCDATA", "ELEMENT_DECL_START", "EMPTY", "ANY",
0445: "STAR", "COMMA", "QUESTION", "PLUS", "XML_DOC_DECL",
0446: "XML_TEXT_DECL", "XML_DOC_OR_TEXT_DECL", };
0447: final static String yyrule[] = {
0448: "$accept : document",
0449: "document : xml_decl dtd body epilog",
0450: "document : xml_decl body epilog",
0451: "xml_decl : XML_DOC_DECL",
0452: "xml_decl : XML_DOC_OR_TEXT_DECL",
0453: "xml_decl :",
0454: "xml_text_decl : XML_TEXT_DECL",
0455: "xml_text_decl : XML_DOC_OR_TEXT_DECL",
0456: "body : EMPTY_TAG",
0457: "body : OPEN_TAG content CLOSE_TAG",
0458: "body : misc body",
0459: "epilog : misc epilog",
0460: "epilog :",
0461: "misc : WHITESPACE",
0462: "misc : PI",
0463: "misc : COMMENT",
0464: "ws : WHITESPACE",
0465: "ws : ws WHITESPACE",
0466: "opt_ws :",
0467: "opt_ws : ws",
0468: "dtd : DTD_START NAME opt_ws TAG_END",
0469: "dtd : dtd_only_internal_start dtd_content RBRACKET_END",
0470: "dtd : dtd_with_external xml_text_decl dtd_content ENTITY_END",
0471: "dtd : dtd_with_external dtd_content ENTITY_END",
0472: "dtd : DTD_START_SKIPEXTERNAL NAME ws external_id opt_ws TAG_END",
0473: "dtd : misc dtd",
0474: "dtd_with_external : dtd_with_external_start TAG_END",
0475: "dtd_with_external : dtd_with_external_start LBRACKET dtd_content RBRACKET_END",
0476: "dtd_with_external_start : DTD_START NAME ws SYSTEM ws STRING opt_ws",
0477: "dtd_with_external_start : DTD_START NAME ws PUBLIC ws STRING ws STRING opt_ws",
0478: "dtd_only_internal_start : DTD_START NAME LBRACKET",
0479: "dtd_only_internal_start : DTD_START_SKIPEXTERNAL NAME LBRACKET",
0480: "dtd_only_internal_start : DTD_START_SKIPEXTERNAL NAME ws external_id LBRACKET",
0481: "external_id : SYSTEM ws STRING",
0482: "external_id : PUBLIC ws STRING ws STRING",
0483: "dtd_content :",
0484: "dtd_content : dtd_content dtd_conditional",
0485: "dtd_content : dtd_content dtd_entity",
0486: "dtd_content : dtd_content dtd_attlist",
0487: "dtd_content : dtd_content dtd_notation",
0488: "dtd_content : dtd_content misc",
0489: "dtd_content : dtd_content dtd_element",
0490: "dtd_content : dtd_content INTERNAL_ENTITY_REF dtd_content",
0491: "dtd_content : dtd_content EXTERNAL_ENTITY_REF dtd_content",
0492: "dtd_content : dtd_content EXTERNAL_ENTITY_REF xml_text_decl dtd_content",
0493: "dtd_conditional : CONDITIONAL_START dtd_include dtd_content DOUBLE_RBRACKET_END",
0494: "dtd_conditional : CONDITIONAL_START dtd_ignore ignored_dtd_content DOUBLE_RBRACKET_END",
0495: "dtd_include : INCLUDE opt_ws LBRACKET",
0496: "dtd_include : ws dtd_include",
0497: "dtd_ignore : IGNORE opt_ws LBRACKET",
0498: "dtd_ignore : ws dtd_ignore",
0499: "ignored_dtd_content :",
0500: "ignored_dtd_content : ignored_dtd_content IGNORED_CONDITIONAL_START ignored_dtd_content DOUBLE_RBRACKET_END",
0501: "dtd_entity : ENTITY_DECL_START ws NAME ws STRING opt_ws TAG_END",
0502: "dtd_entity : ENTITY_DECL_START ws NAME ws external_id opt_ws TAG_END",
0503: "dtd_entity : ENTITY_DECL_START ws NAME ws external_id ws NDATA ws NAME opt_ws TAG_END",
0504: "dtd_entity : ENTITY_DECL_START ws PERCENT NAME ws STRING opt_ws TAG_END",
0505: "dtd_entity : ENTITY_DECL_START ws PERCENT NAME ws external_id opt_ws TAG_END",
0506: "dtd_entity : ENTITY_DECL_START ws PERCENT NAME external_id ws NDATA ws NAME opt_ws TAG_END",
0507: "dtd_notation : NOTATION_START ws NAME ws external_id opt_ws TAG_END",
0508: "dtd_notation : NOTATION_START ws NAME ws PUBLIC ws STRING opt_ws TAG_END",
0509: "dtd_attlist : attlist_start att_def_list opt_ws TAG_END",
0510: "attlist_start : ATTLIST_START ws NAME",
0511: "att_def_list :",
0512: "att_def_list : att_def_list ws att_def",
0513: "att_def : PREFIXED_NAME ws att_type ws REQUIRED",
0514: "att_def : UNPREFIXED_NAME ws att_type ws REQUIRED",
0515: "att_def : PREFIXED_NAME ws att_type ws IMPLIED",
0516: "att_def : UNPREFIXED_NAME ws att_type ws IMPLIED",
0517: "att_def : PREFIXED_NAME ws att_type ws FIXED ws STRING",
0518: "att_def : UNPREFIXED_NAME ws att_type ws FIXED ws STRING",
0519: "att_def : PREFIXED_NAME ws att_type ws STRING",
0520: "att_def : UNPREFIXED_NAME ws att_type ws STRING",
0521: "att_type : CDATA",
0522: "att_type : ID",
0523: "att_type : IDREF",
0524: "att_type : IDREFS",
0525: "att_type : ENTITY",
0526: "att_type : ENTITIES",
0527: "att_type : NMTOKEN",
0528: "att_type : NMTOKENS",
0529: "att_type : LPAREN opt_ws word_list opt_ws RPAREN",
0530: "att_type : NOTATION ws LPAREN opt_ws word_list opt_ws RPAREN",
0531: "word_list : NAME",
0532: "word_list : word_list opt_ws PIPE opt_ws NAME",
0533: "dtd_element : ELEMENT_DECL_START ws NAME ws element_spec opt_ws TAG_END",
0534: "element_spec : EMPTY",
0535: "element_spec : ANY",
0536: "element_spec : element_spec_mixed",
0537: "element_spec : element_spec_children",
0538: "element_spec_mixed : LPAREN opt_ws PCDATA opt_ws RPAREN STAR",
0539: "element_spec_mixed : LPAREN opt_ws PCDATA opt_ws RPAREN",
0540: "element_spec_mixed : LPAREN opt_ws PCDATA opt_ws PIPE opt_ws word_list opt_ws RPAREN STAR",
0541: "element_spec_mixed : WHITESPACE element_spec_mixed",
0542: "element_spec_children : element_choice element_modifier",
0543: "element_spec_children : element_seq element_modifier",
0544: "element_spec_children : WHITESPACE element_spec_children",
0545: "element_cp_pipe_list : element_cp opt_ws PIPE opt_ws element_cp",
0546: "element_cp_pipe_list : element_cp opt_ws PIPE opt_ws element_cp_pipe_list",
0547: "element_cp_comma_list : element_cp",
0548: "element_cp_comma_list : element_cp opt_ws COMMA element_cp_comma_list",
0549: "element_cp : NAME element_modifier opt_ws",
0550: "element_cp : element_choice element_modifier opt_ws",
0551: "element_cp : element_seq element_modifier opt_ws",
0552: "element_cp : WHITESPACE element_cp",
0553: "element_choice : LPAREN element_cp_pipe_list opt_ws RPAREN",
0554: "element_choice : WHITESPACE element_choice",
0555: "element_seq : LPAREN element_cp_comma_list opt_ws RPAREN",
0556: "element_seq : WHITESPACE element_seq",
0557: "element_modifier : QUESTION",
0558: "element_modifier : STAR",
0559: "element_modifier : PLUS",
0560: "element_modifier :",
0561: "content :",
0562: "content : content INTERNAL_ENTITY_REF content ENTITY_END",
0563: "content : content EXTERNAL_ENTITY_REF content ENTITY_END",
0564: "content : content EXTERNAL_ENTITY_REF xml_text_decl content ENTITY_END",
0565: "content : content OPEN_TAG content CLOSE_TAG",
0566: "content : content EMPTY_TAG", "content : content PI",
0567: "content : content COMMENT",
0568: "content : content WHITESPACE", "content : content CDATA", };
0569:
0570: //#line 556 "Piccolo.y"
0571:
0572: DocumentHandler documentHandler = null;
0573: DTDHandler dtdHandler = null;
0574: ErrorHandler errorHandler = null;
0575: ContentHandler contentHandler = null;
0576: int saxVersion = 0;
0577: int attributeType = -1;
0578: StringBuffer modelBuffer = new StringBuffer(100);
0579: ElementDefinition elementDefinition = null;
0580: String pubID = null, sysID = null;
0581: String dtdName = null, dtdPubID = null, dtdSysID = null;
0582: PiccoloLexer lexer = new PiccoloLexer(this );
0583: DocumentEntity docEntity = new DocumentEntity();
0584: LexicalHandler lexHandler = null;
0585: DeclHandler declHandler = null;
0586: boolean parsingInProgress = false;
0587:
0588: /// Create an instance of the Piccolo parser
0589: public Piccolo() {
0590: }
0591:
0592: /**
0593: * Create an instance with the same configuration
0594: * as the given instance. ContentHandler, DTDHandler, etc.
0595: * will not be copied.
0596: */
0597: public Piccolo(Piccolo template) {
0598: fNamespaces = template.fNamespaces;
0599: fNamespacePrefixes = template.fNamespacePrefixes;
0600: fExternalGeneralEntities = template.fExternalGeneralEntities;
0601: fExternalParameterEntities = template.fExternalParameterEntities;
0602: fLexicalParameterEntities = template.fLexicalParameterEntities;
0603: lexer.enableNamespaces(fNamespaces);
0604: fResolveDTDURIs = template.fResolveDTDURIs;
0605: }
0606:
0607: private void reset() {
0608: modelBuffer.setLength(0);
0609: pubID = sysID = dtdName = dtdPubID = dtdSysID = null;
0610: elementDefinition = null;
0611: }
0612:
0613: // Make sure it's okay to start parsing
0614: private void validateParseState() throws SAXException {
0615: if (!fNamespaces && !fNamespacePrefixes) {
0616: throw new FatalParsingException(
0617: "The 'namespaces' and 'namespace-prefixes' features must not both be false");
0618: }
0619: }
0620:
0621: public void setDebug(boolean debug) {
0622: yydebug = debug;
0623: }
0624:
0625: /************************************************************************
0626: * Methods common to both SAX1 and SAX2
0627: ************************************************************************/
0628:
0629: public void parse(InputSource source) throws IOException,
0630: SAXException {
0631: try {
0632: reset();
0633: validateParseState();
0634: try {
0635: docEntity.reset(source);
0636: lexer.reset(docEntity);
0637: } finally {
0638: reportStartDocument();
0639: }
0640: yyparse();
0641: } catch (IllegalCharException e) {
0642: reportFatalError(e.getMessage(), e);
0643: } catch (FileFormatException e) {
0644: reportFatalError(e.getMessage(), e);
0645: } catch (FatalParsingException e) {
0646: reportFatalError(e.getMessage(), e.getException());
0647: } finally {
0648: reportEndDocument();
0649: }
0650: }
0651:
0652: public void parse(String sysID) throws IOException, SAXException {
0653: try {
0654: reset();
0655: validateParseState();
0656: try {
0657: docEntity.reset(sysID);
0658: lexer.reset(docEntity);
0659: } finally {
0660: reportStartDocument();
0661: }
0662: yyparse();
0663: } catch (IllegalCharException e) {
0664: reportFatalError(e.getMessage(), e);
0665: } catch (FileFormatException e) {
0666: reportFatalError(e.getMessage(), e);
0667: } catch (FatalParsingException e) {
0668: reportFatalError(e.getMessage(), e.getException());
0669: } finally {
0670: reportEndDocument();
0671: }
0672: }
0673:
0674: /************************************************************************
0675: * SAX1 methods
0676: ************************************************************************/
0677:
0678: public void setDocumentHandler(DocumentHandler handler) {
0679: documentHandler = handler;
0680: if (documentHandler != null) {
0681: saxVersion = 1;
0682: fNamespaces = false;
0683: lexer.enableNamespaces(false);
0684: fNamespacePrefixes = true;
0685: documentHandler.setDocumentLocator(this );
0686: } else
0687: saxVersion = 0;
0688: }
0689:
0690: public void setDTDHandler(DTDHandler handler) {
0691: dtdHandler = handler;
0692: }
0693:
0694: public void setEntityResolver(EntityResolver resolver) {
0695: lexer.entityManager.setResolver(resolver);
0696: }
0697:
0698: public void setErrorHandler(ErrorHandler handler) {
0699: errorHandler = handler;
0700: }
0701:
0702: public void setLocale(java.util.Locale locale) throws SAXException {
0703: if (!("en".equals(locale.getLanguage())))
0704: throw new SAXException(
0705: "Only English (EN) locales are supported");
0706: }
0707:
0708: // Locator
0709: public int getColumnNumber() {
0710: return lexer.getColumnNumber();
0711: }
0712:
0713: public int getLineNumber() {
0714: return lexer.getLineNumber();
0715: }
0716:
0717: public String getPublicId() {
0718: return lexer.getPublicID();
0719: }
0720:
0721: public String getSystemId() {
0722: return lexer.getSystemID();
0723: }
0724:
0725: // Locator which returns line/col info for the start of the token
0726: private class StartLocator implements org.xml.sax.Locator {
0727: public int getLineNumber() {
0728: return Piccolo.this .lexer.tokenStartLine;
0729: }
0730:
0731: public int getColumnNumber() {
0732: return -1;
0733: }
0734:
0735: public String getPublicId() {
0736: return null;
0737: }
0738:
0739: public String getSystemId() {
0740: return null;
0741: }
0742: }
0743:
0744: private StartLocator startLocator;
0745:
0746: public Locator getStartLocator() {
0747: if (startLocator == null)
0748: startLocator = new StartLocator();
0749:
0750: return startLocator;
0751: }
0752:
0753: public String getVersion() {
0754: return lexer.getVersion();
0755: }
0756:
0757: public String getEncoding() {
0758: return lexer.getEncoding();
0759: }
0760:
0761: /************************************************************************
0762: * SAX2 methods
0763: ************************************************************************/
0764:
0765: public ContentHandler getContentHandler() {
0766: return contentHandler;
0767: }
0768:
0769: public void setContentHandler(ContentHandler handler) {
0770: contentHandler = handler;
0771:
0772: if (contentHandler != null) {
0773: // Are we switching from SAX1? If so, turn namespace processing on
0774: if (saxVersion == 1) {
0775: fNamespaces = true;
0776: lexer.enableNamespaces(true);
0777: fNamespacePrefixes = false;
0778: }
0779:
0780: saxVersion = 2;
0781: contentHandler.setDocumentLocator(this );
0782: } else
0783: saxVersion = 0;
0784: }
0785:
0786: public DTDHandler getDTDHandler() {
0787: return dtdHandler;
0788: }
0789:
0790: public EntityResolver getEntityResolver() {
0791: return lexer.entityManager.getResolver();
0792: }
0793:
0794: public ErrorHandler getErrorHandler() {
0795: return errorHandler;
0796: }
0797:
0798: // SAX2 Features
0799: boolean fNamespaces = true, fNamespacePrefixes = false,
0800: fResolveDTDURIs = true;
0801: boolean fExternalGeneralEntities = true,
0802: fExternalParameterEntities = true;
0803: boolean fLexicalParameterEntities = true;
0804:
0805: public boolean getFeature(String name)
0806: throws SAXNotSupportedException, SAXNotRecognizedException {
0807: if (name.equals("http://xml.org/sax/features/namespaces"))
0808: return fNamespaces;
0809: else if (name
0810: .equals("http://xml.org/sax/features/namespace-prefixes"))
0811: return fNamespacePrefixes;
0812: else if (name
0813: .equals("http://xml.org/sax/features/external-general-entities"))
0814: return fExternalGeneralEntities;
0815: else if (name
0816: .equals("http://xml.org/sax/features/external-parameter-entities"))
0817: return fExternalGeneralEntities;
0818: else if (name
0819: .equals("http://xml.org/sax/features/lexical-handler/parameter-entities"))
0820: return fLexicalParameterEntities;
0821: else if (name
0822: .equals("http://xml.org/sax/features/string-interning"))
0823: return true;
0824: else if (name
0825: .equals("http://xml.org/sax/features/is-standalone"))
0826: return docEntity.isStandalone();
0827: else if (name
0828: .equals("http://xml.org/sax/features/resolve-dtd-uris"))
0829: return fResolveDTDURIs;
0830: else if (name
0831: .equals("http://xml.org/sax/features/use-attributes2")
0832: || name
0833: .equals("http://xml.org/sax/features/validation")
0834: || name
0835: .equals("http://xml.org/sax/features/use-locator2")
0836: || name
0837: .equals("http://xml.org/sax/features/use-entity2")
0838: || name
0839: .equals("http://xml.org/sax/features/use-locator2"))
0840: return false;
0841: else
0842: throw new SAXNotRecognizedException(name);
0843: }
0844:
0845: public void setFeature(String name, boolean value)
0846: throws SAXNotSupportedException, SAXNotRecognizedException {
0847: if (name.equals("http://xml.org/sax/features/namespaces")) {
0848: if (parsingInProgress) {
0849: throw new SAXNotSupportedException(
0850: "Can't change namespace settings while parsing");
0851: }
0852: fNamespaces = value;
0853: lexer.enableNamespaces(value);
0854: } else if (name
0855: .equals("http://xml.org/sax/features/namespace-prefixes")) {
0856: if (parsingInProgress) {
0857: throw new SAXNotSupportedException(
0858: "Can't change namespace settings while parsing");
0859: }
0860: fNamespacePrefixes = value;
0861: } else if (name
0862: .equals("http://xml.org/sax/features/external-general-entities")) {
0863: fExternalGeneralEntities = value;
0864: } else if (name
0865: .equals("http://xml.org/sax/features/external-parameter-entities")) {
0866: fExternalParameterEntities = value;
0867: } else if (name
0868: .equals("http://xml.org/sax/features/lexical-handler/parameter-entities")) {
0869: fLexicalParameterEntities = value;
0870: } else if (name
0871: .equals("http://xml.org/sax/features/resolve-dtd-uris")) {
0872: fResolveDTDURIs = value;
0873: } else if (name
0874: .equals("http://xml.org/sax/features/validation")) {
0875: if (value)
0876: throw new SAXNotSupportedException(
0877: "validation is not supported");
0878: } else if (name
0879: .equals("http://xml.org/sax/features/string-interning")) {
0880: if (!value)
0881: throw new SAXNotSupportedException(
0882: "strings are always internalized");
0883: } else if (name
0884: .equals("http://xml.org/sax/features/use-attributes2")
0885: || name
0886: .equals("http://xml.org/sax/features/validation")
0887: || name
0888: .equals("http://xml.org/sax/features/use-locator2")
0889: || name
0890: .equals("http://xml.org/sax/features/use-entity2")
0891: || name
0892: .equals("http://xml.org/sax/features/use-locator2")) {
0893: if (value)
0894: throw new SAXNotSupportedException(name);
0895: } else
0896: throw new SAXNotRecognizedException(name);
0897: }
0898:
0899: public Object getProperty(String name)
0900: throws SAXNotRecognizedException, SAXNotSupportedException {
0901: if (name
0902: .equals("http://xml.org/sax/properties/declaration-handler"))
0903: return declHandler;
0904: else if (name
0905: .equals("http://xml.org/sax/properties/lexical-handler"))
0906: return lexHandler;
0907: else
0908: throw new SAXNotRecognizedException(name);
0909: }
0910:
0911: public void setProperty(String name, Object value)
0912: throws SAXNotRecognizedException, SAXNotSupportedException {
0913: if (name
0914: .equals("http://xml.org/sax/properties/declaration-handler")) {
0915: try {
0916: declHandler = (DeclHandler) value;
0917: } catch (ClassCastException e) {
0918: throw new SAXNotSupportedException(
0919: "property value is not a DeclHandler");
0920: }
0921: } else if (name
0922: .equals("http://xml.org/sax/properties/lexical-handler")) {
0923: try {
0924: lexHandler = (LexicalHandler) value;
0925: } catch (ClassCastException e) {
0926: throw new SAXNotSupportedException(
0927: "property value is not a LexicalHandler");
0928: }
0929: } else
0930: throw new SAXNotRecognizedException(name);
0931: }
0932:
0933: /************************************************************************
0934: * Methods used to call ContentHandlers or DocumentHandlers
0935: ************************************************************************/
0936:
0937: void reportCdata() throws SAXException {
0938: reportCdata(lexer.cdataBuffer, lexer.cdataStart,
0939: lexer.cdataLength);
0940: }
0941:
0942: private char[] oneCharBuffer = new char[1];
0943:
0944: void reportCdata(char c) throws SAXException {
0945: oneCharBuffer[0] = c;
0946: reportCdata(oneCharBuffer, 0, 1);
0947: }
0948:
0949: void reportCdata(char[] buf, int off, int len) throws SAXException {
0950: switch (saxVersion) {
0951: case 2:
0952: contentHandler.characters(buf, off, len);
0953: break;
0954: case 1:
0955: documentHandler.characters(buf, off, len);
0956: break;
0957: }
0958: }
0959:
0960: void reportWhitespace() throws SAXException {
0961: reportWhitespace(lexer.cdataBuffer, lexer.cdataStart,
0962: lexer.cdataLength);
0963: }
0964:
0965: void reportWhitespace(char[] buf, int off, int len)
0966: throws SAXException {
0967: switch (saxVersion) {
0968: case 2:
0969: contentHandler.characters(buf, off, len);
0970: break;
0971: case 1:
0972: documentHandler.characters(buf, off, len);
0973: break;
0974: }
0975: }
0976:
0977: void reportError(String msg) throws SAXException {
0978: if (errorHandler != null) {
0979: errorHandler.error(new SAXParseException(msg,
0980: getPublicId(), getSystemId(), getLineNumber(),
0981: getColumnNumber()));
0982: }
0983: }
0984:
0985: void reportFatalError(String msg) throws SAXException {
0986: reportFatalError(msg, null);
0987: }
0988:
0989: void reportFatalError(String msg, Exception e) throws SAXException {
0990: if (e != null) {
0991: StringWriter stackTrace = new StringWriter();
0992: e.printStackTrace(new PrintWriter(stackTrace));
0993: if (msg != null)
0994: msg += "\n" + stackTrace.toString();
0995: else
0996: msg = stackTrace.toString();
0997: }
0998:
0999: SAXParseException spe = new SAXParseException(msg,
1000: getPublicId(), getSystemId(), getLineNumber(),
1001: getColumnNumber(), e);
1002:
1003: if (errorHandler != null)
1004: errorHandler.fatalError(spe);
1005: else
1006: throw spe;
1007: }
1008:
1009: void reportSkippedEntity(String entity) throws SAXException {
1010: if (saxVersion == 2) {
1011: contentHandler.skippedEntity(entity);
1012: }
1013: }
1014:
1015: void reportPI(String entity, String data) throws SAXException {
1016: switch (saxVersion) {
1017: case 2:
1018: contentHandler.processingInstruction(entity, data);
1019: break;
1020: case 1:
1021: documentHandler.processingInstruction(entity, data);
1022: break;
1023: }
1024: }
1025:
1026: void reportUnparsedEntityDecl(String entity, String pubID,
1027: String sysID, String notation) throws SAXException {
1028: if (dtdHandler != null) {
1029: dtdHandler.unparsedEntityDecl(entity, pubID,
1030: resolveSystemID(sysID), notation);
1031: }
1032: }
1033:
1034: void reportNotationDecl(String name, String pubID, String sysID)
1035: throws SAXException {
1036: if (dtdHandler != null)
1037: dtdHandler
1038: .notationDecl(name, pubID, resolveSystemID(sysID));
1039: }
1040:
1041: void reportStartTag(String ns, String entity, String qEntity)
1042: throws SAXException {
1043: switch (saxVersion) {
1044: case 2:
1045: contentHandler.startElement(ns, entity, qEntity,
1046: lexer.attribs);
1047: break;
1048: case 1:
1049: documentHandler.startElement(qEntity, lexer.attribs);
1050: break;
1051: }
1052: }
1053:
1054: void reportEndTag(String ns, String entity, String qEntity)
1055: throws SAXException {
1056: switch (saxVersion) {
1057: case 2:
1058: contentHandler.endElement(ns, entity, qEntity);
1059: break;
1060: case 1:
1061: documentHandler.endElement(qEntity);
1062: break;
1063: }
1064: }
1065:
1066: void reportStartPrefixMapping(String prefix, String uri)
1067: throws SAXException {
1068: if (saxVersion == 2) {
1069: contentHandler.startPrefixMapping(prefix, uri);
1070: }
1071: }
1072:
1073: void reportEndPrefixMapping(String prefix) throws SAXException {
1074: if (saxVersion == 2) {
1075: contentHandler.endPrefixMapping(prefix);
1076: }
1077: }
1078:
1079: void reportStartDocument() throws SAXException {
1080: parsingInProgress = true;
1081: switch (saxVersion) {
1082: case 2:
1083: contentHandler.startDocument();
1084: break;
1085: case 1:
1086: documentHandler.startDocument();
1087: break;
1088: }
1089: }
1090:
1091: void reportEndDocument() throws SAXException {
1092: parsingInProgress = false;
1093: switch (saxVersion) {
1094: case 2:
1095: contentHandler.endDocument();
1096: break;
1097: case 1:
1098: documentHandler.endDocument();
1099: break;
1100: }
1101: }
1102:
1103: /************************************************************************
1104: * Methods used for SAX 2 extensions
1105: ************************************************************************/
1106:
1107: // *** LexicalHandler ***
1108: void reportStartDTD(String name, String pubID, String sysID)
1109: throws SAXException {
1110: if (lexHandler != null)
1111: lexHandler.startDTD(name, pubID, sysID);
1112: }
1113:
1114: void reportEndDTD() throws SAXException {
1115: if (lexHandler != null)
1116: lexHandler.endDTD();
1117: }
1118:
1119: void reportStartEntity(String name) throws SAXException {
1120: if (lexHandler != null) {
1121: if (fLexicalParameterEntities || name.charAt(0) != '%')
1122: lexHandler.startEntity(name);
1123: }
1124: }
1125:
1126: void reportEndEntity(String name) throws SAXException {
1127: if (lexHandler != null) {
1128: if (fLexicalParameterEntities || name.charAt(0) != '%')
1129: lexHandler.endEntity(name);
1130: }
1131: }
1132:
1133: void reportStartCdata() throws SAXException {
1134: if (lexHandler != null)
1135: lexHandler.startCDATA();
1136: }
1137:
1138: void reportEndCdata() throws SAXException {
1139: if (lexHandler != null)
1140: lexHandler.endCDATA();
1141: }
1142:
1143: void reportComment(char[] ch, int start, int length)
1144: throws SAXException {
1145: if (lexHandler != null)
1146: lexHandler.comment(ch, start, length);
1147: }
1148:
1149: /************************************************************************
1150: * Miscellaneous methods used internally
1151: ************************************************************************/
1152:
1153: private void addAttributeDefinition(String qName, int valueType,
1154: int defaultType, String defaultValue) throws SAXException,
1155: IOException {
1156: String prefix = "", localName = "";
1157: if (fNamespaces) {
1158: localName = qName;
1159: if (qName == "xmlns" && defaultValue != null) // Internalize all URIs
1160: defaultValue.intern();
1161: }
1162:
1163: saveAttributeDefinition(prefix, localName, qName, valueType,
1164: defaultType, defaultValue);
1165: }
1166:
1167: private void addPrefixedAttributeDefinition(String qName,
1168: int valueType, int defaultType, String defaultValue)
1169: throws SAXException, IOException {
1170: String prefix, localName;
1171: if (fNamespaces) {
1172: int colon = qName.indexOf(':');
1173: int len = qName.length();
1174: qName.getChars(0, len, lexer.cbuf, 0);
1175: prefix = lexer.stringConverter
1176: .convert(lexer.cbuf, 0, colon);
1177: localName = lexer.stringConverter.convert(lexer.cbuf,
1178: colon + 1, len - (colon + 1));
1179: } else {
1180: prefix = localName = "";
1181: }
1182:
1183: saveAttributeDefinition(prefix, localName, qName, valueType,
1184: defaultType, defaultValue);
1185: }
1186:
1187: private void saveAttributeDefinition(String prefix,
1188: String localName, String qName, int valueType,
1189: int defaultType, String defaultValue) throws SAXException,
1190: IOException {
1191: try {
1192: if (defaultValue != null) {
1193: if (valueType == AttributeDefinition.NMTOKEN
1194: || valueType == AttributeDefinition.NMTOKENS)
1195: defaultValue = lexer.normalizeValue(defaultValue);
1196:
1197: defaultValue = lexer.rescanAttributeValue(defaultValue);
1198: }
1199:
1200: if (declHandler != null) {
1201: String valueTypeString = null;
1202: if (valueType == AttributeDefinition.NOTATION) {
1203: modelBuffer.insert(0, "NOTATION (");
1204: modelBuffer.append(')');
1205: valueTypeString = modelBuffer.toString();
1206: } else if (valueType == AttributeDefinition.ENUMERATION) {
1207: modelBuffer.insert(0, '(');
1208: modelBuffer.append(')');
1209: valueTypeString = modelBuffer.toString();
1210: } else
1211: valueTypeString = AttributeDefinition
1212: .getValueTypeString(valueType);
1213:
1214: declHandler.attributeDecl(elementDefinition.getName(),
1215: qName, valueTypeString, AttributeDefinition
1216: .getDefaultTypeString(defaultType),
1217: defaultValue);
1218:
1219: modelBuffer.setLength(0);
1220: }
1221:
1222: elementDefinition.addAttribute(new AttributeDefinition(
1223: prefix, localName, qName, valueType, null,
1224: defaultType, defaultValue));
1225: } catch (DuplicateKeyException e) { // Attribute already exists; XML spec says ignore it
1226: }
1227: }
1228:
1229: private String resolveSystemID(String sysID) {
1230: String resolvedSysID;
1231: if (fResolveDTDURIs) {
1232: try {
1233: return EntityManager.resolveSystemID(docEntity
1234: .getSystemID(), sysID);
1235: } catch (MalformedURLException e) {
1236: return sysID;
1237: }
1238: } else
1239: return sysID;
1240: }
1241:
1242: private int yylex() throws IOException, SAXException {
1243: try {
1244: int tok = lexer.yylex();
1245: yylval = lexer.stringValue;
1246: lexer.stringValue = null;
1247:
1248: /* Uncomment for serious debugging
1249: if (yydebug) {
1250: if (tok == CDATA)
1251: System.out.println("Token: CDATA");
1252: else
1253: System.out.println("Token: " + yyname[tok] + " (" + yylval + ")");
1254:
1255: System.out.println("\tlexical state is now " + lexer.yystate() + ", line number " + getLineNumber() );
1256: }
1257: */
1258:
1259: return tok;
1260: } catch (IOException e) {
1261: while (lexer.currentEntity == null
1262: && lexer.entityStack.size() > 0) {
1263: lexer.currentEntity = (Entity) lexer.entityStack.pop();
1264: try {
1265: if (lexer.yymoreStreams())
1266: lexer.yypopStream();
1267: } catch (IOException ie) {
1268: }
1269: }
1270:
1271: throw e;
1272: } catch (SAXException e) {
1273: while (lexer.currentEntity == null
1274: && lexer.entityStack.size() > 0) {
1275: lexer.currentEntity = (Entity) lexer.entityStack.pop();
1276: try {
1277: if (lexer.yymoreStreams())
1278: lexer.yypopStream();
1279: } catch (IOException ie) {
1280: }
1281: }
1282:
1283: throw e;
1284: }
1285:
1286: }
1287:
1288: void yyerror(String msg) throws SAXException {
1289: // Check if this is because of an invalid entity reference
1290: if (yychar <= 0)
1291: throw new FatalParsingException(
1292: "Unexpected end of file after " + yylval);
1293: else
1294: throw new FatalParsingException("Unexpected element: "
1295: + yyname[yychar]);
1296: }
1297:
1298: //#line 1300 "Piccolo.java"
1299: //###############################################################
1300: // method: yylexdebug : check lexer state
1301: //###############################################################
1302: void yylexdebug(int state, int ch) {
1303: String s = null;
1304: if (ch < 0)
1305: ch = 0;
1306: if (ch <= YYMAXTOKEN) //check index bounds
1307: s = yyname[ch]; //now get it
1308: if (s == null)
1309: s = "illegal-symbol";
1310: debug("state " + state + ", reading " + ch + " (" + s + ")");
1311: }
1312:
1313: //The following are now global, to aid in error reporting
1314: int yyn; //next next thing to do
1315: int yym; //
1316: int yystate; //current parsing state from state table
1317: String yys; //current token string
1318:
1319: //###############################################################
1320: // method: yyparse : parse input and execute indicated items
1321: //###############################################################
1322: int yyparse() throws SAXException, IOException {
1323: boolean doaction;
1324: init_stacks();
1325: yynerrs = 0;
1326: yyerrflag = 0;
1327: yychar = -1; //impossible char forces a read
1328: yystate = 0; //initial state
1329: state_push(yystate); //save it
1330: while (true) //until parsing is done, either correctly, or w/error
1331: {
1332: doaction = true;
1333: //if (yydebug) debug("loop");
1334: //#### NEXT ACTION (from reduction table)
1335: for (yyn = yydefred[yystate]; yyn == 0; yyn = yydefred[yystate]) {
1336: //if (yydebug) debug("yyn:"+yyn+" state:"+yystate+" yychar:"+yychar);
1337: if (yychar < 0) //we want a char?
1338: {
1339: yychar = yylex(); //get next token
1340: //if (yydebug) debug(" next yychar:"+yychar);
1341: //#### ERROR CHECK ####
1342: //if (yychar < 0) //it it didn't work/error
1343: // {
1344: // yychar = 0; //change it to default string (no -1!)
1345: //if (yydebug)
1346: // yylexdebug(yystate,yychar);
1347: // }
1348: }//yychar<0
1349: yyn = yysindex[yystate]; //get amount to shift by (shift index)
1350: if ((yyn != 0) && (yyn += yychar) >= 0
1351: && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) {
1352: //if (yydebug)
1353: //debug("state "+yystate+", shifting to state "+yytable[yyn]);
1354: //#### NEXT STATE ####
1355: yystate = yytable[yyn];//we are in a new state
1356: state_push(yystate); //save it
1357: val_push(yylval); //push our lval as the input for next rule
1358: yychar = -1; //since we have 'eaten' a token, say we need another
1359: if (yyerrflag > 0) //have we recovered an error?
1360: --yyerrflag; //give ourselves credit
1361: doaction = false; //but don't process yet
1362: break; //quit the yyn=0 loop
1363: }
1364:
1365: yyn = yyrindex[yystate]; //reduce
1366: if ((yyn != 0) && (yyn += yychar) >= 0
1367: && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { //we reduced!
1368: //if (yydebug) debug("reduce");
1369: yyn = yytable[yyn];
1370: doaction = true; //get ready to execute
1371: break; //drop down to actions
1372: } else //ERROR RECOVERY
1373: {
1374: if (yyerrflag == 0) {
1375: yyerror("syntax error");
1376: yynerrs++;
1377: }
1378: if (yyerrflag < 3) //low error count?
1379: {
1380: yyerrflag = 3;
1381: while (true) //do until break
1382: {
1383: yyn = yysindex[state_peek(0)];
1384: if ((yyn != 0) && (yyn += YYERRCODE) >= 0
1385: && yyn <= YYTABLESIZE
1386: && yycheck[yyn] == YYERRCODE) {
1387: //if (yydebug)
1388: //debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
1389: yystate = yytable[yyn];
1390: state_push(yystate);
1391: val_push(yylval);
1392: doaction = false;
1393: break;
1394: } else {
1395: //if (yydebug)
1396: //debug("error recovery discarding state "+state_peek(0)+" ");
1397: state_pop();
1398: val_pop();
1399: }
1400: }
1401: } else //discard this token
1402: {
1403: if (yychar == 0)
1404: return 1; //yyabort
1405: //if (yydebug)
1406: //{
1407: //yys = null;
1408: //if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1409: //if (yys == null) yys = "illegal-symbol";
1410: //debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
1411: //}
1412: yychar = -1; //read another
1413: }
1414: }//end error recovery
1415: }//yyn=0 loop
1416: if (!doaction) //any reason not to proceed?
1417: continue; //skip action
1418: yym = yylen[yyn]; //get count of terminals on rhs
1419: //if (yydebug)
1420: //debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
1421: if (yym > 0) //if count of rhs not 'nil'
1422: yyval = val_peek(yym - 1); //get current semantic value
1423: switch (yyn) {
1424: //########## USER-SUPPLIED ACTIONS ##########
1425: case 20:
1426: //#line 113 "Piccolo.y"
1427: {
1428: dtdName = val_peek(2);
1429: lexer.yybegin(0);
1430: reportStartDTD(dtdName, null, null);
1431: reportEndDTD();
1432: }
1433: break;
1434: case 21:
1435: //#line 119 "Piccolo.y"
1436: {
1437: /* Internal subset only*/
1438: lexer.yybegin(0);
1439: reportEndDTD();
1440: }
1441: break;
1442: case 22:
1443: //#line 124 "Piccolo.y"
1444: {
1445: /* Internal+External or External only with an <?xml?> declaration*/
1446: lexer.yybegin(0);
1447: reportEndDTD();
1448: }
1449: break;
1450: case 23:
1451: //#line 129 "Piccolo.y"
1452: {
1453: /* Internal+External or External only with no <?xml?> declaration*/
1454: lexer.yybegin(0);
1455: reportEndDTD();
1456: }
1457: break;
1458: case 24:
1459: //#line 134 "Piccolo.y"
1460: {
1461: /* External subset with no internal subset. Skip external*/
1462: dtdName = val_peek(4);
1463: lexer.yybegin(0);
1464: reportStartDTD(dtdName, pubID, sysID);
1465: reportEndDTD();
1466: }
1467: break;
1468: case 26:
1469: //#line 144 "Piccolo.y"
1470: {
1471: /* External subset with no internal subset*/
1472: lexer.pushEntity("[dtd]", dtdPubID, dtdSysID, false,
1473: true);
1474: lexer.yybegin(lexer.DTD);
1475: }
1476: break;
1477: case 27:
1478: //#line 150 "Piccolo.y"
1479: {
1480: /* Both external and internal subsets. Internal comes first.*/
1481: lexer.pushEntity("[dtd]", dtdPubID, dtdSysID, false,
1482: true);
1483: lexer.yybegin(lexer.DTD);
1484: }
1485: break;
1486: case 28:
1487: //#line 159 "Piccolo.y"
1488: {
1489: dtdName = lexer.normalizeValue(val_peek(5));
1490: dtdPubID = null;
1491: dtdSysID = lexer.normalizeValue(val_peek(1));
1492: reportStartDTD(dtdName, dtdPubID, dtdSysID);
1493: }
1494: break;
1495: case 29:
1496: //#line 166 "Piccolo.y"
1497: {
1498: dtdName = val_peek(7);
1499: dtdPubID = lexer.normalizeValue(val_peek(3));
1500: dtdSysID = lexer.normalizeValue(val_peek(1));
1501: reportStartDTD(dtdName, dtdPubID, dtdSysID);
1502: }
1503: break;
1504: case 30:
1505: //#line 175 "Piccolo.y"
1506: {
1507: dtdName = val_peek(1);
1508: reportStartDTD(dtdName, null, null);
1509: }
1510: break;
1511: case 31:
1512: //#line 179 "Piccolo.y"
1513: {
1514: dtdName = val_peek(1);
1515: reportStartDTD(dtdName, null, null);
1516: }
1517: break;
1518: case 32:
1519: //#line 183 "Piccolo.y"
1520: {
1521: dtdName = val_peek(3);
1522: reportStartDTD(dtdName, pubID, sysID);
1523: }
1524: break;
1525: case 33:
1526: //#line 190 "Piccolo.y"
1527: {
1528: pubID = null;
1529: sysID = lexer.normalizeValue(val_peek(0));
1530: }
1531: break;
1532: case 34:
1533: //#line 191 "Piccolo.y"
1534: {
1535: pubID = lexer.normalizeValue(val_peek(2));
1536: sysID = lexer.normalizeValue(val_peek(0));
1537: }
1538: break;
1539: case 46:
1540: //#line 211 "Piccolo.y"
1541: {
1542: lexer.yybegin(lexer.DTD);
1543: }
1544: break;
1545: case 47:
1546: //#line 217 "Piccolo.y"
1547: {
1548: lexer.yybegin(lexer.DTD);
1549: }
1550: break;
1551: case 49:
1552: //#line 223 "Piccolo.y"
1553: {
1554: lexer.yybegin(lexer.DTD_IGNORE);
1555: }
1556: break;
1557: case 53:
1558: //#line 236 "Piccolo.y"
1559: {
1560: lexer.entityManager.putInternal(val_peek(4),
1561: val_peek(2), EntityManager.GENERAL);
1562: if (declHandler != null)
1563: declHandler.internalEntityDecl(val_peek(4),
1564: val_peek(2));
1565: }
1566: break;
1567: case 54:
1568: //#line 241 "Piccolo.y"
1569: {
1570: try {
1571: lexer.entityManager.putExternal(
1572: lexer.currentEntity, val_peek(4), pubID,
1573: sysID, EntityManager.GENERAL);
1574: if (declHandler != null)
1575: declHandler.externalEntityDecl(val_peek(4),
1576: pubID, resolveSystemID(sysID));
1577: } catch (MalformedURLException e) {
1578: reportFatalError("Invalid system identifier: "
1579: + sysID + "; " + e.getMessage());
1580: }
1581: }
1582: break;
1583: case 55:
1584: //#line 252 "Piccolo.y"
1585: {
1586: try {
1587: lexer.entityManager.putUnparsed(
1588: lexer.currentEntity, val_peek(8), pubID,
1589: sysID, val_peek(2), EntityManager.GENERAL);
1590: reportUnparsedEntityDecl(val_peek(8), pubID, sysID,
1591: val_peek(2));
1592:
1593: } catch (MalformedURLException e) {
1594: reportFatalError("Invalid system identifier: "
1595: + sysID + "; " + e.getMessage());
1596: }
1597: }
1598: break;
1599: case 56:
1600: //#line 263 "Piccolo.y"
1601: {
1602: lexer.entityManager.putInternal(val_peek(4),
1603: val_peek(2), EntityManager.PARAMETER);
1604: if (declHandler != null)
1605: declHandler.internalEntityDecl("%" + val_peek(4),
1606: val_peek(2));
1607: }
1608: break;
1609: case 57:
1610: //#line 268 "Piccolo.y"
1611: {
1612: try {
1613: lexer.entityManager.putExternal(
1614: lexer.currentEntity, val_peek(4), pubID,
1615: sysID, EntityManager.PARAMETER);
1616: if (declHandler != null)
1617: declHandler.externalEntityDecl("%"
1618: + val_peek(4), pubID,
1619: resolveSystemID(sysID));
1620: } catch (MalformedURLException e) {
1621: reportFatalError("Invalid system identifier: "
1622: + sysID + "; " + e.getMessage());
1623: }
1624: }
1625: break;
1626: case 58:
1627: //#line 279 "Piccolo.y"
1628: {
1629: try {
1630: lexer.entityManager
1631: .putUnparsed(lexer.currentEntity,
1632: val_peek(7), pubID, sysID,
1633: val_peek(2),
1634: EntityManager.PARAMETER);
1635: reportUnparsedEntityDecl(val_peek(7), pubID, sysID,
1636: val_peek(2));
1637:
1638: } catch (MalformedURLException e) {
1639: reportFatalError("Invalid system identifier: "
1640: + sysID + "; " + e.getMessage());
1641: }
1642: }
1643: break;
1644: case 59:
1645: //#line 293 "Piccolo.y"
1646: {
1647: reportNotationDecl(val_peek(4), pubID, sysID);
1648: }
1649: break;
1650: case 60:
1651: //#line 296 "Piccolo.y"
1652: {
1653: reportNotationDecl(val_peek(6), lexer
1654: .normalizeValue(val_peek(2)), null);
1655: }
1656: break;
1657: case 61:
1658: //#line 302 "Piccolo.y"
1659: {
1660: lexer.defineElement(elementDefinition.getName(),
1661: elementDefinition);
1662: }
1663: break;
1664: case 62:
1665: //#line 307 "Piccolo.y"
1666: {
1667: /* Look up this element. If we've seen previous ATTLIST definitions for it, we'll add these to it.*/
1668: elementDefinition = lexer.getElement(val_peek(0));
1669: if (elementDefinition == null)
1670: elementDefinition = new ElementDefinition(
1671: val_peek(0));
1672: }
1673: break;
1674: case 65:
1675: //#line 321 "Piccolo.y"
1676: {
1677: lexer.yybegin(lexer.DTD_ATT_NAME);
1678: addPrefixedAttributeDefinition(val_peek(4),
1679: attributeType, AttributeDefinition.REQUIRED,
1680: null);
1681: }
1682: break;
1683: case 66:
1684: //#line 325 "Piccolo.y"
1685: {
1686: lexer.yybegin(lexer.DTD_ATT_NAME);
1687: addAttributeDefinition(val_peek(4), attributeType,
1688: AttributeDefinition.REQUIRED, null);
1689: }
1690: break;
1691: case 67:
1692: //#line 329 "Piccolo.y"
1693: {
1694: lexer.yybegin(lexer.DTD_ATT_NAME);
1695: addPrefixedAttributeDefinition(val_peek(4),
1696: attributeType, AttributeDefinition.IMPLIED,
1697: null);
1698: }
1699: break;
1700: case 68:
1701: //#line 333 "Piccolo.y"
1702: {
1703: lexer.yybegin(lexer.DTD_ATT_NAME);
1704: addAttributeDefinition(val_peek(4), attributeType,
1705: AttributeDefinition.IMPLIED, null);
1706: }
1707: break;
1708: case 69:
1709: //#line 337 "Piccolo.y"
1710: {
1711: lexer.yybegin(lexer.DTD_ATT_NAME);
1712: addPrefixedAttributeDefinition(val_peek(6),
1713: attributeType, AttributeDefinition.FIXED,
1714: val_peek(0));
1715: }
1716: break;
1717: case 70:
1718: //#line 341 "Piccolo.y"
1719: {
1720: lexer.yybegin(lexer.DTD_ATT_NAME);
1721: addAttributeDefinition(val_peek(6), attributeType,
1722: AttributeDefinition.FIXED, val_peek(0));
1723: }
1724: break;
1725: case 71:
1726: //#line 345 "Piccolo.y"
1727: {
1728: lexer.yybegin(lexer.DTD_ATT_NAME);
1729: addPrefixedAttributeDefinition(val_peek(4),
1730: attributeType, 0, val_peek(0));
1731: }
1732: break;
1733: case 72:
1734: //#line 349 "Piccolo.y"
1735: {
1736: lexer.yybegin(lexer.DTD_ATT_NAME);
1737: addAttributeDefinition(val_peek(4), attributeType, 0,
1738: val_peek(0));
1739: }
1740: break;
1741: case 73:
1742: //#line 356 "Piccolo.y"
1743: {
1744: attributeType = AttributeDefinition.CDATA;
1745: }
1746: break;
1747: case 74:
1748: //#line 357 "Piccolo.y"
1749: {
1750: attributeType = AttributeDefinition.ID;
1751: }
1752: break;
1753: case 75:
1754: //#line 358 "Piccolo.y"
1755: {
1756: attributeType = AttributeDefinition.IDREF;
1757: }
1758: break;
1759: case 76:
1760: //#line 359 "Piccolo.y"
1761: {
1762: attributeType = AttributeDefinition.IDREFS;
1763: }
1764: break;
1765: case 77:
1766: //#line 360 "Piccolo.y"
1767: {
1768: attributeType = AttributeDefinition.ENTITY;
1769: }
1770: break;
1771: case 78:
1772: //#line 361 "Piccolo.y"
1773: {
1774: attributeType = AttributeDefinition.ENTITIES;
1775: }
1776: break;
1777: case 79:
1778: //#line 362 "Piccolo.y"
1779: {
1780: attributeType = AttributeDefinition.NMTOKEN;
1781: }
1782: break;
1783: case 80:
1784: //#line 363 "Piccolo.y"
1785: {
1786: attributeType = AttributeDefinition.NMTOKENS;
1787: }
1788: break;
1789: case 81:
1790: //#line 364 "Piccolo.y"
1791: {
1792: attributeType = AttributeDefinition.ENUMERATION;
1793: }
1794: break;
1795: case 82:
1796: //#line 367 "Piccolo.y"
1797: {
1798: attributeType = AttributeDefinition.NOTATION;
1799: }
1800: break;
1801: case 83:
1802: //#line 373 "Piccolo.y"
1803: {
1804: if (declHandler != null)
1805: modelBuffer.append(val_peek(0));
1806: }
1807: break;
1808: case 84:
1809: //#line 377 "Piccolo.y"
1810: {
1811: if (declHandler != null) {
1812: modelBuffer.append('|');
1813: modelBuffer.append(val_peek(0));
1814: }
1815: }
1816: break;
1817: case 85:
1818: //#line 386 "Piccolo.y"
1819: {
1820: if (declHandler != null)
1821: declHandler.elementDecl(val_peek(4), val_peek(2));
1822: }
1823: break;
1824: case 86:
1825: //#line 393 "Piccolo.y"
1826: {
1827: if (declHandler != null)
1828: yyval = "EMPTY";
1829: }
1830: break;
1831: case 87:
1832: //#line 397 "Piccolo.y"
1833: {
1834: if (declHandler != null)
1835: yyval = "ANY";
1836: }
1837: break;
1838: case 88:
1839: //#line 401 "Piccolo.y"
1840: {
1841: if (declHandler != null)
1842: yyval = val_peek(0);
1843: }
1844: break;
1845: case 89:
1846: //#line 405 "Piccolo.y"
1847: {
1848: if (declHandler != null)
1849: yyval = val_peek(0);
1850: }
1851: break;
1852: case 90:
1853: //#line 412 "Piccolo.y"
1854: {
1855: if (declHandler != null)
1856: yyval = "(#PCDATA)*";
1857: }
1858: break;
1859: case 91:
1860: //#line 416 "Piccolo.y"
1861: {
1862: if (declHandler != null)
1863: yyval = "(#PCDATA)";
1864: }
1865: break;
1866: case 92:
1867: //#line 420 "Piccolo.y"
1868: {
1869: if (declHandler != null)
1870: yyval = "(#PCDATA|" + modelBuffer.toString() + ")*";
1871: }
1872: break;
1873: case 93:
1874: //#line 424 "Piccolo.y"
1875: {
1876: if (declHandler != null)
1877: yyval = val_peek(0);
1878: }
1879: break;
1880: case 94:
1881: //#line 431 "Piccolo.y"
1882: {
1883: if (declHandler != null)
1884: yyval = val_peek(1) + val_peek(0);
1885: }
1886: break;
1887: case 95:
1888: //#line 435 "Piccolo.y"
1889: {
1890: if (declHandler != null)
1891: yyval = val_peek(1) + val_peek(0);
1892: }
1893: break;
1894: case 96:
1895: //#line 439 "Piccolo.y"
1896: {
1897: if (declHandler != null)
1898: yyval = val_peek(0);
1899: }
1900: break;
1901: case 97:
1902: //#line 446 "Piccolo.y"
1903: {
1904: if (declHandler != null)
1905: yyval = val_peek(4) + "|" + val_peek(0);
1906: }
1907: break;
1908: case 98:
1909: //#line 450 "Piccolo.y"
1910: {
1911: if (declHandler != null)
1912: yyval = val_peek(4) + "|" + val_peek(0);
1913: }
1914: break;
1915: case 99:
1916: //#line 457 "Piccolo.y"
1917: {
1918: if (declHandler != null)
1919: yyval = val_peek(0);
1920: }
1921: break;
1922: case 100:
1923: //#line 461 "Piccolo.y"
1924: {
1925: if (declHandler != null)
1926: yyval = val_peek(3) + "," + val_peek(0);
1927: }
1928: break;
1929: case 101:
1930: //#line 468 "Piccolo.y"
1931: {
1932: if (declHandler != null)
1933: yyval = val_peek(2) + val_peek(1);
1934: }
1935: break;
1936: case 102:
1937: //#line 472 "Piccolo.y"
1938: {
1939: if (declHandler != null)
1940: yyval = val_peek(2) + val_peek(1);
1941: }
1942: break;
1943: case 103:
1944: //#line 476 "Piccolo.y"
1945: {
1946: if (declHandler != null)
1947: yyval = val_peek(2) + val_peek(1);
1948: }
1949: break;
1950: case 104:
1951: //#line 480 "Piccolo.y"
1952: {
1953: if (declHandler != null)
1954: yyval = val_peek(0);
1955: }
1956: break;
1957: case 105:
1958: //#line 488 "Piccolo.y"
1959: {
1960: if (declHandler != null)
1961: yyval = "(" + val_peek(2) + ")";
1962: }
1963: break;
1964: case 106:
1965: //#line 492 "Piccolo.y"
1966: {
1967: if (declHandler != null)
1968: yyval = val_peek(0);
1969: }
1970: break;
1971: case 107:
1972: //#line 499 "Piccolo.y"
1973: {
1974: if (declHandler != null)
1975: yyval = "(" + val_peek(2) + ")";
1976: }
1977: break;
1978: case 108:
1979: //#line 503 "Piccolo.y"
1980: {
1981: if (declHandler != null)
1982: yyval = val_peek(0);
1983: }
1984: break;
1985: case 109:
1986: //#line 510 "Piccolo.y"
1987: {
1988: if (declHandler != null)
1989: yyval = "?";
1990: }
1991: break;
1992: case 110:
1993: //#line 514 "Piccolo.y"
1994: {
1995: if (declHandler != null)
1996: yyval = "*";
1997: }
1998: break;
1999: case 111:
2000: //#line 518 "Piccolo.y"
2001: {
2002: if (declHandler != null)
2003: yyval = "+";
2004: }
2005: break;
2006: case 112:
2007: //#line 522 "Piccolo.y"
2008: {
2009: if (declHandler != null)
2010: yyval = "";
2011: }
2012: break;
2013: case 114:
2014: //#line 532 "Piccolo.y"
2015: {
2016: lexer.setTokenize(false);
2017: }
2018: break;
2019: case 115:
2020: //#line 536 "Piccolo.y"
2021: {
2022: lexer.setTokenize(false);
2023: }
2024: break;
2025: case 116:
2026: //#line 540 "Piccolo.y"
2027: {
2028: lexer.setTokenize(false);
2029: }
2030: break;
2031: case 121:
2032: //#line 547 "Piccolo.y"
2033: {
2034: reportWhitespace();
2035: }
2036: break;
2037: //#line 1999 "Piccolo.java"
2038: //########## END OF USER-SUPPLIED ACTIONS ##########
2039: }//switch
2040: //#### Now let's reduce... ####
2041: //if (yydebug) debug("reduce");
2042: state_drop(yym); //we just reduced yylen states
2043: yystate = state_peek(0); //get new state
2044: val_drop(yym); //corresponding value drop
2045: yym = yylhs[yyn]; //select next TERMINAL(on lhs)
2046: if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
2047: {
2048: //if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
2049: yystate = YYFINAL; //explicitly say we're done
2050: state_push(YYFINAL); //and save it
2051: val_push(yyval); //also save the semantic value of parsing
2052: if (yychar < 0) //we want another character?
2053: {
2054: yychar = yylex(); //get next character
2055: //if (yychar<0) yychar=0; //clean, if necessary
2056: //if (yydebug)
2057: //yylexdebug(yystate,yychar);
2058: }
2059: if (yychar == 0) //Good exit (if lex returns 0 ;-)
2060: break; //quit the loop--all DONE
2061: }//if yystate
2062: else //else not done yet
2063: { //get next state and push, for next yydefred[]
2064: yyn = yygindex[yym]; //find out where to go
2065: if ((yyn != 0) && (yyn += yystate) >= 0
2066: && yyn <= YYTABLESIZE
2067: && yycheck[yyn] == yystate)
2068: yystate = yytable[yyn]; //get new state
2069: else
2070: yystate = yydgoto[yym]; //else go to new defred
2071: //if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
2072: state_push(yystate); //going again, so push state & val...
2073: val_push(yyval); //for next action
2074: }
2075: }//main loop
2076: return 0;//yyaccept!!
2077: }
2078: //## end of method parse() ######################################
2079:
2080: //## run() --- for Thread #######################################
2081: //## The -Jnorun option was used ##
2082: //## end of method run() ########################################
2083:
2084: //## Constructors ###############################################
2085: //## The -Jnoconstruct option was used ##
2086: //###############################################################
2087:
2088: }
2089: //################### END OF CLASS ##############################
|