1 2 package com.hp.hpl.jena.rdf.arp; 3 4 import java.util.*; 5 import org.xml.sax.SAXException ; 6 7 class RDFParser implements ARPErrorNumbers, RDFParserConstants { 8 38 39 40 41 static { 42 tokenImage[A_ABOUT] = "attribute rdf:about"; 45 tokenImage[A_ID] = "attribute rdf:ID"; 46 tokenImage[A_NODEID] = "attribute rdf:nodeID"; 47 tokenImage[A_OTHER] = "property attributes"; 48 tokenImage[A_PARSETYPE] = "rdf:parseType"; 49 tokenImage[A_RESOURCE] = "attribute rdf:resource"; 50 tokenImage[A_TYPE] = "attribute rdf:type"; 51 tokenImage[A_DATATYPE] = "attribute rdf:datatype"; 52 tokenImage[A_RDF_N] = "attribute rdf:rdf_NNN"; 53 tokenImage[A_XMLLANG] = "attribute xml:lang"; 54 tokenImage[A_XMLSPACE] = "attribute xml:space"; 55 tokenImage[A_XMLBASE] = "attribute xml:base"; 56 tokenImage[AV_RESOURCE] = "'Resource'"; 57 tokenImage[AV_LITERAL] = "'Literal'"; 58 tokenImage[AV_STRING] = "attribute value"; 59 tokenImage[CD_STRING] = "XML ELEMENT CONTENT"; 60 tokenImage[E_DESCRIPTION] = "start element rdf:Description"; 61 tokenImage[E_END] = "end element tag"; 62 tokenImage[E_LI] = "start element rdf:li"; 63 tokenImage[E_OTHER] = "general start element tag"; 64 tokenImage[E_RDF] = "start element rdf:RDF"; 65 tokenImage[E_RDF_N] = "start element rdf:rdf_NNN"; 66 tokenImage[AV_DAMLCOLLECTION] = "'daml:collection'"; 67 tokenImage[AV_COLLECTION] = "'Collection'"; 68 tokenImage[COMMENT]= "XML comment"; 69 tokenImage[PROCESSING_INSTRUCTION]="processing instruction"; 70 tokenImage[A_XMLNS]="namespace declaration"; 71 tokenImage[X_WARNING] = ""; tokenImage[X_SAX_EX] = ""; } 74 75 XMLHandler arp; 76 ParserSupport X; 77 Token startAttr; 79 RDFParser(TokenPipe pipe, XMLHandler arp) { 80 this(pipe); 81 this.arp = arp; 82 X = new ParserSupport(arp); 83 } 84 85 94 final public void rdfFile(XMLContext ctxt) throws ParseException { 98 whiteOrErr(); 99 rdfFileSub(ctxt); 100 white1(false); 101 } 102 103 final public void rdfFileSub(XMLContext ctxt) throws ParseException { 104 ARPResource r = null; 105 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 106 case E_RDF: 107 rdf(ctxt); 108 break; 109 case E_DESCRIPTION: 110 case E_OTHER: 111 case E_LI: 112 case E_RDF_N: 113 try { 114 arp.startRDF(); 115 r = obj(ctxt); 116 } finally { 117 arp.endLocalScope(r); 118 arp.endRDF(); 119 } 120 break; 121 default: 122 jj_la1[0] = jj_gen; 123 jj_consume_token(-1); 124 throw new ParseException(); 125 } 126 } 127 128 final public void zwhite(boolean suggestParseType) throws ParseException { 129 if (suggestParseType) { 130 xwhite(); 131 } else { 132 white(); 133 } 134 } 135 136 final public void white() throws ParseException { 137 white1(true); 138 } 139 140 final public void xwhite() throws ParseException { 141 label_1: 142 while (true) { 143 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 144 case CD_STRING: 145 case PROCESSING_INSTRUCTION: 146 case COMMENT: 147 case X_SAX_EX: 148 ; 149 break; 150 default: 151 jj_la1[1] = jj_gen; 152 break label_1; 153 } 154 xOneWhite(); 155 } 156 } 157 158 final public void white1(boolean warnOnPi) throws ParseException { 159 label_2: 160 while (true) { 161 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 162 case CD_STRING: 163 case PROCESSING_INSTRUCTION: 164 case COMMENT: 165 case X_SAX_EX: 166 ; 167 break; 168 default: 169 jj_la1[2] = jj_gen; 170 break label_2; 171 } 172 oneWhite(warnOnPi); 173 } 174 } 175 176 final public void whiteOrErr() throws ParseException { 177 label_3: 178 while (true) { 179 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 180 case CD_STRING: 181 case PROCESSING_INSTRUCTION: 182 case COMMENT: 183 case X_SAX_EX: 184 case X_WARNING: 185 ; 186 break; 187 default: 188 jj_la1[3] = jj_gen; 189 break label_3; 190 } 191 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 192 case CD_STRING: 193 case PROCESSING_INSTRUCTION: 194 case COMMENT: 195 case X_SAX_EX: 196 oneWhite(false); 197 break; 198 case X_WARNING: 199 warning(); 200 break; 201 default: 202 jj_la1[4] = jj_gen; 203 jj_consume_token(-1); 204 throw new ParseException(); 205 } 206 } 207 } 208 209 final public void xOneWhite() throws ParseException { 210 Token w; 211 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 212 case CD_STRING: 213 w = jj_consume_token(CD_STRING); 214 X.checkWhite((StrToken)w,true); 215 break; 216 case PROCESSING_INSTRUCTION: 217 w = jj_consume_token(PROCESSING_INSTRUCTION); 219 X.processingInstruction(w,true); 220 break; 221 case COMMENT: 222 jj_consume_token(COMMENT); 223 break; 224 case X_SAX_EX: 225 saxEx(); 226 break; 227 default: 228 jj_la1[5] = jj_gen; 229 jj_consume_token(-1); 230 throw new ParseException(); 231 } 232 } 233 234 final public void oneWhite(boolean warnOnPi) throws ParseException { 235 Token w; 236 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 237 case CD_STRING: 238 w = jj_consume_token(CD_STRING); 239 X.checkWhite((StrToken)w,false); 240 break; 241 case PROCESSING_INSTRUCTION: 242 pi(warnOnPi); 243 break; 244 case COMMENT: 245 jj_consume_token(COMMENT); 246 break; 247 case X_SAX_EX: 248 saxEx(); 249 break; 250 default: 251 jj_la1[6] = jj_gen; 252 jj_consume_token(-1); 253 throw new ParseException(); 254 } 255 } 256 257 final public Token saxEx() throws ParseException { 258 Token rslt; 259 rslt = jj_consume_token(X_SAX_EX); 260 X.saxException(rslt); 261 {if (true) return rslt;} 262 throw new Error ("Missing return statement in function"); 263 } 264 265 final public void empty() throws ParseException { 266 label_4: 267 while (true) { 268 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 269 case PROCESSING_INSTRUCTION: 270 case COMMENT: 271 ; 272 break; 273 default: 274 jj_la1[7] = jj_gen; 275 break label_4; 276 } 277 oneEmpty(); 278 } 279 } 280 281 final public void oneEmpty() throws ParseException { 282 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 283 case PROCESSING_INSTRUCTION: 284 pi(true); 285 break; 286 case COMMENT: 287 jj_consume_token(COMMENT); 288 break; 289 default: 290 jj_la1[8] = jj_gen; 291 jj_consume_token(-1); 292 throw new ParseException(); 293 } 294 } 295 296 final public Token pi(boolean warnOnPi) throws ParseException { 297 Token w; 298 w = jj_consume_token(PROCESSING_INSTRUCTION); 299 if (warnOnPi) X.processingInstruction(w,false); 300 {if (true) return w;} 301 throw new Error ("Missing return statement in function"); 302 } 303 304 305 final public void rdf(XMLContext ctxt) throws ParseException { 306 ARPResource r = null; 307 try { 308 jj_consume_token(E_RDF); 309 arp.startRDF(); 310 ctxt = xmlAttrs(ctxt); 311 white(); 312 label_5: 313 while (true) { 314 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 315 case E_DESCRIPTION: 316 case E_OTHER: 317 case E_LI: 318 case E_RDF_N: 319 ; 320 break; 321 default: 322 jj_la1[9] = jj_gen; 323 break label_5; 324 } 325 try { 326 r = obj(ctxt); 327 } finally { 328 arp.endLocalScope(r); 329 r = null; 330 } 331 white(); 332 } 333 jj_consume_token(E_END); 334 } catch (ParseException e) { 335 error_recovery(e); 336 } finally { 337 arp.endRDF(); 338 } 339 } 340 341 342 final public ARPResource obj(XMLContext ctxt) throws ParseException { 343 ARPResource r = 344 new ARPResource(arp); 345 try { 346 description(ctxt,r,false); 347 {if (true) return r;} 348 } catch (ParseException e) { 349 arp.endLocalScope(r); 350 {if (true) throw e;} 351 } catch (RuntimeException e) { 352 arp.endLocalScope(r); 353 {if (true) throw e;} 354 } 355 throw new Error ("Missing return statement in function"); 356 } 357 358 final public ARPResource xobj(XMLContext ctxt) throws ParseException { 359 ARPResource r = 360 new ARPResource(arp); 361 try { 362 description(ctxt,r,true); 363 jj_scanpos = jj_lastpos = null; 365 {if (true) return r;} 366 } catch (ParseException e) { 367 arp.endLocalScope(r); 368 {if (true) throw e;} 369 } catch (RuntimeException e) { 370 arp.endLocalScope(r); 371 {if (true) throw e;} 372 } 373 throw new Error ("Missing return statement in function"); 374 } 375 376 380 final public void description(XMLContext ctxt, ARPResource r, boolean suggestParseType) throws ParseException { 381 try { 382 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 383 case E_DESCRIPTION: 384 jj_consume_token(E_DESCRIPTION); 385 ctxt = xmlAttrs(ctxt); 386 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 387 case A_ID: 388 case A_ABOUT: 389 case A_NODEID: 390 idAboutAttr(ctxt,r); 391 break; 392 default: 393 jj_la1[10] = jj_gen; 394 ; 395 } 396 label_6: 397 while (true) { 398 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 399 case A_OTHER: 400 case A_RDF_N: 401 case A_TYPE: 402 ; 403 break; 404 default: 405 jj_la1[11] = jj_gen; 406 break label_6; 407 } 408 propAttr(ctxt,r); 409 } 410 zwhite(suggestParseType); 411 label_7: 412 while (true) { 413 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 414 case E_OTHER: 415 case E_LI: 416 case E_RDF_N: 417 ; 418 break; 419 default: 420 jj_la1[12] = jj_gen; 421 break label_7; 422 } 423 propertyElt(ctxt,r); 424 zwhite(suggestParseType); 425 } 426 jj_scanpos = jj_lastpos = null; 428 jj_consume_token(E_END); 429 break; 430 case E_OTHER: 431 case E_LI: 432 case E_RDF_N: 433 typedNode(ctxt,r,suggestParseType); 434 break; 435 default: 436 jj_la1[13] = jj_gen; 437 jj_consume_token(-1); 438 throw new ParseException(); 439 } 440 } catch (ParseException e) { 441 error_recovery(e); 442 } 443 } 444 445 448 final public void idAboutAttr(XMLContext ctxt,ARPResource r) throws ParseException { 449 String s; 450 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 451 case A_ID: 452 s = idAttr(ctxt); 453 r.setAbout(s); 454 break; 455 case A_ABOUT: 456 aboutAttr(ctxt,r); 457 break; 458 case A_NODEID: 459 nodeIdAttr(ctxt,r); 460 break; 461 default: 462 jj_la1[14] = jj_gen; 463 jj_consume_token(-1); 464 throw new ParseException(); 465 } 466 } 467 468 471 final public String idAttr(XMLContext ctxt) throws ParseException { 472 String s; 473 jj_consume_token(A_ID); 474 s = idSymbol(ctxt); 475 label_8: 476 while (true) { 477 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 478 case X_WARNING: 479 ; 480 break; 481 default: 482 jj_la1[15] = jj_gen; 483 break label_8; 484 } 485 warning(); 486 } 487 {if (true) return s;} 488 throw new Error ("Missing return statement in function"); 489 } 490 491 494 final public void aboutAttr(XMLContext ctxt,ARPResource r) throws ParseException { 495 URIReference u; 496 jj_consume_token(A_ABOUT); 497 u = uriReference(ctxt); 498 label_9: 499 while (true) { 500 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 501 case X_WARNING: 502 ; 503 break; 504 default: 505 jj_la1[16] = jj_gen; 506 break label_9; 507 } 508 warning(); 509 } 510 r.setAbout(u); 511 } 512 513 516 final public void nodeIdAttr(XMLContext ctxt,ARPResource r) throws ParseException { 517 Token t; 518 jj_consume_token(A_NODEID); 519 t = jj_consume_token(AV_STRING); 520 label_10: 521 while (true) { 522 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 523 case X_WARNING: 524 ; 525 break; 526 default: 527 jj_la1[17] = jj_gen; 528 break label_10; 529 } 530 warning(); 531 } 532 r.setNodeId(X.checkNodeID(t)); 533 } 534 535 539 final public void propAttr(XMLContext ctxt,ARPResource r) throws ParseException { 540 Token str; 541 Token prop; 542 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 543 case A_TYPE: 544 typeAttr(ctxt,r); 545 break; 546 case A_OTHER: 547 prop = jj_consume_token(A_OTHER); 549 str = jj_consume_token(AV_STRING); 550 label_11: 551 while (true) { 552 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 553 case X_WARNING: 554 ; 555 break; 556 default: 557 jj_la1[18] = jj_gen; 558 break label_11; 559 } 560 warning(); 561 } 562 X.checkString(str); 563 r.setPredicateObject( 564 ((ARPQname)prop) 565 .asURIReference(arp), 566 new ARPString((StrToken)str, 567 ctxt.getLang()) ); 568 break; 569 case A_RDF_N: 570 prop = jj_consume_token(A_RDF_N); 572 str = jj_consume_token(AV_STRING); 573 label_12: 574 while (true) { 575 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 576 case X_WARNING: 577 ; 578 break; 579 default: 580 jj_la1[19] = jj_gen; 581 break label_12; 582 } 583 warning(); 584 } 585 X.checkString(str); 586 r.setPredicateObject( 587 ((ARPQname)prop) 588 .asURIReference(arp), 589 new ARPString((StrToken)str, 590 ctxt.getLang()) ); 591 break; 592 default: 593 jj_la1[20] = jj_gen; 594 jj_consume_token(-1); 595 throw new ParseException(); 596 } 597 } 598 599 602 final public void typeAttr(XMLContext ctxt,ARPResource r) throws ParseException { 603 URIReference u; 604 jj_consume_token(A_TYPE); 605 u = uriReference(ctxt); 606 label_13: 607 while (true) { 608 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 609 case X_WARNING: 610 ; 611 break; 612 default: 613 jj_la1[21] = jj_gen; 614 break label_13; 615 } 616 warning(); 617 } 618 r.setType(u); 619 } 620 621 641 final public void propertyElt(XMLContext ctxt,ARPResource r) throws ParseException { 642 Token p; 643 try { 644 p = propertyEltTag(); 645 p = (Token)p.clone(); 646 p.next = null; 650 ctxt = xmlAttrs(ctxt); 651 propertyEltIdAndValue(ctxt, r, p); 652 jj_consume_token(E_END); 653 } catch (ParseException e) { 654 error_recovery(e); 655 } 656 } 657 658 final public Token propertyEltTag() throws ParseException { 659 Token p; 660 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 661 case E_OTHER: 662 p = jj_consume_token(E_OTHER); 663 {if (true) return p;} 664 break; 665 case E_LI: 666 p = jj_consume_token(E_LI); 668 {if (true) return p;} 669 break; 670 case E_RDF_N: 671 p = jj_consume_token(E_RDF_N); 673 {if (true) return p;} 674 break; 675 default: 676 jj_la1[22] = jj_gen; 677 jj_consume_token(-1); 678 throw new ParseException(); 679 } 680 throw new Error ("Missing return statement in function"); 681 } 682 683 final public void propertyEltIdAndValue(XMLContext ctxt,ARPResource r, Token p) throws ParseException { 684 String reify = null; 685 Object v; 686 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 687 case A_ID: 688 reify = idAttr(ctxt); 689 break; 690 default: 691 jj_la1[23] = jj_gen; 692 ; 693 } 694 v = propEltValue(ctxt); 695 try { 696 X.createTriple(r, p, v, reify ); 697 jj_scanpos = jj_lastpos = null; 699 } 700 finally { 701 arp.endLocalScope(v); 702 703 } 704 } 705 706 final public Object propEltValue(XMLContext ctxt) throws ParseException { 707 String xml; 708 Object v; 709 Token parseType; 710 String parseTypeVal; 711 ARPResource ptr; 712 AResourceInternal daml[]; 713 ARPString dtLex; 714 URIReference dtURI; 715 Location wh; 716 if (jj_2_1(2)) { 717 jj_consume_token(A_PARSETYPE); 718 parseType = jj_consume_token(AV_LITERAL); 719 parseTypeVal = 720 ((StrToken)parseType).value; 721 wh = parseType.location; 725 parseType = null; 726 label_14: 727 while (true) { 728 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 729 case X_WARNING: 730 ; 731 break; 732 default: 733 jj_la1[24] = jj_gen; 734 break label_14; 735 } 736 warning(); 737 } 738 xml = litValue(ctxt.getNamespaces(),wh); 739 {if (true) return 740 new ARPString(xml, 741 ctxt.getLang(), 742 parseTypeVal );} 743 } else if (jj_2_2(2)) { 744 jj_consume_token(A_PARSETYPE); 745 jj_consume_token(AV_DAMLCOLLECTION); 746 daml = new AResourceInternal[1]; 747 label_15: 748 while (true) { 749 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 750 case X_WARNING: 751 ; 752 break; 753 default: 754 jj_la1[25] = jj_gen; 755 break label_15; 756 } 757 warning(); 758 } 759 white(); 760 collection(ctxt, 761 X.damlCollectionAction(daml)); 762 {if (true) return daml[0];} 763 } else if (jj_2_3(2)) { 764 jj_consume_token(A_PARSETYPE); 765 jj_consume_token(AV_COLLECTION); 766 daml = new AResourceInternal[1]; 767 label_16: 768 while (true) { 769 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 770 case X_WARNING: 771 ; 772 break; 773 default: 774 jj_la1[26] = jj_gen; 775 break label_16; 776 } 777 warning(); 778 } 779 white(); 780 collection(ctxt, 781 X.collectionAction(daml)); 782 {if (true) return daml[0];} 783 } else { 784 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 785 case A_DATATYPE: 786 dtURI = datatypeAttr(ctxt); 788 dtLex = string(ctxt); 789 {if (true) return X.createDatatypeLiteral(dtURI,dtLex);} 790 break; 791 case A_NODEID: 792 case A_OTHER: 793 case A_RDF_N: 794 case A_TYPE: 795 case A_PARSETYPE: 796 case A_RESOURCE: 797 ptr = new ARPResource(arp); 798 try { 799 propEltValueWithRes(ctxt,ptr); 800 {if (true) return ptr;} 801 } catch (ParseException e) { 802 arp.endLocalScope(ptr); 803 {if (true) throw e;} 804 } catch (RuntimeException e) { 805 arp.endLocalScope(ptr); 806 {if (true) throw e;} 807 } 808 break; 809 default: 810 jj_la1[27] = jj_gen; 811 v = value(ctxt); 813 {if (true) return v;} 814 } 815 } 816 throw new Error ("Missing return statement in function"); 817 } 818 819 final public void propEltValueWithRes(XMLContext ctxt, ARPResource ptr) throws ParseException { 820 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 821 case A_PARSETYPE: 822 jj_consume_token(A_PARSETYPE); 823 jj_consume_token(AV_RESOURCE); 824 label_17: 825 while (true) { 826 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 827 case X_WARNING: 828 ; 829 break; 830 default: 831 jj_la1[28] = jj_gen; 832 break label_17; 833 } 834 warning(); 835 } 836 white(); 837 label_18: 838 while (true) { 839 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 840 case E_OTHER: 841 case E_LI: 842 case E_RDF_N: 843 ; 844 break; 845 default: 846 jj_la1[29] = jj_gen; 847 break label_18; 848 } 849 propertyElt(ctxt,ptr); 850 white(); 851 } 852 break; 853 case A_NODEID: 854 case A_RESOURCE: 855 resourceOrNodeIdAttr(ctxt,ptr); 856 label_19: 857 while (true) { 858 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 859 case A_OTHER: 860 case A_RDF_N: 861 case A_TYPE: 862 ; 863 break; 864 default: 865 jj_la1[30] = jj_gen; 866 break label_19; 867 } 868 propAttr(ctxt,ptr); 869 } 870 empty(); 871 break; 872 case A_OTHER: 873 case A_RDF_N: 874 case A_TYPE: 875 label_20: 876 while (true) { 877 propAttr(ctxt,ptr); 878 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 879 case A_OTHER: 880 case A_RDF_N: 881 case A_TYPE: 882 ; 883 break; 884 default: 885 jj_la1[31] = jj_gen; 886 break label_20; 887 } 888 } 889 empty(); 890 break; 891 default: 892 jj_la1[32] = jj_gen; 893 jj_consume_token(-1); 894 throw new ParseException(); 895 } 896 } 897 898 final public void collection(XMLContext ctxt, CollectionAction act) throws ParseException { 899 CollectionAction firstAct = act; 900 try { 901 label_21: 902 while (true) { 903 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 904 case E_DESCRIPTION: 905 case E_OTHER: 906 case E_LI: 907 case E_RDF_N: 908 ; 909 break; 910 default: 911 jj_la1[33] = jj_gen; 912 break label_21; 913 } 914 act = objInCollection(ctxt,act); 915 } 916 act.terminate(); 917 } catch (RuntimeException e) { 918 firstAct.cleanUp(); 919 act.cleanUp(); 920 {if (true) throw e;} 921 } catch (ParseException e) { 922 firstAct.cleanUp(); 923 act.cleanUp(); 924 {if (true) throw e;} 925 } 926 } 927 928 final public CollectionAction objInCollection(XMLContext ctxt, CollectionAction act) throws ParseException { 929 ARPResource head; 930 CollectionAction rslt; 931 head = obj(ctxt); 932 rslt = act.next( head ); 933 white(); 934 {if (true) return rslt;} 935 throw new Error ("Missing return statement in function"); 936 } 937 938 945 final public void typedNode(XMLContext ctxt, ARPResource r, boolean suggestParseType) throws ParseException { 946 Token type; 947 type = typedNodeTag(); 948 type = (Token)type.clone(); 949 type.next = null; 950 ctxt = xmlAttrs(ctxt); 951 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 952 case A_ID: 953 case A_ABOUT: 954 case A_NODEID: 955 idAboutAttr(ctxt,r); 956 break; 957 default: 958 jj_la1[34] = jj_gen; 959 ; 960 } 961 r.setType( 962 ((ARPQname)type) 963 .asURIReference(arp)); 964 label_22: 965 while (true) { 966 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 967 case A_OTHER: 968 case A_RDF_N: 969 case A_TYPE: 970 ; 971 break; 972 default: 973 jj_la1[35] = jj_gen; 974 break label_22; 975 } 976 propAttr(ctxt,r); 977 } 978 zwhite(suggestParseType); 979 label_23: 980 while (true) { 981 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 982 case E_OTHER: 983 case E_LI: 984 case E_RDF_N: 985 ; 986 break; 987 default: 988 jj_la1[36] = jj_gen; 989 break label_23; 990 } 991 propertyElt(ctxt,r); 992 zwhite(suggestParseType); 993 } 994 jj_consume_token(E_END); 995 } 996 997 final public Token typedNodeTag() throws ParseException { 998 Token rslt; 999 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1000 case E_OTHER: 1001 rslt = jj_consume_token(E_OTHER); 1002 {if (true) return rslt;} 1003 break; 1004 case E_RDF_N: 1005 rslt = jj_consume_token(E_RDF_N); 1007 arp.parseWarning( 1008 WARN_RDF_NN_AS_TYPE, 1009 rslt.location, 1010 ((ARPQname)rslt).qName + 1011 " is being used as a type." 1012 ); 1013 {if (true) return rslt;} 1014 break; 1015 case E_LI: 1016 rslt = jj_consume_token(E_LI); 1018 arp.parseWarning( 1019 ERR_LI_AS_TYPE, 1020 rslt.location, 1021 ((ARPQname)rslt).qName + 1022 " is being used as a type." 1023 ); 1024 {if (true) return rslt;} 1025 break; 1026 default: 1027 jj_la1[37] = jj_gen; 1028 jj_consume_token(-1); 1029 throw new ParseException(); 1030 } 1031 throw new Error ("Missing return statement in function"); 1032 } 1033 1034 1048 final public Object value(XMLContext ctxt) throws ParseException { 1049 Object rslt; 1050 if (jj_2_4(2147483647)) { 1051 rslt = string(ctxt); 1052 jj_scanpos = jj_lastpos = null; 1054 {if (true) return rslt;} 1055 } else { 1056 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1057 case CD_STRING: 1058 case PROCESSING_INSTRUCTION: 1059 case COMMENT: 1060 case X_SAX_EX: 1061 case E_DESCRIPTION: 1062 case E_OTHER: 1063 case E_LI: 1064 case E_RDF_N: 1065 xwhite(); 1066 jj_scanpos = jj_lastpos = null; 1068 rslt = xobj(ctxt); 1069 try { 1070 xwhite(); 1071 {if (true) return rslt;} 1072 } catch (ParseException pe) { 1073 arp.endLocalScope(rslt); 1074 {if (true) throw pe;} 1075 } catch (RuntimeException e) { 1076 arp.endLocalScope(rslt); 1077 {if (true) throw e;} 1078 } 1079 break; 1080 default: 1081 jj_la1[38] = jj_gen; 1082 jj_consume_token(-1); 1083 throw new ParseException(); 1084 } 1085 } 1086 throw new Error ("Missing return statement in function"); 1087 } 1088 1089 1092 final public void resourceAttr(XMLContext ctxt, ARPResource r) throws ParseException { 1093 URIReference u; 1094 jj_consume_token(A_RESOURCE); 1095 u = uriReference(ctxt); 1096 label_24: 1097 while (true) { 1098 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1099 case X_WARNING: 1100 ; 1101 break; 1102 default: 1103 jj_la1[39] = jj_gen; 1104 break label_24; 1105 } 1106 warning(); 1107 } 1108 r.setAbout(u); 1109 } 1110 1111 1114 final public URIReference datatypeAttr(XMLContext ctxt) throws ParseException { 1115 URIReference u; 1116 jj_consume_token(A_DATATYPE); 1117 u = uriReference(ctxt); 1118 label_25: 1119 while (true) { 1120 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1121 case X_WARNING: 1122 ; 1123 break; 1124 default: 1125 jj_la1[40] = jj_gen; 1126 break label_25; 1127 } 1128 warning(); 1129 } 1130 {if (true) return u;} 1131 throw new Error ("Missing return statement in function"); 1132 } 1133 1134 final public void resourceOrNodeIdAttr(XMLContext ctxt, ARPResource r) throws ParseException { 1135 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1136 case A_RESOURCE: 1137 resourceAttr(ctxt,r); 1138 break; 1139 case A_NODEID: 1140 nodeIdAttr(ctxt,r); 1141 break; 1142 default: 1143 jj_la1[41] = jj_gen; 1144 jj_consume_token(-1); 1145 throw new ParseException(); 1146 } 1147 } 1148 1149 1154 final public URIReference uriReference(XMLContext ctxt) throws ParseException { 1155 Token t; 1156 t = jj_consume_token(AV_STRING); 1157 {if (true) return X.makeURIReference(ctxt,t);} 1158 throw new Error ("Missing return statement in function"); 1159 } 1160 1161 1166 final public String idSymbol(XMLContext ctxt) throws ParseException { 1167 Token t; 1168 t = jj_consume_token(AV_STRING); 1169 StrToken strtok = (StrToken)t; 1170 String rslt = ctxt.resolveSameDocRef(t.location, "#"+ strtok.value); 1171 X.checkIdSymbol(ctxt,strtok,rslt); 1172 {if (true) return rslt;} 1173 throw new Error ("Missing return statement in function"); 1174 } 1175 1176 1183 final public ARPString string(XMLContext ctxt) throws ParseException { 1184 Vector pieces = new Vector(); 1185 Token tok = null; 1186 boolean checkComposingChar[] = new boolean[]{true}; 1187 label_26: 1188 while (true) { 1189 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1190 case CD_STRING: 1191 case PROCESSING_INSTRUCTION: 1192 case COMMENT: 1193 case X_SAX_EX: 1194 ; 1195 break; 1196 default: 1197 jj_la1[42] = jj_gen; 1198 break label_26; 1199 } 1200 tok = string1(pieces,checkComposingChar); 1201 } 1202 ARPString rslt = 1203 new ARPString(pieces,ctxt.getLang()); 1204 X.checkNormalFormC(tok,rslt); 1205 {if (true) return rslt;} 1206 throw new Error ("Missing return statement in function"); 1207 } 1208 1209 final public Token string1(Vector rslts, boolean checkComposingChar[]) throws ParseException { 1210 Token rslt; 1211 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1212 case CD_STRING: 1213 rslt = jj_consume_token(CD_STRING); 1214 if (checkComposingChar[0]) 1215 X.checkComposingChar(rslt); 1216 checkComposingChar[0] = false; 1217 rslts.add(rslt); 1218 {if (true) return rslt;} 1219 break; 1220 case COMMENT: 1221 rslt = jj_consume_token(COMMENT); 1222 checkComposingChar[0] = true; 1223 {if (true) return rslt;} 1224 break; 1225 case PROCESSING_INSTRUCTION: 1226 rslt = pi(true); 1227 checkComposingChar[0] = true; 1228 {if (true) return rslt;} 1229 break; 1230 case X_SAX_EX: 1231 rslt = saxEx(); 1233 {if (true) return rslt;} 1234 break; 1235 default: 1236 jj_la1[43] = jj_gen; 1237 jj_consume_token(-1); 1238 throw new ParseException(); 1239 } 1240 throw new Error ("Missing return statement in function"); 1241 } 1242 1243 1247 final public XMLContext xmlAttrs(XMLContext ctxt) throws ParseException { 1248 startAttr = getToken(1); 1249 label_27: 1250 while (true) { 1251 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1252 case A_XMLNS: 1253 case X_WARNING: 1254 ; 1255 break; 1256 default: 1257 jj_la1[44] = jj_gen; 1258 break label_27; 1259 } 1260 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1261 case X_WARNING: 1262 warning(); 1263 break; 1264 case A_XMLNS: 1265 ctxt = xmlns(ctxt); 1266 break; 1267 default: 1268 jj_la1[45] = jj_gen; 1269 jj_consume_token(-1); 1270 throw new ParseException(); 1271 } 1272 } 1273 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1274 case A_XMLBASE: 1275 ctxt = xmlBase(ctxt); 1276 label_28: 1277 while (true) { 1278 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1279 case X_WARNING: 1280 ; 1281 break; 1282 default: 1283 jj_la1[46] = jj_gen; 1284 break label_28; 1285 } 1286 warning(); 1287 } 1288 break; 1289 default: 1290 jj_la1[47] = jj_gen; 1291 ; 1292 } 1293 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1294 case A_XMLLANG: 1295 ctxt = xmlLang(ctxt); 1296 label_29: 1297 while (true) { 1298 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1299 case X_WARNING: 1300 ; 1301 break; 1302 default: 1303 jj_la1[48] = jj_gen; 1304 break label_29; 1305 } 1306 warning(); 1307 } 1308 break; 1309 default: 1310 jj_la1[49] = jj_gen; 1311 ; 1312 } 1313 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1314 case A_XMLSPACE: 1315 jj_consume_token(A_XMLSPACE); 1316 jj_consume_token(AV_STRING); 1317 label_30: 1318 while (true) { 1319 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1320 case X_WARNING: 1321 ; 1322 break; 1323 default: 1324 jj_la1[50] = jj_gen; 1325 break label_30; 1326 } 1327 warning(); 1328 } 1329 break; 1330 default: 1331 jj_la1[51] = jj_gen; 1332 ; 1333 } 1334 {if (true) return ctxt;} 1335 throw new Error ("Missing return statement in function"); 1336 } 1337 1338 final public XMLContext xmlns(XMLContext ctxt) throws ParseException { 1339 Token prefix, uri; 1340 prefix = jj_consume_token(A_XMLNS); 1341 uri = jj_consume_token(AV_STRING); 1342 X.checkNamespaceURI(uri); 1343 {if (true) return ctxt.addNamespace(prefix,uri);} 1344 throw new Error ("Missing return statement in function"); 1345 } 1346 1347 final public XMLContext xmlBase(XMLContext ctxt) throws ParseException { 1348 Token t; 1349 jj_consume_token(A_XMLBASE); 1350 t = jj_consume_token(AV_STRING); 1351 {if (true) return X.changeXMLBase(ctxt, t);} 1352 throw new Error ("Missing return statement in function"); 1353 } 1354 1355 final public XMLContext xmlLang(XMLContext ctxt) throws ParseException { 1356 Token t; 1357 jj_consume_token(A_XMLLANG); 1358 t = jj_consume_token(AV_STRING); 1359 StrToken rslt = (StrToken)t; 1360 X.checkXMLLang(rslt); 1361 {if (true) return ctxt.withLang(rslt.value);} 1362 throw new Error ("Missing return statement in function"); 1363 } 1364 1365 final public void warning() throws ParseException { 1369 Token t; 1370 t = jj_consume_token(X_WARNING); 1371 arp.parseWarning((Warn)t); 1372 } 1373 1374 1376 final public void embeddedFile(XMLContext ctxt) throws ParseException { 1379 whiteOrErr(); 1380 root(ctxt); 1381 white1(false); 1382 } 1383 1384 final public void root(XMLContext ctxt) throws ParseException { 1385 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1386 case E_RDF: 1387 rdf(ctxt); 1388 break; 1389 case E_DESCRIPTION: 1390 case E_OTHER: 1391 case E_LI: 1392 case E_RDF_N: 1393 element(ctxt); 1394 break; 1395 default: 1396 jj_la1[52] = jj_gen; 1397 jj_consume_token(-1); 1398 throw new ParseException(); 1399 } 1400 } 1401 1402 final public void element(XMLContext ctxt) throws ParseException { 1404 startElement(); 1405 label_31: 1406 while (true) { 1407 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1408 case X_WARNING: 1409 ; 1410 break; 1411 default: 1412 jj_la1[53] = jj_gen; 1413 break label_31; 1414 } 1415 nowarning(); 1416 } 1417 ctxt = xmlAttrsNoWarnings(ctxt); 1418 jj_scanpos = jj_lastpos = null; 1420 label_32: 1421 while (true) { 1422 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1423 case A_ID: 1424 case A_ABOUT: 1425 case A_NODEID: 1426 case A_OTHER: 1427 case A_RDF_N: 1428 case A_TYPE: 1429 case A_PARSETYPE: 1430 case A_RESOURCE: 1431 case A_DATATYPE: 1432 ; 1433 break; 1434 default: 1435 jj_la1[54] = jj_gen; 1436 break label_32; 1437 } 1438 attr(); 1439 } 1440 label_33: 1441 while (true) { 1442 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1443 case CD_STRING: 1444 case PROCESSING_INSTRUCTION: 1445 case COMMENT: 1446 case X_SAX_EX: 1447 case E_RDF: 1448 case E_DESCRIPTION: 1449 case E_OTHER: 1450 case E_LI: 1451 case E_RDF_N: 1452 ; 1453 break; 1454 default: 1455 jj_la1[55] = jj_gen; 1456 break label_33; 1457 } 1458 content(ctxt); 1459 } 1460 jj_consume_token(E_END); 1461 } 1462 1463 final public void attr() throws ParseException { 1464 attrName(); 1465 attrValue(); 1466 label_34: 1467 while (true) { 1468 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1469 case X_WARNING: 1470 ; 1471 break; 1472 default: 1473 jj_la1[56] = jj_gen; 1474 break label_34; 1475 } 1476 nowarning(); 1477 } 1478 } 1479 1480 final public void nowarning() throws ParseException { 1482 jj_consume_token(X_WARNING); 1483 } 1484 1485 final public XMLContext xmlAttrsNoWarnings(XMLContext ctxt) throws ParseException { 1486 startAttr = getToken(1); 1487 label_35: 1488 while (true) { 1489 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1490 case A_XMLNS: 1491 case X_WARNING: 1492 ; 1493 break; 1494 default: 1495 jj_la1[57] = jj_gen; 1496 break label_35; 1497 } 1498 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1499 case X_WARNING: 1500 warning(); 1501 break; 1502 case A_XMLNS: 1503 ctxt = xmlns(ctxt); 1504 break; 1505 default: 1506 jj_la1[58] = jj_gen; 1507 jj_consume_token(-1); 1508 throw new ParseException(); 1509 } 1510 } 1511 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1512 case A_XMLBASE: 1513 ctxt = xmlBase(ctxt); 1514 label_36: 1515 while (true) { 1516 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1517 case X_WARNING: 1518 ; 1519 break; 1520 default: 1521 jj_la1[59] = jj_gen; 1522 break label_36; 1523 } 1524 nowarning(); 1525 } 1526 break; 1527 default: 1528 jj_la1[60] = jj_gen; 1529 ; 1530 } 1531 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1532 case A_XMLLANG: 1533 ctxt = xmlLang(ctxt); 1534 label_37: 1535 while (true) { 1536 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1537 case X_WARNING: 1538 ; 1539 break; 1540 default: 1541 jj_la1[61] = jj_gen; 1542 break label_37; 1543 } 1544 nowarning(); 1545 } 1546 break; 1547 default: 1548 jj_la1[62] = jj_gen; 1549 ; 1550 } 1551 {if (true) return ctxt;} 1552 throw new Error ("Missing return statement in function"); 1553 } 1554 1555 final public void content(XMLContext ctxt) throws ParseException { 1556 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1557 case E_RDF: 1558 rdf(ctxt); 1559 break; 1560 case CD_STRING: 1561 jj_consume_token(CD_STRING); 1562 break; 1563 case E_DESCRIPTION: 1564 case E_OTHER: 1565 case E_LI: 1566 case E_RDF_N: 1567 element(ctxt); 1568 break; 1569 case COMMENT: 1570 jj_consume_token(COMMENT); 1571 break; 1572 case PROCESSING_INSTRUCTION: 1573 jj_consume_token(PROCESSING_INSTRUCTION); 1574 break; 1575 case X_SAX_EX: 1576 saxEx(); 1577 break; 1578 default: 1579 jj_la1[63] = jj_gen; 1580 jj_consume_token(-1); 1581 throw new ParseException(); 1582 } 1583 } 1584 1585 final public void startElement() throws ParseException { 1586 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1587 case E_DESCRIPTION: 1588 jj_consume_token(E_DESCRIPTION); 1589 break; 1590 case E_LI: 1591 jj_consume_token(E_LI); 1592 break; 1593 case E_OTHER: 1594 jj_consume_token(E_OTHER); 1595 break; 1596 case E_RDF_N: 1597 jj_consume_token(E_RDF_N); 1598 break; 1599 default: 1600 jj_la1[64] = jj_gen; 1601 jj_consume_token(-1); 1602 throw new ParseException(); 1603 } 1604 } 1605 1606 final public Token litStartElement() throws ParseException { 1608 Token t; 1609 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1610 case E_DESCRIPTION: 1611 t = jj_consume_token(E_DESCRIPTION); 1613 {if (true) return t;} 1614 break; 1615 case E_LI: 1616 t = jj_consume_token(E_LI); 1617 {if (true) return t;} 1618 break; 1619 case E_OTHER: 1620 t = jj_consume_token(E_OTHER); 1621 {if (true) return t;} 1622 break; 1623 case E_RDF_N: 1624 t = jj_consume_token(E_RDF_N); 1625 {if (true) return t;} 1626 break; 1627 case E_RDF: 1628 t = jj_consume_token(E_RDF); 1629 {if (true) return t;} 1630 break; 1631 default: 1632 jj_la1[65] = jj_gen; 1633 jj_consume_token(-1); 1634 throw new ParseException(); 1635 } 1636 throw new Error ("Missing return statement in function"); 1637 } 1638 1639 final public Token litAttrName() throws ParseException { 1640 Token t; 1641 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1642 case A_ABOUT: 1643 t = jj_consume_token(A_ABOUT); 1645 {if (true) return t;} 1646 break; 1647 case A_ID: 1648 t = jj_consume_token(A_ID); 1649 {if (true) return t;} 1650 break; 1651 case A_OTHER: 1652 t = jj_consume_token(A_OTHER); 1653 {if (true) return t;} 1654 break; 1655 case A_PARSETYPE: 1656 t = jj_consume_token(A_PARSETYPE); 1657 {if (true) return t;} 1658 break; 1659 case A_DATATYPE: 1660 t = jj_consume_token(A_DATATYPE); 1661 {if (true) return t;} 1662 break; 1663 case A_NODEID: 1664 t = jj_consume_token(A_NODEID); 1665 {if (true) return t;} 1666 break; 1667 case A_RDF_N: 1668 t = jj_consume_token(A_RDF_N); 1669 {if (true) return t;} 1670 break; 1671 case A_RESOURCE: 1672 t = jj_consume_token(A_RESOURCE); 1673 {if (true) return t;} 1674 break; 1675 case A_TYPE: 1676 t = jj_consume_token(A_TYPE); 1677 {if (true) return t;} 1678 break; 1679 case A_XMLBASE: 1680 t = jj_consume_token(A_XMLBASE); 1681 {if (true) return t;} 1682 break; 1683 case A_XMLLANG: 1684 t = jj_consume_token(A_XMLLANG); 1685 {if (true) return t;} 1686 break; 1687 case A_XMLSPACE: 1688 t = jj_consume_token(A_XMLSPACE); 1689 {if (true) return t;} 1690 break; 1691 default: 1692 jj_la1[66] = jj_gen; 1693 jj_consume_token(-1); 1694 throw new ParseException(); 1695 } 1696 throw new Error ("Missing return statement in function"); 1697 } 1698 1699 final public void attrName() throws ParseException { 1700 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1701 case A_ABOUT: 1702 jj_consume_token(A_ABOUT); 1703 break; 1704 case A_ID: 1705 jj_consume_token(A_ID); 1706 break; 1707 case A_OTHER: 1708 jj_consume_token(A_OTHER); 1709 break; 1710 case A_PARSETYPE: 1711 jj_consume_token(A_PARSETYPE); 1712 break; 1713 case A_RDF_N: 1714 jj_consume_token(A_RDF_N); 1715 break; 1716 case A_RESOURCE: 1717 jj_consume_token(A_RESOURCE); 1718 break; 1719 case A_TYPE: 1720 jj_consume_token(A_TYPE); 1721 break; 1722 case A_NODEID: 1723 jj_consume_token(A_NODEID); 1724 break; 1725 case A_DATATYPE: 1726 jj_consume_token(A_DATATYPE); 1727 break; 1728 default: 1729 jj_la1[67] = jj_gen; 1730 jj_consume_token(-1); 1731 throw new ParseException(); 1732 } 1733 } 1734 1735 final public Token attrValue() throws ParseException { 1736 Token t; 1737 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1738 case AV_STRING: 1739 t = jj_consume_token(AV_STRING); 1741 {if (true) return t;} 1742 break; 1743 case AV_LITERAL: 1744 t = jj_consume_token(AV_LITERAL); 1745 {if (true) return t;} 1746 break; 1747 case AV_DAMLCOLLECTION: 1748 t = jj_consume_token(AV_DAMLCOLLECTION); 1749 {if (true) return t;} 1750 break; 1751 case AV_COLLECTION: 1752 t = jj_consume_token(AV_COLLECTION); 1753 {if (true) return t;} 1754 break; 1755 case AV_RESOURCE: 1756 t = jj_consume_token(AV_RESOURCE); 1757 {if (true) return t;} 1758 break; 1759 default: 1760 jj_la1[68] = jj_gen; 1761 jj_consume_token(-1); 1762 throw new ParseException(); 1763 } 1764 throw new Error ("Missing return statement in function"); 1765 } 1766 1767 1771 final public void litElement(StringBuffer val,Map allNs, Map ns) throws ParseException { 1772 Token t; 1773 SortedMap visiblyUsed = new TreeMap(); 1774 SortedMap attrs = new TreeMap(); 1775 t = litStartElement(); 1776 X.startLitElement(val, 1777 t, 1778 visiblyUsed); 1779 t = (Token)t.clone(); 1780 t.next = null; 1781 startAttr = getToken(1); 1782 label_38: 1783 while (true) { 1784 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1785 case X_WARNING: 1786 ; 1787 break; 1788 default: 1789 jj_la1[69] = jj_gen; 1790 break label_38; 1791 } 1792 nowarning(); 1793 } 1794 label_39: 1795 while (true) { 1796 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1797 case A_XMLNS: 1798 ; 1799 break; 1800 default: 1801 jj_la1[70] = jj_gen; 1802 break label_39; 1803 } 1804 allNs = litXmlns(allNs, visiblyUsed); 1805 } 1806 label_40: 1807 while (true) { 1808 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1809 case A_ID: 1810 case A_ABOUT: 1811 case A_NODEID: 1812 case A_OTHER: 1813 case A_RDF_N: 1814 case A_TYPE: 1815 case A_PARSETYPE: 1816 case A_RESOURCE: 1817 case A_DATATYPE: 1818 case A_XMLSPACE: 1819 case A_XMLBASE: 1820 case A_XMLLANG: 1821 ; 1822 break; 1823 default: 1824 jj_la1[71] = jj_gen; 1825 break label_40; 1826 } 1827 litAttr(attrs,visiblyUsed); 1828 } 1829 ns=X.litAttributes(val,attrs,visiblyUsed,ns,allNs,t); 1830 val.append('>'); 1831 label_41: 1832 while (true) { 1833 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1834 case CD_STRING: 1835 case PROCESSING_INSTRUCTION: 1836 case COMMENT: 1837 case X_SAX_EX: 1838 case E_RDF: 1839 case E_DESCRIPTION: 1840 case E_OTHER: 1841 case E_LI: 1842 case E_RDF_N: 1843 ; 1844 break; 1845 default: 1846 jj_la1[72] = jj_gen; 1847 break label_41; 1848 } 1849 litContent(val,allNs,ns); 1850 } 1851 jj_consume_token(E_END); 1852 X.endLitElement(val,t); 1853 } 1854 1855 final public Map litXmlns(Map ns, Map used) throws ParseException { 1856 Token prefix, uri; 1857 prefix = jj_consume_token(A_XMLNS); 1858 uri = jj_consume_token(AV_STRING); 1859 label_42: 1860 while (true) { 1861 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1862 case X_WARNING: 1863 ; 1864 break; 1865 default: 1866 jj_la1[73] = jj_gen; 1867 break label_42; 1868 } 1869 nowarning(); 1870 } 1871 {if (true) return X.litNamespace(prefix,uri,ns,used);} 1872 throw new Error ("Missing return statement in function"); 1873 } 1874 1875 final public void litAttr(Map attrs,Map visiblyUsed) throws ParseException { 1876 Token attr; Token val; String key; 1877 attr = litAttrName(); 1878 key=X.litAttrName( attr, 1879 visiblyUsed); 1880 val = attrValue(); 1881 attrs.put(key,X.litAttribute(attr,val)); 1882 label_43: 1883 while (true) { 1884 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1885 case X_WARNING: 1886 ; 1887 break; 1888 default: 1889 jj_la1[74] = jj_gen; 1890 break label_43; 1891 } 1892 nowarning(); 1893 } 1894 } 1895 1896 1900 final public void litContent(StringBuffer val,Map allNs, Map ns) throws ParseException { 1901 Token t; 1902 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1903 case CD_STRING: 1904 t = jj_consume_token(CD_STRING); 1905 X.litText(val,t); 1906 break; 1907 case COMMENT: 1908 t = jj_consume_token(COMMENT); 1910 X.litComment(val,t); 1911 break; 1912 case PROCESSING_INSTRUCTION: 1913 t = jj_consume_token(PROCESSING_INSTRUCTION); 1915 X.litProcessingInstruction(val,t); 1916 break; 1917 case E_RDF: 1918 case E_DESCRIPTION: 1919 case E_OTHER: 1920 case E_LI: 1921 case E_RDF_N: 1922 litElement(val,allNs,ns); 1923 break; 1924 case X_SAX_EX: 1925 saxEx(); 1926 break; 1927 default: 1928 jj_la1[75] = jj_gen; 1929 jj_consume_token(-1); 1930 throw new ParseException(); 1931 } 1932 } 1933 1934 final public String litValue(Map allNs, Location wh) throws ParseException { 1935 StringBuffer buf = new StringBuffer (); 1936 label_44: 1937 while (true) { 1938 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1939 case CD_STRING: 1940 case PROCESSING_INSTRUCTION: 1941 case COMMENT: 1942 case X_SAX_EX: 1943 case E_RDF: 1944 case E_DESCRIPTION: 1945 case E_OTHER: 1946 case E_LI: 1947 case E_RDF_N: 1948 ; 1949 break; 1950 default: 1951 jj_la1[76] = jj_gen; 1952 break label_44; 1953 } 1954 litContent(buf,allNs,ParserSupport.xmlNameSpace()); 1955 } 1956 String r = buf.toString(); 1957 X.checkEncoding(r,wh); 1958 {if (true) return r;} 1959 throw new Error ("Missing return statement in function"); 1960 } 1961 1962 void error_recovery(ParseException e) throws ParseException, ParseException { 1963 e.setStartAttribute( startAttr ); 1964 try { 1965 arp.userError(e); 1966 } 1967 catch (SAXException sax) { 1968 if ( sax == e ) { 1969 e.setFatal(true); 1970 throw e; 1971 } 1972 throw new WrappedException(sax); 1973 } 1974 if ( e.getFatal() ) 1975 throw e; 1976 1977 Token t; 1978 int needed = 1; 1979 do { 1980 t = getNextToken(); 1981 switch ( t.kind ) { 1982 case EOF: 1983 ParseException failure = new ParseException(ERR_UNABLE_TO_RECOVER,"Error recovery failed."); 1984 failure.setFatal(true); 1985 throw failure; 1986 case E_END: needed--; break; 1987 case X_SAX_EX: 1988 X.saxException(t); 1989 break; 1990 case X_WARNING: 1991 arp.parseWarning((Warn)t); 1992 break; 1993 case E_LI: 1994 case E_RDF: 1995 case E_RDF_N: 1996 case E_DESCRIPTION: 1997 case E_OTHER: needed++; break; 1998 } 1999 } while (needed>0); 2000 } 2001 2002 final private boolean jj_2_1(int xla) { 2003 jj_la = xla; jj_lastpos = jj_scanpos = token; 2004 try { return !jj_3_1(); } 2005 catch(LookaheadSuccess ls) { return true; } 2006 finally { jj_save(0, xla); } 2007 } 2008 2009 final private boolean jj_2_2(int xla) { 2010 jj_la = xla; jj_lastpos = jj_scanpos = token; 2011 try { return !jj_3_2(); } 2012 catch(LookaheadSuccess ls) { return true; } 2013 finally { jj_save(1, xla); } 2014 } 2015 2016 final private boolean jj_2_3(int xla) { 2017 jj_la = xla; jj_lastpos = jj_scanpos = token; 2018 try { return !jj_3_3(); } 2019 catch(LookaheadSuccess ls) { return true; } 2020 finally { jj_save(2, xla); } 2021 } 2022 2023 final private boolean jj_2_4(int xla) { 2024 jj_la = xla; jj_lastpos = jj_scanpos = token; 2025 try { return !jj_3_4(); } 2026 catch(LookaheadSuccess ls) { return true; } 2027 finally { jj_save(3, xla); } 2028 } 2029 2030 final private boolean jj_3_2() { 2031 if (jj_scan_token(A_PARSETYPE)) return true; 2032 if (jj_scan_token(AV_DAMLCOLLECTION)) return true; 2033 return false; 2034 } 2035 2036 final private boolean jj_3_3() { 2037 if (jj_scan_token(A_PARSETYPE)) return true; 2038 if (jj_scan_token(AV_COLLECTION)) return true; 2039 return false; 2040 } 2041 2042 final private boolean jj_3R_45() { 2043 Token xsp; 2044 xsp = jj_scanpos; 2045 if (jj_scan_token(1)) { 2046 jj_scanpos = xsp; 2047 if (jj_scan_token(3)) { 2048 jj_scanpos = xsp; 2049 if (jj_scan_token(2)) { 2050 jj_scanpos = xsp; 2051 if (jj_scan_token(4)) return true; 2052 } 2053 } 2054 } 2055 return false; 2056 } 2057 2058 final private boolean jj_3_4() { 2059 Token xsp; 2060 while (true) { 2061 xsp = jj_scanpos; 2062 if (jj_3R_45()) { jj_scanpos = xsp; break; } 2063 } 2064 if (jj_scan_token(E_END)) return true; 2065 return false; 2066 } 2067 2068 final private boolean jj_3_1() { 2069 if (jj_scan_token(A_PARSETYPE)) return true; 2070 if (jj_scan_token(AV_LITERAL)) return true; 2071 return false; 2072 } 2073 2074 public TokenManager token_source; 2075 public Token token, jj_nt; 2076 private int jj_ntk; 2077 Token jj_scanpos, jj_lastpos; 2078 private int jj_la; 2079 public boolean lookingAhead = false; 2080 private boolean jj_semLA; 2081 private int jj_gen; 2082 final private int[] jj_la1 = new int[77]; 2083 static private int[] jj_la1_0; 2084 static { 2085 jj_la1_0(); 2086 } 2087 private static void jj_la1_0() { 2088 jj_la1_0 = new int[] {0x380a0,0x1e,0x1e,0x2000001e,0x2000001e,0x1e,0x1e,0xc,0xc,0x38080,0x700,0x7000,0x38000,0x38080,0x700,0x20000000,0x20000000,0x20000000,0x20000000,0x20000000,0x7000,0x20000000,0x38000,0x100,0x20000000,0x20000000,0x20000000,0x1847400,0x20000000,0x38000,0x7000,0x7000,0x847400,0x38080,0x700,0x7000,0x38000,0x38000,0x3809e,0x20000000,0x20000000,0x800400,0x1e,0x1e,0x24000000,0x24000000,0x20000000,0x8000000,0x20000000,0x10000000,0x20000000,0x2000000,0x380a0,0x20000000,0x1847700,0x380be,0x20000000,0x24000000,0x24000000,0x20000000,0x8000000,0x20000000,0x10000000,0x380be,0x38080,0x380a0,0x1b847700,0x1847700,0x780800,0x20000000,0x4000000,0x1b847700,0x380be,0x20000000,0x20000000,0x380be,0x380be,}; 2089 } 2090 final private JJCalls[] jj_2_rtns = new JJCalls[4]; 2091 private boolean jj_rescan = false; 2092 private int jj_gc = 0; 2093 2094 2095 public RDFParser(TokenManager tm) { 2096 token_source = tm; 2097 token = new Token(); 2098 jj_ntk = -1; 2099 jj_gen = 0; 2100 for (int i = 0; i < 77; i++) jj_la1[i] = -1; 2101 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 2102 } 2103 2104 public void ReInit(TokenManager tm) { 2105 token_source = tm; 2106 token = new Token(); 2107 jj_ntk = -1; 2108 jj_gen = 0; 2109 for (int i = 0; i < 77; i++) jj_la1[i] = -1; 2110 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 2111 } 2112 2113 final private Token jj_consume_token(int kind) throws ParseException { 2114 Token oldToken; 2115 if ((oldToken = token).next != null) token = token.next; 2116 else token = token.next = token_source.getNextToken(); 2117 jj_ntk = -1; 2118 if (token.kind == kind) { 2119 jj_gen++; 2120 if (++jj_gc > 100) { 2121 jj_gc = 0; 2122 for (int i = 0; i < jj_2_rtns.length; i++) { 2123 JJCalls c = jj_2_rtns[i]; 2124 while (c != null) { 2125 if (c.gen < jj_gen) c.first = null; 2126 c = c.next; 2127 } 2128 } 2129 } 2130 return token; 2131 } 2132 token = oldToken; 2133 jj_kind = kind; 2134 throw generateParseException(); 2135 } 2136 2137 static private final class LookaheadSuccess extends java.lang.Error { } 2138 final private LookaheadSuccess jj_ls = new LookaheadSuccess(); 2139 final private boolean jj_scan_token(int kind) { 2140 if (jj_scanpos == jj_lastpos) { 2141 jj_la--; 2142 if (jj_scanpos.next == null) { 2143 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 2144 } else { 2145 jj_lastpos = jj_scanpos = jj_scanpos.next; 2146 } 2147 } else { 2148 jj_scanpos = jj_scanpos.next; 2149 } 2150 if (jj_rescan) { 2151 int i = 0; Token tok = token; 2152 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 2153 if (tok != null) jj_add_error_token(kind, i); 2154 } 2155 if (jj_scanpos.kind != kind) return true; 2156 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; 2157 return false; 2158 } 2159 2160 final public Token getNextToken() { 2161 if (token.next != null) token = token.next; 2162 else token = token.next = token_source.getNextToken(); 2163 jj_ntk = -1; 2164 jj_gen++; 2165 return token; 2166 } 2167 2168 final public Token getToken(int index) { 2169 Token t = lookingAhead ? jj_scanpos : token; 2170 for (int i = 0; i < index; i++) { 2171 if (t.next != null) t = t.next; 2172 else t = t.next = token_source.getNextToken(); 2173 } 2174 return t; 2175 } 2176 2177 final private int jj_ntk() { 2178 if ((jj_nt=token.next) == null) 2179 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 2180 else 2181 return (jj_ntk = jj_nt.kind); 2182 } 2183 2184 private java.util.Vector jj_expentries = new java.util.Vector (); 2185 private int[] jj_expentry; 2186 private int jj_kind = -1; 2187 private int[] jj_lasttokens = new int[100]; 2188 private int jj_endpos; 2189 2190 private void jj_add_error_token(int kind, int pos) { 2191 if (pos >= 100) return; 2192 if (pos == jj_endpos + 1) { 2193 jj_lasttokens[jj_endpos++] = kind; 2194 } else if (jj_endpos != 0) { 2195 jj_expentry = new int[jj_endpos]; 2196 for (int i = 0; i < jj_endpos; i++) { 2197 jj_expentry[i] = jj_lasttokens[i]; 2198 } 2199 boolean exists = false; 2200 for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { 2201 int[] oldentry = (int[])(e.nextElement()); 2202 if (oldentry.length == jj_expentry.length) { 2203 exists = true; 2204 for (int i = 0; i < jj_expentry.length; i++) { 2205 if (oldentry[i] != jj_expentry[i]) { 2206 exists = false; 2207 break; 2208 } 2209 } 2210 if (exists) break; 2211 } 2212 } 2213 if (!exists) jj_expentries.addElement(jj_expentry); 2214 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; 2215 } 2216 } 2217 2218 public ParseException generateParseException() { 2219 jj_expentries.removeAllElements(); 2220 boolean[] la1tokens = new boolean[30]; 2221 for (int i = 0; i < 30; i++) { 2222 la1tokens[i] = false; 2223 } 2224 if (jj_kind >= 0) { 2225 la1tokens[jj_kind] = true; 2226 jj_kind = -1; 2227 } 2228 for (int i = 0; i < 77; i++) { 2229 if (jj_la1[i] == jj_gen) { 2230 for (int j = 0; j < 32; j++) { 2231 if ((jj_la1_0[i] & (1<<j)) != 0) { 2232 la1tokens[j] = true; 2233 } 2234 } 2235 } 2236 } 2237 for (int i = 0; i < 30; i++) { 2238 if (la1tokens[i]) { 2239 jj_expentry = new int[1]; 2240 jj_expentry[0] = i; 2241 jj_expentries.addElement(jj_expentry); 2242 } 2243 } 2244 jj_endpos = 0; 2245 jj_rescan_token(); 2246 jj_add_error_token(0, 0); 2247 int[][] exptokseq = new int[jj_expentries.size()][]; 2248 for (int i = 0; i < jj_expentries.size(); i++) { 2249 exptokseq[i] = (int[])jj_expentries.elementAt(i); 2250 } 2251 return new ParseException(token, exptokseq, tokenImage); 2252 } 2253 2254 final public void enable_tracing() { 2255 } 2256 2257 final public void disable_tracing() { 2258 } 2259 2260 final private void jj_rescan_token() { 2261 jj_rescan = true; 2262 for (int i = 0; i < 4; i++) { 2263 JJCalls p = jj_2_rtns[i]; 2264 do { 2265 if (p.gen > jj_gen) { 2266 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 2267 switch (i) { 2268 case 0: jj_3_1(); break; 2269 case 1: jj_3_2(); break; 2270 case 2: jj_3_3(); break; 2271 case 3: jj_3_4(); break; 2272 } 2273 } 2274 p = p.next; 2275 } while (p != null); 2276 } 2277 jj_rescan = false; 2278 } 2279 2280 final private void jj_save(int index, int xla) { 2281 JJCalls p = jj_2_rtns[index]; 2282 while (p.gen > jj_gen) { 2283 if (p.next == null) { p = p.next = new JJCalls(); break; } 2284 p = p.next; 2285 } 2286 p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; 2287 } 2288 2289 static final class JJCalls { 2290 int gen; 2291 Token first; 2292 int arg; 2293 JJCalls next; 2294 } 2295 2296} 2297 | Popular Tags |