0001: /* Generated By:JavaCC: Do not edit this line. CompactSyntax.java */
0002: package org.kohsuke.rngom.parse.compact;
0003:
0004: import java.io.Reader;
0005: import java.net.MalformedURLException;
0006: import java.net.URL;
0007: import java.util.Arrays;
0008: import java.util.ArrayList;
0009: import java.util.Collections;
0010: import java.util.Enumeration;
0011: import java.util.Hashtable;
0012: import java.util.List;
0013:
0014: import org.kohsuke.rngom.ast.builder.Annotations;
0015: import org.kohsuke.rngom.ast.builder.BuildException;
0016: import org.kohsuke.rngom.ast.builder.CommentList;
0017: import org.kohsuke.rngom.ast.builder.DataPatternBuilder;
0018: import org.kohsuke.rngom.ast.builder.Div;
0019: import org.kohsuke.rngom.ast.builder.ElementAnnotationBuilder;
0020: import org.kohsuke.rngom.ast.builder.Grammar;
0021: import org.kohsuke.rngom.ast.builder.GrammarSection;
0022: import org.kohsuke.rngom.ast.builder.Include;
0023: import org.kohsuke.rngom.ast.builder.IncludedGrammar;
0024: import org.kohsuke.rngom.ast.builder.NameClassBuilder;
0025: import org.kohsuke.rngom.ast.builder.SchemaBuilder;
0026: import org.kohsuke.rngom.ast.builder.Scope;
0027: import org.kohsuke.rngom.ast.om.Location;
0028: import org.kohsuke.rngom.ast.om.ParsedElementAnnotation;
0029: import org.kohsuke.rngom.ast.om.ParsedNameClass;
0030: import org.kohsuke.rngom.ast.om.ParsedPattern;
0031: import org.kohsuke.rngom.parse.Context;
0032: import org.kohsuke.rngom.parse.IllegalSchemaException;
0033: import org.kohsuke.rngom.parse.Parseable;
0034: import org.xml.sax.ErrorHandler;
0035: import org.xml.sax.SAXException;
0036: import org.xml.sax.SAXParseException;
0037: import org.xml.sax.helpers.LocatorImpl;
0038:
0039: import org.kohsuke.rngom.util.Localizer;
0040: import org.kohsuke.rngom.xml.util.WellKnownNamespaces;
0041:
0042: public class CompactSyntax implements Context, CompactSyntaxConstants {
0043: private static final int IN_ELEMENT = 0;
0044: private static final int IN_ATTRIBUTE = 1;
0045: private static final int IN_ANY_NAME = 2;
0046: private static final int IN_NS_NAME = 4;
0047:
0048: private String defaultNamespace;
0049: private String compatibilityPrefix = null;
0050: private SchemaBuilder sb;
0051: private NameClassBuilder ncb;
0052: private String sourceUri;
0053: /**
0054: * This is what we are parsing right now.
0055: */
0056: private CompactParseable parseable;
0057: private ErrorHandler eh;
0058: private final Hashtable namespaceTable = new Hashtable();
0059: private final Hashtable datatypesTable = new Hashtable();
0060: private boolean hadError = false;
0061: private static final Localizer localizer = new Localizer(
0062: new Localizer(Parseable.class), CompactSyntax.class);
0063: private final Hashtable attributeNameTable = new Hashtable();
0064: private boolean annotationsIncludeElements = false;
0065:
0066: /**
0067: * String that represents the inherited namespace.
0068: *
0069: * <p>
0070: * HACK: we always allocate a new String instance so that
0071: * we can distinguish inherited value from the explicitly
0072: * given value.
0073: */
0074: private/*final*/String inheritedNs; // essentially final but JavaCC don't let us declare it as so.
0075:
0076: final class LocatedString {
0077: private final String str;
0078: private final Token tok;
0079:
0080: LocatedString(String str, Token tok) {
0081: this .str = str;
0082: this .tok = tok;
0083: }
0084:
0085: String getString() {
0086: return str;
0087: }
0088:
0089: Location getLocation() {
0090: return makeLocation(tok);
0091: }
0092:
0093: Token getToken() {
0094: return tok;
0095: }
0096:
0097: }
0098:
0099: public CompactSyntax(CompactParseable parseable, Reader r,
0100: String sourceUri, SchemaBuilder sb, ErrorHandler eh,
0101: String inheritedNs) {
0102: this (r);
0103: this .sourceUri = sourceUri;
0104: this .parseable = parseable;
0105: this .sb = sb;
0106: this .ncb = sb.getNameClassBuilder();
0107: this .eh = eh;
0108: // this causes the root pattern to have non-null annotations
0109: // which is useful because it gives a context to trang
0110: this .topLevelComments = sb.makeCommentList();
0111: this .inheritedNs = defaultNamespace = new String(inheritedNs);
0112: }
0113:
0114: ParsedPattern parse(Scope scope) throws IllegalSchemaException {
0115: try {
0116: ParsedPattern p = Input(scope);
0117: if (!hadError)
0118: return p;
0119: } catch (ParseException e) {
0120: error("syntax_error", e.getMessage(), e.currentToken.next);
0121: } catch (EscapeSyntaxException e) {
0122: reportEscapeSyntaxException(e);
0123: }
0124: throw new IllegalSchemaException();
0125: }
0126:
0127: ParsedPattern parseInclude(IncludedGrammar g)
0128: throws IllegalSchemaException {
0129: try {
0130: ParsedPattern p = IncludedGrammar(g);
0131: if (!hadError)
0132: return p;
0133: } catch (ParseException e) {
0134: error("syntax_error", e.getMessage(), e.currentToken.next);
0135: } catch (EscapeSyntaxException e) {
0136: reportEscapeSyntaxException(e);
0137: }
0138: throw new IllegalSchemaException();
0139: }
0140:
0141: private void checkNsName(int context, LocatedString ns) {
0142: if ((context & IN_NS_NAME) != 0)
0143: error("ns_name_except_contains_ns_name", ns.getToken());
0144: }
0145:
0146: private void checkAnyName(int context, Token t) {
0147: if ((context & IN_NS_NAME) != 0)
0148: error("ns_name_except_contains_any_name", t);
0149: if ((context & IN_ANY_NAME) != 0)
0150: error("any_name_except_contains_any_name", t);
0151: }
0152:
0153: private void error(String key, Token tok) {
0154: doError(localizer.message(key), tok);
0155: }
0156:
0157: private void error(String key, String arg, Token tok) {
0158: doError(localizer.message(key, arg), tok);
0159: }
0160:
0161: private void error(String key, String arg1, String arg2, Token tok) {
0162: doError(localizer.message(key, arg1, arg2), tok);
0163: }
0164:
0165: private void doError(String message, Token tok) {
0166: hadError = true;
0167: if (eh != null) {
0168: LocatorImpl loc = new LocatorImpl();
0169: loc.setLineNumber(tok.beginLine);
0170: loc.setColumnNumber(tok.beginColumn);
0171: loc.setSystemId(sourceUri);
0172: try {
0173: eh.error(new SAXParseException(message, loc));
0174: } catch (SAXException se) {
0175: throw new BuildException(se);
0176: }
0177: }
0178: }
0179:
0180: private void reportEscapeSyntaxException(EscapeSyntaxException e) {
0181: if (eh != null) {
0182: LocatorImpl loc = new LocatorImpl();
0183: loc.setLineNumber(e.getLineNumber());
0184: loc.setColumnNumber(e.getColumnNumber());
0185: loc.setSystemId(sourceUri);
0186: try {
0187: eh.error(new SAXParseException(localizer.message(e
0188: .getKey()), loc));
0189: } catch (SAXException se) {
0190: throw new BuildException(se);
0191: }
0192: }
0193: }
0194:
0195: private static String unquote(String s) {
0196: if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) {
0197: s = s.replace('\u0000', '\n');
0198: return s.substring(3, s.length() - 3);
0199: } else
0200: return s.substring(1, s.length() - 1);
0201: }
0202:
0203: Location makeLocation(Token t) {
0204: return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn);
0205: }
0206:
0207: private static ParsedPattern[] addPattern(ParsedPattern[] patterns,
0208: int i, ParsedPattern p) {
0209: if (i >= patterns.length) {
0210: ParsedPattern[] oldPatterns = patterns;
0211: patterns = new ParsedPattern[oldPatterns.length * 2];
0212: System.arraycopy(oldPatterns, 0, patterns, 0,
0213: oldPatterns.length);
0214: }
0215: patterns[i] = p;
0216: return patterns;
0217: }
0218:
0219: String getCompatibilityPrefix() {
0220: if (compatibilityPrefix == null) {
0221: compatibilityPrefix = "a";
0222: while (namespaceTable.get(compatibilityPrefix) != null)
0223: compatibilityPrefix = compatibilityPrefix + "a";
0224: }
0225: return compatibilityPrefix;
0226: }
0227:
0228: public String resolveNamespacePrefix(String prefix) {
0229: String result = (String) namespaceTable.get(prefix);
0230: if (result.length() == 0)
0231: return null;
0232: return result;
0233: }
0234:
0235: public Enumeration prefixes() {
0236: return namespaceTable.keys();
0237: }
0238:
0239: public String getBaseUri() {
0240: return sourceUri;
0241: }
0242:
0243: public boolean isUnparsedEntity(String entityName) {
0244: return false;
0245: }
0246:
0247: public boolean isNotation(String notationName) {
0248: return false;
0249: }
0250:
0251: public Context copy() {
0252: return this ;
0253: }
0254:
0255: private Context getContext() {
0256: return this ;
0257: }
0258:
0259: private CommentList getComments() {
0260: return getComments(getTopLevelComments());
0261: }
0262:
0263: private CommentList topLevelComments;
0264:
0265: private CommentList getTopLevelComments() {
0266: CommentList tem = topLevelComments;
0267: topLevelComments = null;
0268: return tem;
0269: }
0270:
0271: private void noteTopLevelComments() {
0272: topLevelComments = getComments(topLevelComments);
0273: }
0274:
0275: private void topLevelComments(GrammarSection section) {
0276: section.topLevelComment(getComments(null));
0277: }
0278:
0279: private Token lastCommentSourceToken = null;
0280:
0281: private CommentList getComments(CommentList comments) {
0282: Token nextToken = getToken(1);
0283: if (lastCommentSourceToken != nextToken) {
0284: if (lastCommentSourceToken == null)
0285: lastCommentSourceToken = token;
0286: do {
0287: lastCommentSourceToken = lastCommentSourceToken.next;
0288: Token t = lastCommentSourceToken.specialToken;
0289: if (t != null) {
0290: while (t.specialToken != null)
0291: t = t.specialToken;
0292: if (comments == null)
0293: comments = sb.makeCommentList();
0294: for (; t != null; t = t.next) {
0295: String s = mungeComment(t.image);
0296: Location loc = makeLocation(t);
0297: if (t.next != null
0298: && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) {
0299: StringBuffer buf = new StringBuffer(s);
0300: do {
0301: t = t.next;
0302: buf.append('\n');
0303: buf.append(mungeComment(t.image));
0304: } while (t.next != null
0305: && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE);
0306: s = buf.toString();
0307: }
0308: comments.addComment(s, loc);
0309: }
0310: }
0311: } while (lastCommentSourceToken != nextToken);
0312: }
0313: return comments;
0314: }
0315:
0316: private ParsedPattern afterComments(ParsedPattern p) {
0317: CommentList comments = getComments(null);
0318: if (comments == null)
0319: return p;
0320: return sb.commentAfter(p, comments);
0321: }
0322:
0323: private ParsedNameClass afterComments(ParsedNameClass nc) {
0324: CommentList comments = getComments(null);
0325: if (comments == null)
0326: return nc;
0327: return ncb.commentAfter(nc, comments);
0328: }
0329:
0330: private static String mungeComment(String image) {
0331: int i = image.indexOf('#') + 1;
0332: while (i < image.length() && image.charAt(i) == '#')
0333: i++;
0334: if (i < image.length() && image.charAt(i) == ' ')
0335: i++;
0336: return image.substring(i);
0337: }
0338:
0339: private Annotations getCommentsAsAnnotations() {
0340: CommentList comments = getComments();
0341: if (comments == null)
0342: return null;
0343: return sb.makeAnnotations(comments, getContext());
0344: }
0345:
0346: private Annotations addCommentsToChildAnnotations(Annotations a) {
0347: CommentList comments = getComments();
0348: if (comments == null)
0349: return a;
0350: if (a == null)
0351: a = sb.makeAnnotations(null, getContext());
0352: a.addComment(comments);
0353: return a;
0354: }
0355:
0356: private Annotations addCommentsToLeadingAnnotations(Annotations a) {
0357: CommentList comments = getComments();
0358: if (comments == null)
0359: return a;
0360: if (a == null)
0361: return sb.makeAnnotations(comments, getContext());
0362: a.addLeadingComment(comments);
0363: return a;
0364: }
0365:
0366: private Annotations getTopLevelCommentsAsAnnotations() {
0367: CommentList comments = getTopLevelComments();
0368: if (comments == null)
0369: return null;
0370: return sb.makeAnnotations(comments, getContext());
0371: }
0372:
0373: private void clearAttributeList() {
0374: attributeNameTable.clear();
0375: }
0376:
0377: private void addAttribute(Annotations a, String ns,
0378: String localName, String prefix, String value, Token tok) {
0379: String key = ns + "#" + localName;
0380: if (attributeNameTable.get(key) != null)
0381: error("duplicate_attribute", ns, localName, tok);
0382: else {
0383: attributeNameTable.put(key, key);
0384: a.addAttribute(ns, localName, prefix, value,
0385: makeLocation(tok));
0386: }
0387: }
0388:
0389: private void checkExcept(Token[] except) {
0390: if (except[0] != null)
0391: error("except_missing_parentheses", except[0]);
0392: }
0393:
0394: private String lookupPrefix(String prefix, Token t) {
0395: String ns = (String) namespaceTable.get(prefix);
0396: if (ns == null) {
0397: error("undeclared_prefix", prefix, t);
0398: return "#error";
0399: }
0400: return ns;
0401: }
0402:
0403: private String lookupDatatype(String prefix, Token t) {
0404: String ns = (String) datatypesTable.get(prefix);
0405: if (ns == null) {
0406: error("undeclared_prefix", prefix, t);
0407: return ""; // XXX
0408: }
0409: return ns;
0410: }
0411:
0412: private String resolve(String str) {
0413: try {
0414: return new URL(new URL(sourceUri), str).toString();
0415: } catch (MalformedURLException e) {
0416: }
0417: return str;
0418: }
0419:
0420: final public ParsedPattern Input(Scope scope) throws ParseException {
0421: ParsedPattern p;
0422: Preamble();
0423: if (jj_2_1(2147483647)) {
0424: p = TopLevelGrammar(scope);
0425: } else {
0426: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0427: case 1:
0428: case 10:
0429: case 17:
0430: case 18:
0431: case 19:
0432: case 26:
0433: case 27:
0434: case 28:
0435: case 31:
0436: case 32:
0437: case 33:
0438: case 34:
0439: case 35:
0440: case 36:
0441: case DOCUMENTATION:
0442: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
0443: case IDENTIFIER:
0444: case ESCAPED_IDENTIFIER:
0445: case PREFIXED_NAME:
0446: case LITERAL:
0447: p = Expr(true, scope, null, null);
0448: p = afterComments(p);
0449: jj_consume_token(0);
0450: break;
0451: default:
0452: jj_la1[0] = jj_gen;
0453: jj_consume_token(-1);
0454: throw new ParseException();
0455: }
0456: }
0457: {
0458: if (true)
0459: return p;
0460: }
0461: throw new Error("Missing return statement in function");
0462: }
0463:
0464: final public void TopLevelLookahead() throws ParseException {
0465: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0466: case PREFIXED_NAME:
0467: jj_consume_token(PREFIXED_NAME);
0468: jj_consume_token(1);
0469: break;
0470: case IDENTIFIER:
0471: case ESCAPED_IDENTIFIER:
0472: Identifier();
0473: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0474: case 1:
0475: jj_consume_token(1);
0476: break;
0477: case 2:
0478: jj_consume_token(2);
0479: break;
0480: case 3:
0481: jj_consume_token(3);
0482: break;
0483: case 4:
0484: jj_consume_token(4);
0485: break;
0486: default:
0487: jj_la1[1] = jj_gen;
0488: jj_consume_token(-1);
0489: throw new ParseException();
0490: }
0491: break;
0492: case 5:
0493: case 6:
0494: case 7:
0495: LookaheadGrammarKeyword();
0496: break;
0497: case 1:
0498: LookaheadBody();
0499: LookaheadAfterAnnotations();
0500: break;
0501: case DOCUMENTATION:
0502: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
0503: LookaheadDocumentation();
0504: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0505: case 1:
0506: LookaheadBody();
0507: break;
0508: default:
0509: jj_la1[2] = jj_gen;
0510: ;
0511: }
0512: LookaheadAfterAnnotations();
0513: break;
0514: default:
0515: jj_la1[3] = jj_gen;
0516: jj_consume_token(-1);
0517: throw new ParseException();
0518: }
0519: }
0520:
0521: final public void LookaheadAfterAnnotations() throws ParseException {
0522: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0523: case IDENTIFIER:
0524: case ESCAPED_IDENTIFIER:
0525: Identifier();
0526: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0527: case 2:
0528: jj_consume_token(2);
0529: break;
0530: case 3:
0531: jj_consume_token(3);
0532: break;
0533: case 4:
0534: jj_consume_token(4);
0535: break;
0536: default:
0537: jj_la1[4] = jj_gen;
0538: jj_consume_token(-1);
0539: throw new ParseException();
0540: }
0541: break;
0542: case 5:
0543: case 6:
0544: case 7:
0545: LookaheadGrammarKeyword();
0546: break;
0547: default:
0548: jj_la1[5] = jj_gen;
0549: jj_consume_token(-1);
0550: throw new ParseException();
0551: }
0552: }
0553:
0554: final public void LookaheadGrammarKeyword() throws ParseException {
0555: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0556: case 5:
0557: jj_consume_token(5);
0558: break;
0559: case 6:
0560: jj_consume_token(6);
0561: break;
0562: case 7:
0563: jj_consume_token(7);
0564: break;
0565: default:
0566: jj_la1[6] = jj_gen;
0567: jj_consume_token(-1);
0568: throw new ParseException();
0569: }
0570: }
0571:
0572: final public void LookaheadDocumentation() throws ParseException {
0573: label_1: while (true) {
0574: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0575: case DOCUMENTATION:
0576: jj_consume_token(DOCUMENTATION);
0577: break;
0578: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
0579: jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT);
0580: break;
0581: default:
0582: jj_la1[7] = jj_gen;
0583: jj_consume_token(-1);
0584: throw new ParseException();
0585: }
0586: label_2: while (true) {
0587: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0588: case DOCUMENTATION_CONTINUE:
0589: ;
0590: break;
0591: default:
0592: jj_la1[8] = jj_gen;
0593: break label_2;
0594: }
0595: jj_consume_token(DOCUMENTATION_CONTINUE);
0596: }
0597: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0598: case DOCUMENTATION:
0599: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
0600: ;
0601: break;
0602: default:
0603: jj_la1[9] = jj_gen;
0604: break label_1;
0605: }
0606: }
0607: }
0608:
0609: final public void LookaheadBody() throws ParseException {
0610: jj_consume_token(1);
0611: label_3: while (true) {
0612: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0613: case 1:
0614: case 2:
0615: case 5:
0616: case 6:
0617: case 7:
0618: case 8:
0619: case 10:
0620: case 13:
0621: case 14:
0622: case 15:
0623: case 16:
0624: case 17:
0625: case 18:
0626: case 19:
0627: case 26:
0628: case 27:
0629: case 31:
0630: case 32:
0631: case 33:
0632: case 34:
0633: case 35:
0634: case 36:
0635: case IDENTIFIER:
0636: case ESCAPED_IDENTIFIER:
0637: case PREFIXED_NAME:
0638: case LITERAL:
0639: ;
0640: break;
0641: default:
0642: jj_la1[10] = jj_gen;
0643: break label_3;
0644: }
0645: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0646: case PREFIXED_NAME:
0647: jj_consume_token(PREFIXED_NAME);
0648: break;
0649: case 5:
0650: case 6:
0651: case 7:
0652: case 10:
0653: case 13:
0654: case 14:
0655: case 15:
0656: case 16:
0657: case 17:
0658: case 18:
0659: case 19:
0660: case 26:
0661: case 27:
0662: case 31:
0663: case 32:
0664: case 33:
0665: case 34:
0666: case 35:
0667: case 36:
0668: case IDENTIFIER:
0669: case ESCAPED_IDENTIFIER:
0670: UnprefixedName();
0671: break;
0672: case 2:
0673: jj_consume_token(2);
0674: break;
0675: case LITERAL:
0676: jj_consume_token(LITERAL);
0677: break;
0678: case 8:
0679: jj_consume_token(8);
0680: break;
0681: case 1:
0682: LookaheadBody();
0683: break;
0684: default:
0685: jj_la1[11] = jj_gen;
0686: jj_consume_token(-1);
0687: throw new ParseException();
0688: }
0689: }
0690: jj_consume_token(9);
0691: }
0692:
0693: final public ParsedPattern IncludedGrammar(IncludedGrammar g)
0694: throws ParseException {
0695: Annotations a;
0696: ParsedPattern p;
0697: Preamble();
0698: if (jj_2_2(2147483647)) {
0699: a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations());
0700: } else {
0701: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0702: case 1:
0703: case 10:
0704: case DOCUMENTATION:
0705: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
0706: a = Annotations();
0707: jj_consume_token(10);
0708: jj_consume_token(11);
0709: a = GrammarBody(g, g, a);
0710: topLevelComments(g);
0711: jj_consume_token(12);
0712: break;
0713: default:
0714: jj_la1[12] = jj_gen;
0715: jj_consume_token(-1);
0716: throw new ParseException();
0717: }
0718: }
0719: p = afterComments(g.endIncludedGrammar(sb.makeLocation(
0720: sourceUri, 1, 1), a));
0721: jj_consume_token(0);
0722: {
0723: if (true)
0724: return p;
0725: }
0726: throw new Error("Missing return statement in function");
0727: }
0728:
0729: final public ParsedPattern TopLevelGrammar(Scope scope)
0730: throws ParseException {
0731: Annotations a = getTopLevelCommentsAsAnnotations();
0732: Grammar g;
0733: ParsedPattern p;
0734: g = sb.makeGrammar(scope);
0735: a = GrammarBody(g, g, a);
0736: p = afterComments(g.endGrammar(
0737: sb.makeLocation(sourceUri, 1, 1), a));
0738: jj_consume_token(0);
0739: {
0740: if (true)
0741: return p;
0742: }
0743: throw new Error("Missing return statement in function");
0744: }
0745:
0746: final public void Preamble() throws ParseException {
0747: label_4: while (true) {
0748: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0749: case 13:
0750: case 14:
0751: case 16:
0752: ;
0753: break;
0754: default:
0755: jj_la1[13] = jj_gen;
0756: break label_4;
0757: }
0758: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0759: case 13:
0760: case 14:
0761: NamespaceDecl();
0762: break;
0763: case 16:
0764: DatatypesDecl();
0765: break;
0766: default:
0767: jj_la1[14] = jj_gen;
0768: jj_consume_token(-1);
0769: throw new ParseException();
0770: }
0771: }
0772: namespaceTable.put("xml", WellKnownNamespaces.XML);
0773: if (datatypesTable.get("xsd") == null)
0774: datatypesTable.put("xsd",
0775: WellKnownNamespaces.XML_SCHEMA_DATATYPES);
0776: }
0777:
0778: final public void NamespaceDecl() throws ParseException {
0779: LocatedString prefix = null;
0780: boolean isDefault = false;
0781: String namespaceName;
0782: noteTopLevelComments();
0783: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0784: case 13:
0785: jj_consume_token(13);
0786: prefix = UnprefixedName();
0787: break;
0788: case 14:
0789: jj_consume_token(14);
0790: isDefault = true;
0791: jj_consume_token(13);
0792: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0793: case 5:
0794: case 6:
0795: case 7:
0796: case 10:
0797: case 13:
0798: case 14:
0799: case 15:
0800: case 16:
0801: case 17:
0802: case 18:
0803: case 19:
0804: case 26:
0805: case 27:
0806: case 31:
0807: case 32:
0808: case 33:
0809: case 34:
0810: case 35:
0811: case 36:
0812: case IDENTIFIER:
0813: case ESCAPED_IDENTIFIER:
0814: prefix = UnprefixedName();
0815: break;
0816: default:
0817: jj_la1[15] = jj_gen;
0818: ;
0819: }
0820: break;
0821: default:
0822: jj_la1[16] = jj_gen;
0823: jj_consume_token(-1);
0824: throw new ParseException();
0825: }
0826: jj_consume_token(2);
0827: namespaceName = NamespaceName();
0828: if (isDefault)
0829: defaultNamespace = namespaceName;
0830: if (prefix != null) {
0831: if (prefix.getString().equals("xmlns"))
0832: error("xmlns_prefix", prefix.getToken());
0833: else if (prefix.getString().equals("xml")) {
0834: if (!namespaceName.equals(WellKnownNamespaces.XML))
0835: error("xml_prefix_bad_uri", prefix.getToken());
0836: } else if (namespaceName.equals(WellKnownNamespaces.XML))
0837: error("xml_uri_bad_prefix", prefix.getToken());
0838: else {
0839: if (namespaceName
0840: .equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS))
0841: compatibilityPrefix = prefix.getString();
0842: namespaceTable.put(prefix.getString(), namespaceName);
0843: }
0844: }
0845: }
0846:
0847: final public String NamespaceName() throws ParseException {
0848: String r;
0849: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0850: case LITERAL:
0851: r = Literal();
0852: break;
0853: case 15:
0854: jj_consume_token(15);
0855: r = this .inheritedNs;
0856: break;
0857: default:
0858: jj_la1[17] = jj_gen;
0859: jj_consume_token(-1);
0860: throw new ParseException();
0861: }
0862: {
0863: if (true)
0864: return r;
0865: }
0866: throw new Error("Missing return statement in function");
0867: }
0868:
0869: final public void DatatypesDecl() throws ParseException {
0870: LocatedString prefix;
0871: String uri;
0872: noteTopLevelComments();
0873: jj_consume_token(16);
0874: prefix = UnprefixedName();
0875: jj_consume_token(2);
0876: uri = Literal();
0877: datatypesTable.put(prefix.getString(), uri);
0878: }
0879:
0880: final public ParsedPattern AnnotatedPrimaryExpr(boolean topLevel,
0881: Scope scope, Token[] except) throws ParseException {
0882: Annotations a;
0883: ParsedPattern p;
0884: ParsedElementAnnotation e;
0885: Token t;
0886: a = Annotations();
0887: p = PrimaryExpr(topLevel, scope, a, except);
0888: label_5: while (true) {
0889: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0890: case FANNOTATE:
0891: ;
0892: break;
0893: default:
0894: jj_la1[18] = jj_gen;
0895: break label_5;
0896: }
0897: t = jj_consume_token(FANNOTATE);
0898: e = AnnotationElement(false);
0899: if (topLevel)
0900: error("top_level_follow_annotation", t);
0901: else
0902: p = sb.annotateAfter(p, e);
0903: }
0904: {
0905: if (true)
0906: return p;
0907: }
0908: throw new Error("Missing return statement in function");
0909: }
0910:
0911: final public ParsedPattern PrimaryExpr(boolean topLevel,
0912: Scope scope, Annotations a, Token[] except)
0913: throws ParseException {
0914: ParsedPattern p;
0915: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0916: case 26:
0917: p = ElementExpr(scope, a);
0918: break;
0919: case 27:
0920: p = AttributeExpr(scope, a);
0921: break;
0922: case 10:
0923: p = GrammarExpr(scope, a);
0924: break;
0925: case 33:
0926: p = ExternalRefExpr(scope, a);
0927: break;
0928: case 31:
0929: p = ListExpr(scope, a);
0930: break;
0931: case 32:
0932: p = MixedExpr(scope, a);
0933: break;
0934: case 28:
0935: p = ParenExpr(topLevel, scope, a);
0936: break;
0937: case IDENTIFIER:
0938: case ESCAPED_IDENTIFIER:
0939: p = IdentifierExpr(scope, a);
0940: break;
0941: case 34:
0942: p = ParentExpr(scope, a);
0943: break;
0944: case 35:
0945: case 36:
0946: case PREFIXED_NAME:
0947: p = DataExpr(topLevel, scope, a, except);
0948: break;
0949: case LITERAL:
0950: p = ValueExpr(topLevel, a);
0951: break;
0952: case 18:
0953: p = TextExpr(a);
0954: break;
0955: case 17:
0956: p = EmptyExpr(a);
0957: break;
0958: case 19:
0959: p = NotAllowedExpr(a);
0960: break;
0961: default:
0962: jj_la1[19] = jj_gen;
0963: jj_consume_token(-1);
0964: throw new ParseException();
0965: }
0966: {
0967: if (true)
0968: return p;
0969: }
0970: throw new Error("Missing return statement in function");
0971: }
0972:
0973: final public ParsedPattern EmptyExpr(Annotations a)
0974: throws ParseException {
0975: Token t;
0976: t = jj_consume_token(17);
0977: {
0978: if (true)
0979: return sb.makeEmpty(makeLocation(t), a);
0980: }
0981: throw new Error("Missing return statement in function");
0982: }
0983:
0984: final public ParsedPattern TextExpr(Annotations a)
0985: throws ParseException {
0986: Token t;
0987: t = jj_consume_token(18);
0988: {
0989: if (true)
0990: return sb.makeText(makeLocation(t), a);
0991: }
0992: throw new Error("Missing return statement in function");
0993: }
0994:
0995: final public ParsedPattern NotAllowedExpr(Annotations a)
0996: throws ParseException {
0997: Token t;
0998: t = jj_consume_token(19);
0999: {
1000: if (true)
1001: return sb.makeNotAllowed(makeLocation(t), a);
1002: }
1003: throw new Error("Missing return statement in function");
1004: }
1005:
1006: final public ParsedPattern Expr(boolean topLevel, Scope scope,
1007: Token t, Annotations a) throws ParseException {
1008: List patterns = new ArrayList();
1009: ParsedPattern p;
1010: boolean[] hadOccur = new boolean[1];
1011: Token[] except = new Token[1];
1012: p = UnaryExpr(topLevel, scope, hadOccur, except);
1013: patterns.add(p);
1014: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1015: case 20:
1016: case 21:
1017: case 22:
1018: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1019: case 20:
1020: checkExcept(except);
1021: label_6: while (true) {
1022: t = jj_consume_token(20);
1023: p = UnaryExpr(topLevel, scope, null, except);
1024: patterns.add(p);
1025: checkExcept(except);
1026: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1027: case 20:
1028: ;
1029: break;
1030: default:
1031: jj_la1[20] = jj_gen;
1032: break label_6;
1033: }
1034: }
1035: p = sb.makeChoice(patterns, makeLocation(t), a);
1036: break;
1037: case 21:
1038: label_7: while (true) {
1039: t = jj_consume_token(21);
1040: p = UnaryExpr(topLevel, scope, null, except);
1041: patterns.add(p);
1042: checkExcept(except);
1043: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1044: case 21:
1045: ;
1046: break;
1047: default:
1048: jj_la1[21] = jj_gen;
1049: break label_7;
1050: }
1051: }
1052: p = sb.makeInterleave(patterns, makeLocation(t), a);
1053: break;
1054: case 22:
1055: label_8: while (true) {
1056: t = jj_consume_token(22);
1057: p = UnaryExpr(topLevel, scope, null, except);
1058: patterns.add(p);
1059: checkExcept(except);
1060: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1061: case 22:
1062: ;
1063: break;
1064: default:
1065: jj_la1[22] = jj_gen;
1066: break label_8;
1067: }
1068: }
1069: p = sb.makeGroup(patterns, makeLocation(t), a);
1070: break;
1071: default:
1072: jj_la1[23] = jj_gen;
1073: jj_consume_token(-1);
1074: throw new ParseException();
1075: }
1076: break;
1077: default:
1078: jj_la1[24] = jj_gen;
1079: ;
1080: }
1081: if (patterns.size() == 1 && a != null) {
1082: if (hadOccur[0])
1083: p = sb.annotate(p, a);
1084: else
1085: p = sb.makeGroup(patterns, makeLocation(t), a);
1086: }
1087: {
1088: if (true)
1089: return p;
1090: }
1091: throw new Error("Missing return statement in function");
1092: }
1093:
1094: final public ParsedPattern UnaryExpr(boolean topLevel, Scope scope,
1095: boolean[] hadOccur, Token[] except) throws ParseException {
1096: ParsedPattern p;
1097: Token t;
1098: ParsedElementAnnotation e;
1099: p = AnnotatedPrimaryExpr(topLevel, scope, except);
1100: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1101: case 23:
1102: case 24:
1103: case 25:
1104: if (hadOccur != null)
1105: hadOccur[0] = true;
1106: p = afterComments(p);
1107: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1108: case 23:
1109: t = jj_consume_token(23);
1110: checkExcept(except);
1111: p = sb.makeOneOrMore(p, makeLocation(t), null);
1112: break;
1113: case 24:
1114: t = jj_consume_token(24);
1115: checkExcept(except);
1116: p = sb.makeOptional(p, makeLocation(t), null);
1117: break;
1118: case 25:
1119: t = jj_consume_token(25);
1120: checkExcept(except);
1121: p = sb.makeZeroOrMore(p, makeLocation(t), null);
1122: break;
1123: default:
1124: jj_la1[25] = jj_gen;
1125: jj_consume_token(-1);
1126: throw new ParseException();
1127: }
1128: label_9: while (true) {
1129: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1130: case FANNOTATE:
1131: ;
1132: break;
1133: default:
1134: jj_la1[26] = jj_gen;
1135: break label_9;
1136: }
1137: t = jj_consume_token(FANNOTATE);
1138: e = AnnotationElement(false);
1139: if (topLevel)
1140: error("top_level_follow_annotation", t);
1141: else
1142: p = sb.annotateAfter(p, e);
1143: }
1144: break;
1145: default:
1146: jj_la1[27] = jj_gen;
1147: ;
1148: }
1149: {
1150: if (true)
1151: return p;
1152: }
1153: throw new Error("Missing return statement in function");
1154: }
1155:
1156: final public ParsedPattern ElementExpr(Scope scope, Annotations a)
1157: throws ParseException {
1158: Token t;
1159: ParsedNameClass nc;
1160: ParsedPattern p;
1161: t = jj_consume_token(26);
1162: nc = NameClass(IN_ELEMENT, null);
1163: jj_consume_token(11);
1164: p = Expr(false, scope, null, null);
1165: p = afterComments(p);
1166: jj_consume_token(12);
1167: {
1168: if (true)
1169: return sb.makeElement(nc, p, makeLocation(t), a);
1170: }
1171: throw new Error("Missing return statement in function");
1172: }
1173:
1174: final public ParsedPattern AttributeExpr(Scope scope, Annotations a)
1175: throws ParseException {
1176: Token t;
1177: ParsedNameClass nc;
1178: ParsedPattern p;
1179: t = jj_consume_token(27);
1180: nc = NameClass(IN_ATTRIBUTE, null);
1181: jj_consume_token(11);
1182: p = Expr(false, scope, null, null);
1183: p = afterComments(p);
1184: jj_consume_token(12);
1185: {
1186: if (true)
1187: return sb.makeAttribute(nc, p, makeLocation(t), a);
1188: }
1189: throw new Error("Missing return statement in function");
1190: }
1191:
1192: final public ParsedNameClass NameClass(int context, Annotations[] pa)
1193: throws ParseException {
1194: Annotations a;
1195: ParsedNameClass nc;
1196: a = Annotations();
1197: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1198: case 5:
1199: case 6:
1200: case 7:
1201: case 10:
1202: case 13:
1203: case 14:
1204: case 15:
1205: case 16:
1206: case 17:
1207: case 18:
1208: case 19:
1209: case 26:
1210: case 27:
1211: case 28:
1212: case 31:
1213: case 32:
1214: case 33:
1215: case 34:
1216: case 35:
1217: case 36:
1218: case IDENTIFIER:
1219: case ESCAPED_IDENTIFIER:
1220: case PREFIXED_NAME:
1221: nc = PrimaryNameClass(context, a);
1222: nc = AnnotateAfter(nc);
1223: nc = NameClassAlternatives(context, nc, pa);
1224: break;
1225: case 25:
1226: nc = AnyNameExceptClass(context, a, pa);
1227: break;
1228: case PREFIX_STAR:
1229: nc = NsNameExceptClass(context, a, pa);
1230: break;
1231: default:
1232: jj_la1[28] = jj_gen;
1233: jj_consume_token(-1);
1234: throw new ParseException();
1235: }
1236: {
1237: if (true)
1238: return nc;
1239: }
1240: throw new Error("Missing return statement in function");
1241: }
1242:
1243: final public ParsedNameClass AnnotateAfter(ParsedNameClass nc)
1244: throws ParseException {
1245: ParsedElementAnnotation e;
1246: label_10: while (true) {
1247: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1248: case FANNOTATE:
1249: ;
1250: break;
1251: default:
1252: jj_la1[29] = jj_gen;
1253: break label_10;
1254: }
1255: jj_consume_token(FANNOTATE);
1256: e = AnnotationElement(false);
1257: nc = ncb.annotateAfter(nc, e);
1258: }
1259: {
1260: if (true)
1261: return nc;
1262: }
1263: throw new Error("Missing return statement in function");
1264: }
1265:
1266: final public ParsedNameClass NameClassAlternatives(int context,
1267: ParsedNameClass nc, Annotations[] pa) throws ParseException {
1268: Token t;
1269: ParsedNameClass[] nameClasses;
1270: int nNameClasses;
1271: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1272: case 20:
1273: nameClasses = new ParsedNameClass[2];
1274: nameClasses[0] = nc;
1275: nNameClasses = 1;
1276: label_11: while (true) {
1277: t = jj_consume_token(20);
1278: nc = BasicNameClass(context);
1279: nc = AnnotateAfter(nc);
1280: if (nNameClasses >= nameClasses.length) {
1281: ParsedNameClass[] oldNameClasses = nameClasses;
1282: nameClasses = new ParsedNameClass[oldNameClasses.length * 2];
1283: System.arraycopy(oldNameClasses, 0, nameClasses, 0,
1284: oldNameClasses.length);
1285: }
1286: nameClasses[nNameClasses++] = nc;
1287: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1288: case 20:
1289: ;
1290: break;
1291: default:
1292: jj_la1[30] = jj_gen;
1293: break label_11;
1294: }
1295: }
1296: Annotations a;
1297: if (pa == null)
1298: a = null;
1299: else {
1300: a = pa[0];
1301: pa[0] = null;
1302: }
1303: nc = ncb.makeChoice(Arrays.asList(nameClasses).subList(0,
1304: nNameClasses), makeLocation(t), a);
1305: break;
1306: default:
1307: jj_la1[31] = jj_gen;
1308: ;
1309: }
1310: {
1311: if (true)
1312: return nc;
1313: }
1314: throw new Error("Missing return statement in function");
1315: }
1316:
1317: final public ParsedNameClass BasicNameClass(int context)
1318: throws ParseException {
1319: Annotations a;
1320: ParsedNameClass nc;
1321: a = Annotations();
1322: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1323: case 5:
1324: case 6:
1325: case 7:
1326: case 10:
1327: case 13:
1328: case 14:
1329: case 15:
1330: case 16:
1331: case 17:
1332: case 18:
1333: case 19:
1334: case 26:
1335: case 27:
1336: case 28:
1337: case 31:
1338: case 32:
1339: case 33:
1340: case 34:
1341: case 35:
1342: case 36:
1343: case IDENTIFIER:
1344: case ESCAPED_IDENTIFIER:
1345: case PREFIXED_NAME:
1346: nc = PrimaryNameClass(context, a);
1347: break;
1348: case 25:
1349: case PREFIX_STAR:
1350: nc = OpenNameClass(context, a);
1351: break;
1352: default:
1353: jj_la1[32] = jj_gen;
1354: jj_consume_token(-1);
1355: throw new ParseException();
1356: }
1357: {
1358: if (true)
1359: return nc;
1360: }
1361: throw new Error("Missing return statement in function");
1362: }
1363:
1364: final public ParsedNameClass PrimaryNameClass(int context,
1365: Annotations a) throws ParseException {
1366: ParsedNameClass nc;
1367: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1368: case 5:
1369: case 6:
1370: case 7:
1371: case 10:
1372: case 13:
1373: case 14:
1374: case 15:
1375: case 16:
1376: case 17:
1377: case 18:
1378: case 19:
1379: case 26:
1380: case 27:
1381: case 31:
1382: case 32:
1383: case 33:
1384: case 34:
1385: case 35:
1386: case 36:
1387: case IDENTIFIER:
1388: case ESCAPED_IDENTIFIER:
1389: nc = UnprefixedNameClass(context, a);
1390: break;
1391: case PREFIXED_NAME:
1392: nc = PrefixedNameClass(a);
1393: break;
1394: case 28:
1395: nc = ParenNameClass(context, a);
1396: break;
1397: default:
1398: jj_la1[33] = jj_gen;
1399: jj_consume_token(-1);
1400: throw new ParseException();
1401: }
1402: {
1403: if (true)
1404: return nc;
1405: }
1406: throw new Error("Missing return statement in function");
1407: }
1408:
1409: final public ParsedNameClass OpenNameClass(int context,
1410: Annotations a) throws ParseException {
1411: Token t;
1412: LocatedString ns;
1413: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1414: case PREFIX_STAR:
1415: ns = NsName();
1416: checkNsName(context, ns);
1417: {
1418: if (true)
1419: return ncb.makeNsName(ns.getString(), ns
1420: .getLocation(), a);
1421: }
1422: break;
1423: case 25:
1424: t = jj_consume_token(25);
1425: checkAnyName(context, t);
1426: {
1427: if (true)
1428: return ncb.makeAnyName(makeLocation(t), a);
1429: }
1430: break;
1431: default:
1432: jj_la1[34] = jj_gen;
1433: jj_consume_token(-1);
1434: throw new ParseException();
1435: }
1436: throw new Error("Missing return statement in function");
1437: }
1438:
1439: final public ParsedNameClass UnprefixedNameClass(int context,
1440: Annotations a) throws ParseException {
1441: LocatedString name;
1442: name = UnprefixedName();
1443: String ns;
1444: if ((context & (IN_ATTRIBUTE | IN_ELEMENT)) == IN_ATTRIBUTE)
1445: ns = "";
1446: else
1447: ns = defaultNamespace;
1448: {
1449: if (true)
1450: return ncb.makeName(ns, name.getString(), null, name
1451: .getLocation(), a);
1452: }
1453: throw new Error("Missing return statement in function");
1454: }
1455:
1456: final public ParsedNameClass PrefixedNameClass(Annotations a)
1457: throws ParseException {
1458: Token t;
1459: t = jj_consume_token(PREFIXED_NAME);
1460: String qn = t.image;
1461: int colon = qn.indexOf(':');
1462: String prefix = qn.substring(0, colon);
1463: {
1464: if (true)
1465: return ncb.makeName(lookupPrefix(prefix, t), qn
1466: .substring(colon + 1), prefix, makeLocation(t),
1467: a);
1468: }
1469: throw new Error("Missing return statement in function");
1470: }
1471:
1472: final public ParsedNameClass NsNameExceptClass(int context,
1473: Annotations a, Annotations[] pa) throws ParseException {
1474: LocatedString ns;
1475: ParsedNameClass nc;
1476: ns = NsName();
1477: checkNsName(context, ns);
1478: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1479: case 30:
1480: nc = ExceptNameClass(context | IN_NS_NAME);
1481: nc = ncb
1482: .makeNsName(ns.getString(), nc, ns.getLocation(), a);
1483: nc = AnnotateAfter(nc);
1484: break;
1485: default:
1486: jj_la1[35] = jj_gen;
1487: nc = ncb.makeNsName(ns.getString(), ns.getLocation(), a);
1488: nc = AnnotateAfter(nc);
1489: nc = NameClassAlternatives(context, nc, pa);
1490: }
1491: {
1492: if (true)
1493: return nc;
1494: }
1495: throw new Error("Missing return statement in function");
1496: }
1497:
1498: final public LocatedString NsName() throws ParseException {
1499: Token t;
1500: t = jj_consume_token(PREFIX_STAR);
1501: String qn = t.image;
1502: String prefix = qn.substring(0, qn.length() - 2);
1503: {
1504: if (true)
1505: return new LocatedString(lookupPrefix(prefix, t), t);
1506: }
1507: throw new Error("Missing return statement in function");
1508: }
1509:
1510: final public ParsedNameClass AnyNameExceptClass(int context,
1511: Annotations a, Annotations[] pa) throws ParseException {
1512: Token t;
1513: ParsedNameClass nc;
1514: t = jj_consume_token(25);
1515: checkAnyName(context, t);
1516: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1517: case 30:
1518: nc = ExceptNameClass(context | IN_ANY_NAME);
1519: nc = ncb.makeAnyName(nc, makeLocation(t), a);
1520: nc = AnnotateAfter(nc);
1521: break;
1522: default:
1523: jj_la1[36] = jj_gen;
1524: nc = ncb.makeAnyName(makeLocation(t), a);
1525: nc = AnnotateAfter(nc);
1526: nc = NameClassAlternatives(context, nc, pa);
1527: }
1528: {
1529: if (true)
1530: return nc;
1531: }
1532: throw new Error("Missing return statement in function");
1533: }
1534:
1535: final public ParsedNameClass ParenNameClass(int context,
1536: Annotations a) throws ParseException {
1537: Token t;
1538: ParsedNameClass nc;
1539: Annotations[] pa = new Annotations[] { a };
1540: t = jj_consume_token(28);
1541: nc = NameClass(context, pa);
1542: nc = afterComments(nc);
1543: jj_consume_token(29);
1544: if (pa[0] != null)
1545: nc = ncb.makeChoice(Collections.singletonList(nc),
1546: makeLocation(t), pa[0]);
1547: {
1548: if (true)
1549: return nc;
1550: }
1551: throw new Error("Missing return statement in function");
1552: }
1553:
1554: final public ParsedNameClass ExceptNameClass(int context)
1555: throws ParseException {
1556: ParsedNameClass nc;
1557: jj_consume_token(30);
1558: nc = BasicNameClass(context);
1559: {
1560: if (true)
1561: return nc;
1562: }
1563: throw new Error("Missing return statement in function");
1564: }
1565:
1566: final public ParsedPattern ListExpr(Scope scope, Annotations a)
1567: throws ParseException {
1568: Token t;
1569: ParsedPattern p;
1570: t = jj_consume_token(31);
1571: jj_consume_token(11);
1572: p = Expr(false, scope, null, null);
1573: p = afterComments(p);
1574: jj_consume_token(12);
1575: {
1576: if (true)
1577: return sb.makeList(p, makeLocation(t), a);
1578: }
1579: throw new Error("Missing return statement in function");
1580: }
1581:
1582: final public ParsedPattern MixedExpr(Scope scope, Annotations a)
1583: throws ParseException {
1584: Token t;
1585: ParsedPattern p;
1586: t = jj_consume_token(32);
1587: jj_consume_token(11);
1588: p = Expr(false, scope, null, null);
1589: p = afterComments(p);
1590: jj_consume_token(12);
1591: {
1592: if (true)
1593: return sb.makeMixed(p, makeLocation(t), a);
1594: }
1595: throw new Error("Missing return statement in function");
1596: }
1597:
1598: final public ParsedPattern GrammarExpr(Scope scope, Annotations a)
1599: throws ParseException {
1600: Token t;
1601: Grammar g;
1602: t = jj_consume_token(10);
1603: g = sb.makeGrammar(scope);
1604: jj_consume_token(11);
1605: a = GrammarBody(g, g, a);
1606: topLevelComments(g);
1607: jj_consume_token(12);
1608: {
1609: if (true)
1610: return g.endGrammar(makeLocation(t), a);
1611: }
1612: throw new Error("Missing return statement in function");
1613: }
1614:
1615: final public ParsedPattern ParenExpr(boolean topLevel, Scope scope,
1616: Annotations a) throws ParseException {
1617: Token t;
1618: ParsedPattern p;
1619: t = jj_consume_token(28);
1620: p = Expr(topLevel, scope, t, a);
1621: p = afterComments(p);
1622: jj_consume_token(29);
1623: {
1624: if (true)
1625: return p;
1626: }
1627: throw new Error("Missing return statement in function");
1628: }
1629:
1630: final public Annotations GrammarBody(GrammarSection section,
1631: Scope scope, Annotations a) throws ParseException {
1632: ParsedElementAnnotation e;
1633: label_12: while (true) {
1634: if (jj_2_3(2)) {
1635: ;
1636: } else {
1637: break label_12;
1638: }
1639: e = AnnotationElementNotKeyword();
1640: if (a == null)
1641: a = sb.makeAnnotations(null, getContext());
1642: a.addElement(e);
1643: }
1644: label_13: while (true) {
1645: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1646: case 1:
1647: case 5:
1648: case 6:
1649: case 7:
1650: case DOCUMENTATION:
1651: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
1652: case IDENTIFIER:
1653: case ESCAPED_IDENTIFIER:
1654: ;
1655: break;
1656: default:
1657: jj_la1[37] = jj_gen;
1658: break label_13;
1659: }
1660: GrammarComponent(section, scope);
1661: }
1662: {
1663: if (true)
1664: return a;
1665: }
1666: throw new Error("Missing return statement in function");
1667: }
1668:
1669: final public void GrammarComponent(GrammarSection section,
1670: Scope scope) throws ParseException {
1671: ParsedElementAnnotation e;
1672: Annotations a;
1673: a = Annotations();
1674: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1675: case 5:
1676: case IDENTIFIER:
1677: case ESCAPED_IDENTIFIER:
1678: Definition(section, scope, a);
1679: break;
1680: case 7:
1681: Include(section, scope, a);
1682: break;
1683: case 6:
1684: Div(section, scope, a);
1685: break;
1686: default:
1687: jj_la1[38] = jj_gen;
1688: jj_consume_token(-1);
1689: throw new ParseException();
1690: }
1691: label_14: while (true) {
1692: if (jj_2_4(2)) {
1693: ;
1694: } else {
1695: break label_14;
1696: }
1697: e = AnnotationElementNotKeyword();
1698: section.topLevelAnnotation(e);
1699: }
1700: }
1701:
1702: final public void Definition(GrammarSection section, Scope scope,
1703: Annotations a) throws ParseException {
1704: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1705: case IDENTIFIER:
1706: case ESCAPED_IDENTIFIER:
1707: Define(section, scope, a);
1708: break;
1709: case 5:
1710: Start(section, scope, a);
1711: break;
1712: default:
1713: jj_la1[39] = jj_gen;
1714: jj_consume_token(-1);
1715: throw new ParseException();
1716: }
1717: }
1718:
1719: final public void Start(GrammarSection section, Scope scope,
1720: Annotations a) throws ParseException {
1721: Token t;
1722: GrammarSection.Combine combine;
1723: ParsedPattern p;
1724: t = jj_consume_token(5);
1725: combine = AssignOp();
1726: p = Expr(false, scope, null, null);
1727: section.define(GrammarSection.START, combine, p,
1728: makeLocation(t), a);
1729: }
1730:
1731: final public void Define(GrammarSection section, Scope scope,
1732: Annotations a) throws ParseException {
1733: LocatedString name;
1734: GrammarSection.Combine combine;
1735: ParsedPattern p;
1736: name = Identifier();
1737: combine = AssignOp();
1738: p = Expr(false, scope, null, null);
1739: section.define(name.getString(), combine, p,
1740: name.getLocation(), a);
1741: }
1742:
1743: final public GrammarSection.Combine AssignOp()
1744: throws ParseException {
1745: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1746: case 2:
1747: jj_consume_token(2);
1748: {
1749: if (true)
1750: return null;
1751: }
1752: break;
1753: case 4:
1754: jj_consume_token(4);
1755: {
1756: if (true)
1757: return GrammarSection.COMBINE_CHOICE;
1758: }
1759: break;
1760: case 3:
1761: jj_consume_token(3);
1762: {
1763: if (true)
1764: return GrammarSection.COMBINE_INTERLEAVE;
1765: }
1766: break;
1767: default:
1768: jj_la1[40] = jj_gen;
1769: jj_consume_token(-1);
1770: throw new ParseException();
1771: }
1772: throw new Error("Missing return statement in function");
1773: }
1774:
1775: final public void Include(GrammarSection section, Scope scope,
1776: Annotations a) throws ParseException {
1777: Token t;
1778: String href;
1779: String ns;
1780: Include include = section.makeInclude();
1781: t = jj_consume_token(7);
1782: href = Literal();
1783: ns = Inherit();
1784: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1785: case 11:
1786: jj_consume_token(11);
1787: a = IncludeBody(include, scope, a);
1788: topLevelComments(include);
1789: jj_consume_token(12);
1790: break;
1791: default:
1792: jj_la1[41] = jj_gen;
1793: ;
1794: }
1795: try {
1796: include.endInclude(parseable, resolve(href), ns,
1797: makeLocation(t), a);
1798: } catch (IllegalSchemaException e) {
1799: }
1800: }
1801:
1802: final public Annotations IncludeBody(GrammarSection section,
1803: Scope scope, Annotations a) throws ParseException {
1804: ParsedElementAnnotation e;
1805: label_15: while (true) {
1806: if (jj_2_5(2)) {
1807: ;
1808: } else {
1809: break label_15;
1810: }
1811: e = AnnotationElementNotKeyword();
1812: if (a == null)
1813: a = sb.makeAnnotations(null, getContext());
1814: a.addElement(e);
1815: }
1816: label_16: while (true) {
1817: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1818: case 1:
1819: case 5:
1820: case 6:
1821: case DOCUMENTATION:
1822: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
1823: case IDENTIFIER:
1824: case ESCAPED_IDENTIFIER:
1825: ;
1826: break;
1827: default:
1828: jj_la1[42] = jj_gen;
1829: break label_16;
1830: }
1831: IncludeComponent(section, scope);
1832: }
1833: {
1834: if (true)
1835: return a;
1836: }
1837: throw new Error("Missing return statement in function");
1838: }
1839:
1840: final public void IncludeComponent(GrammarSection section,
1841: Scope scope) throws ParseException {
1842: ParsedElementAnnotation e;
1843: Annotations a;
1844: a = Annotations();
1845: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1846: case 5:
1847: case IDENTIFIER:
1848: case ESCAPED_IDENTIFIER:
1849: Definition(section, scope, a);
1850: break;
1851: case 6:
1852: IncludeDiv(section, scope, a);
1853: break;
1854: default:
1855: jj_la1[43] = jj_gen;
1856: jj_consume_token(-1);
1857: throw new ParseException();
1858: }
1859: label_17: while (true) {
1860: if (jj_2_6(2)) {
1861: ;
1862: } else {
1863: break label_17;
1864: }
1865: e = AnnotationElementNotKeyword();
1866: section.topLevelAnnotation(e);
1867: }
1868: }
1869:
1870: final public void Div(GrammarSection section, Scope scope,
1871: Annotations a) throws ParseException {
1872: Token t;
1873: Div div = section.makeDiv();
1874: t = jj_consume_token(6);
1875: jj_consume_token(11);
1876: a = GrammarBody(div, scope, a);
1877: topLevelComments(div);
1878: jj_consume_token(12);
1879: div.endDiv(makeLocation(t), a);
1880: }
1881:
1882: final public void IncludeDiv(GrammarSection section, Scope scope,
1883: Annotations a) throws ParseException {
1884: Token t;
1885: Div div = section.makeDiv();
1886: t = jj_consume_token(6);
1887: jj_consume_token(11);
1888: a = IncludeBody(div, scope, a);
1889: topLevelComments(div);
1890: jj_consume_token(12);
1891: div.endDiv(makeLocation(t), a);
1892: }
1893:
1894: final public ParsedPattern ExternalRefExpr(Scope scope,
1895: Annotations a) throws ParseException {
1896: Token t;
1897: String href;
1898: String ns;
1899: t = jj_consume_token(33);
1900: href = Literal();
1901: ns = Inherit();
1902: try {
1903: {
1904: if (true)
1905: return sb.makeExternalRef(parseable, resolve(href),
1906: ns, scope, makeLocation(t), a);
1907: }
1908: } catch (IllegalSchemaException e) {
1909: {
1910: if (true)
1911: return sb.makeErrorPattern();
1912: }
1913: }
1914: throw new Error("Missing return statement in function");
1915: }
1916:
1917: final public String Inherit() throws ParseException {
1918: String ns = null;
1919: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
1920: case 15:
1921: jj_consume_token(15);
1922: jj_consume_token(2);
1923: ns = Prefix();
1924: break;
1925: default:
1926: jj_la1[44] = jj_gen;
1927: ;
1928: }
1929: if (ns == null)
1930: ns = defaultNamespace;
1931: {
1932: if (true)
1933: return ns;
1934: }
1935: throw new Error("Missing return statement in function");
1936: }
1937:
1938: final public ParsedPattern ParentExpr(Scope scope, Annotations a)
1939: throws ParseException {
1940: LocatedString name;
1941: jj_consume_token(34);
1942: a = addCommentsToChildAnnotations(a);
1943: name = Identifier();
1944: if (scope == null) {
1945: error("parent_ref_outside_grammar", name.getToken());
1946: {
1947: if (true)
1948: return sb.makeErrorPattern();
1949: }
1950: } else {
1951: {
1952: if (true)
1953: return scope.makeParentRef(name.getString(), name
1954: .getLocation(), a);
1955: }
1956: }
1957: throw new Error("Missing return statement in function");
1958: }
1959:
1960: final public ParsedPattern IdentifierExpr(Scope scope, Annotations a)
1961: throws ParseException {
1962: LocatedString name;
1963: name = Identifier();
1964: if (scope == null) {
1965: error("ref_outside_grammar", name.getToken());
1966: {
1967: if (true)
1968: return sb.makeErrorPattern();
1969: }
1970: } else {
1971: {
1972: if (true)
1973: return scope.makeRef(name.getString(), name
1974: .getLocation(), a);
1975: }
1976: }
1977: throw new Error("Missing return statement in function");
1978: }
1979:
1980: final public ParsedPattern ValueExpr(boolean topLevel, Annotations a)
1981: throws ParseException {
1982: LocatedString s;
1983: s = LocatedLiteral();
1984: if (topLevel && annotationsIncludeElements) {
1985: error("top_level_follow_annotation", s.getToken());
1986: a = null;
1987: }
1988: {
1989: if (true)
1990: return sb.makeValue("", "token", s.getString(),
1991: getContext(), defaultNamespace,
1992: s.getLocation(), a);
1993: }
1994: throw new Error("Missing return statement in function");
1995: }
1996:
1997: final public ParsedPattern DataExpr(boolean topLevel, Scope scope,
1998: Annotations a, Token[] except) throws ParseException {
1999: Token datatypeToken;
2000: Location loc;
2001: String datatype;
2002: String datatypeUri = null;
2003: String s = null;
2004: ParsedPattern e = null;
2005: DataPatternBuilder dpb;
2006: datatypeToken = DatatypeName();
2007: datatype = datatypeToken.image;
2008: loc = makeLocation(datatypeToken);
2009: int colon = datatype.indexOf(':');
2010: if (colon < 0)
2011: datatypeUri = "";
2012: else {
2013: String prefix = datatype.substring(0, colon);
2014: datatypeUri = lookupDatatype(prefix, datatypeToken);
2015: datatype = datatype.substring(colon + 1);
2016: }
2017: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2018: case LITERAL:
2019: s = Literal();
2020: if (topLevel && annotationsIncludeElements) {
2021: error("top_level_follow_annotation", datatypeToken);
2022: a = null;
2023: }
2024: {
2025: if (true)
2026: return sb.makeValue(datatypeUri, datatype, s,
2027: getContext(), defaultNamespace, loc, a);
2028: }
2029: break;
2030: default:
2031: jj_la1[48] = jj_gen;
2032: dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc);
2033: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2034: case 11:
2035: Params(dpb);
2036: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2037: case 30:
2038: e = Except(scope, except);
2039: break;
2040: default:
2041: jj_la1[45] = jj_gen;
2042: ;
2043: }
2044: break;
2045: default:
2046: jj_la1[47] = jj_gen;
2047: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2048: case 30:
2049: e = Except(scope, except);
2050: break;
2051: default:
2052: jj_la1[46] = jj_gen;
2053: ;
2054: }
2055: }
2056: {
2057: if (true)
2058: return e == null ? dpb.makePattern(loc, a) : dpb
2059: .makePattern(e, loc, a);
2060: }
2061: }
2062: throw new Error("Missing return statement in function");
2063: }
2064:
2065: final public Token DatatypeName() throws ParseException {
2066: Token t;
2067: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2068: case 35:
2069: t = jj_consume_token(35);
2070: break;
2071: case 36:
2072: t = jj_consume_token(36);
2073: break;
2074: case PREFIXED_NAME:
2075: t = jj_consume_token(PREFIXED_NAME);
2076: break;
2077: default:
2078: jj_la1[49] = jj_gen;
2079: jj_consume_token(-1);
2080: throw new ParseException();
2081: }
2082: {
2083: if (true)
2084: return t;
2085: }
2086: throw new Error("Missing return statement in function");
2087: }
2088:
2089: final public LocatedString Identifier() throws ParseException {
2090: LocatedString s;
2091: Token t;
2092: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2093: case IDENTIFIER:
2094: t = jj_consume_token(IDENTIFIER);
2095: s = new LocatedString(t.image, t);
2096: break;
2097: case ESCAPED_IDENTIFIER:
2098: t = jj_consume_token(ESCAPED_IDENTIFIER);
2099: s = new LocatedString(t.image.substring(1), t);
2100: break;
2101: default:
2102: jj_la1[50] = jj_gen;
2103: jj_consume_token(-1);
2104: throw new ParseException();
2105: }
2106: {
2107: if (true)
2108: return s;
2109: }
2110: throw new Error("Missing return statement in function");
2111: }
2112:
2113: final public String Prefix() throws ParseException {
2114: Token t;
2115: String prefix;
2116: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2117: case IDENTIFIER:
2118: t = jj_consume_token(IDENTIFIER);
2119: prefix = t.image;
2120: break;
2121: case ESCAPED_IDENTIFIER:
2122: t = jj_consume_token(ESCAPED_IDENTIFIER);
2123: prefix = t.image.substring(1);
2124: break;
2125: case 5:
2126: case 6:
2127: case 7:
2128: case 10:
2129: case 13:
2130: case 14:
2131: case 15:
2132: case 16:
2133: case 17:
2134: case 18:
2135: case 19:
2136: case 26:
2137: case 27:
2138: case 31:
2139: case 32:
2140: case 33:
2141: case 34:
2142: case 35:
2143: case 36:
2144: t = Keyword();
2145: prefix = t.image;
2146: break;
2147: default:
2148: jj_la1[51] = jj_gen;
2149: jj_consume_token(-1);
2150: throw new ParseException();
2151: }
2152: {
2153: if (true)
2154: return lookupPrefix(prefix, t);
2155: }
2156: throw new Error("Missing return statement in function");
2157: }
2158:
2159: final public LocatedString UnprefixedName() throws ParseException {
2160: LocatedString s;
2161: Token t;
2162: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2163: case IDENTIFIER:
2164: case ESCAPED_IDENTIFIER:
2165: s = Identifier();
2166: break;
2167: case 5:
2168: case 6:
2169: case 7:
2170: case 10:
2171: case 13:
2172: case 14:
2173: case 15:
2174: case 16:
2175: case 17:
2176: case 18:
2177: case 19:
2178: case 26:
2179: case 27:
2180: case 31:
2181: case 32:
2182: case 33:
2183: case 34:
2184: case 35:
2185: case 36:
2186: t = Keyword();
2187: s = new LocatedString(t.image, t);
2188: break;
2189: default:
2190: jj_la1[52] = jj_gen;
2191: jj_consume_token(-1);
2192: throw new ParseException();
2193: }
2194: {
2195: if (true)
2196: return s;
2197: }
2198: throw new Error("Missing return statement in function");
2199: }
2200:
2201: final public void Params(DataPatternBuilder dpb)
2202: throws ParseException {
2203: jj_consume_token(11);
2204: label_18: while (true) {
2205: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2206: case 1:
2207: case 5:
2208: case 6:
2209: case 7:
2210: case 10:
2211: case 13:
2212: case 14:
2213: case 15:
2214: case 16:
2215: case 17:
2216: case 18:
2217: case 19:
2218: case 26:
2219: case 27:
2220: case 31:
2221: case 32:
2222: case 33:
2223: case 34:
2224: case 35:
2225: case 36:
2226: case DOCUMENTATION:
2227: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
2228: case IDENTIFIER:
2229: case ESCAPED_IDENTIFIER:
2230: ;
2231: break;
2232: default:
2233: jj_la1[53] = jj_gen;
2234: break label_18;
2235: }
2236: Param(dpb);
2237: }
2238: jj_consume_token(12);
2239: }
2240:
2241: final public void Param(DataPatternBuilder dpb)
2242: throws ParseException {
2243: LocatedString name;
2244: Annotations a;
2245: String value;
2246: a = Annotations();
2247: name = UnprefixedName();
2248: jj_consume_token(2);
2249: a = addCommentsToLeadingAnnotations(a);
2250: value = Literal();
2251: dpb.addParam(name.getString(), value, getContext(),
2252: defaultNamespace, name.getLocation(), a);
2253: }
2254:
2255: final public ParsedPattern Except(Scope scope, Token[] except)
2256: throws ParseException {
2257: Annotations a;
2258: ParsedPattern p;
2259: Token t;
2260: Token[] innerExcept = new Token[1];
2261: t = jj_consume_token(30);
2262: a = Annotations();
2263: p = PrimaryExpr(false, scope, a, innerExcept);
2264: checkExcept(innerExcept);
2265: except[0] = t;
2266: {
2267: if (true)
2268: return p;
2269: }
2270: throw new Error("Missing return statement in function");
2271: }
2272:
2273: final public ParsedElementAnnotation Documentation()
2274: throws ParseException {
2275: CommentList comments = getComments();
2276: ElementAnnotationBuilder eab;
2277: Token t;
2278: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2279: case DOCUMENTATION:
2280: t = jj_consume_token(DOCUMENTATION);
2281: break;
2282: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
2283: t = jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT);
2284: break;
2285: default:
2286: jj_la1[54] = jj_gen;
2287: jj_consume_token(-1);
2288: throw new ParseException();
2289: }
2290: eab = sb.makeElementAnnotationBuilder(
2291: WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS,
2292: "documentation", getCompatibilityPrefix(),
2293: makeLocation(t), comments, getContext());
2294: eab.addText(mungeComment(t.image), makeLocation(t), null);
2295: label_19: while (true) {
2296: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2297: case DOCUMENTATION_CONTINUE:
2298: ;
2299: break;
2300: default:
2301: jj_la1[55] = jj_gen;
2302: break label_19;
2303: }
2304: t = jj_consume_token(DOCUMENTATION_CONTINUE);
2305: eab.addText("\n" + mungeComment(t.image), makeLocation(t),
2306: null);
2307: }
2308: {
2309: if (true)
2310: return eab.makeElementAnnotation();
2311: }
2312: throw new Error("Missing return statement in function");
2313: }
2314:
2315: final public Annotations Annotations() throws ParseException {
2316: CommentList comments = getComments();
2317: Annotations a = null;
2318: ParsedElementAnnotation e;
2319: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2320: case DOCUMENTATION:
2321: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
2322: a = sb.makeAnnotations(comments, getContext());
2323: label_20: while (true) {
2324: e = Documentation();
2325: a.addElement(e);
2326: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2327: case DOCUMENTATION:
2328: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
2329: ;
2330: break;
2331: default:
2332: jj_la1[56] = jj_gen;
2333: break label_20;
2334: }
2335: }
2336: comments = getComments();
2337: if (comments != null)
2338: a.addLeadingComment(comments);
2339: break;
2340: default:
2341: jj_la1[57] = jj_gen;
2342: ;
2343: }
2344: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2345: case 1:
2346: jj_consume_token(1);
2347: if (a == null)
2348: a = sb.makeAnnotations(comments, getContext());
2349: clearAttributeList();
2350: annotationsIncludeElements = false;
2351: label_21: while (true) {
2352: if (jj_2_7(2)) {
2353: ;
2354: } else {
2355: break label_21;
2356: }
2357: PrefixedAnnotationAttribute(a, false);
2358: }
2359: label_22: while (true) {
2360: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2361: case 5:
2362: case 6:
2363: case 7:
2364: case 10:
2365: case 13:
2366: case 14:
2367: case 15:
2368: case 16:
2369: case 17:
2370: case 18:
2371: case 19:
2372: case 26:
2373: case 27:
2374: case 31:
2375: case 32:
2376: case 33:
2377: case 34:
2378: case 35:
2379: case 36:
2380: case IDENTIFIER:
2381: case ESCAPED_IDENTIFIER:
2382: case PREFIXED_NAME:
2383: ;
2384: break;
2385: default:
2386: jj_la1[58] = jj_gen;
2387: break label_22;
2388: }
2389: e = AnnotationElement(false);
2390: a.addElement(e);
2391: annotationsIncludeElements = true;
2392: }
2393: a.addComment(getComments());
2394: jj_consume_token(9);
2395: break;
2396: default:
2397: jj_la1[59] = jj_gen;
2398: ;
2399: }
2400: if (a == null && comments != null)
2401: a = sb.makeAnnotations(comments, getContext());
2402: {
2403: if (true)
2404: return a;
2405: }
2406: throw new Error("Missing return statement in function");
2407: }
2408:
2409: final public void AnnotationAttribute(Annotations a)
2410: throws ParseException {
2411: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2412: case PREFIXED_NAME:
2413: PrefixedAnnotationAttribute(a, true);
2414: break;
2415: case 5:
2416: case 6:
2417: case 7:
2418: case 10:
2419: case 13:
2420: case 14:
2421: case 15:
2422: case 16:
2423: case 17:
2424: case 18:
2425: case 19:
2426: case 26:
2427: case 27:
2428: case 31:
2429: case 32:
2430: case 33:
2431: case 34:
2432: case 35:
2433: case 36:
2434: case IDENTIFIER:
2435: case ESCAPED_IDENTIFIER:
2436: UnprefixedAnnotationAttribute(a);
2437: break;
2438: default:
2439: jj_la1[60] = jj_gen;
2440: jj_consume_token(-1);
2441: throw new ParseException();
2442: }
2443: }
2444:
2445: final public void PrefixedAnnotationAttribute(Annotations a,
2446: boolean nested) throws ParseException {
2447: Token t;
2448: String value;
2449: t = jj_consume_token(PREFIXED_NAME);
2450: jj_consume_token(2);
2451: value = Literal();
2452: String qn = t.image;
2453: int colon = qn.indexOf(':');
2454: String prefix = qn.substring(0, colon);
2455: String ns = lookupPrefix(prefix, t);
2456: if (ns == this .inheritedNs)
2457: error("inherited_annotation_namespace", t);
2458: else if (ns.length() == 0 && !nested)
2459: error("unqualified_annotation_attribute", t);
2460: else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested)
2461: error("relax_ng_namespace", t);
2462: /*else if (ns.length() == 0
2463: && qn.length() - colon - 1 == 5
2464: && qn.regionMatches(colon + 1, "xmlns", 0, 5))
2465: error("xmlns_annotation_attribute", t);*/
2466: else if (ns.equals(WellKnownNamespaces.XMLNS))
2467: error("xmlns_annotation_attribute_uri", t);
2468: else {
2469: if (ns.length() == 0)
2470: prefix = null;
2471: addAttribute(a, ns, qn.substring(colon + 1), prefix, value,
2472: t);
2473: }
2474: }
2475:
2476: final public void UnprefixedAnnotationAttribute(Annotations a)
2477: throws ParseException {
2478: LocatedString name;
2479: String value;
2480: name = UnprefixedName();
2481: jj_consume_token(2);
2482: value = Literal();
2483: if (name.getString().equals("xmlns"))
2484: error("xmlns_annotation_attribute", name.getToken());
2485: else
2486: addAttribute(a, "", name.getString(), null, value, name
2487: .getToken());
2488: }
2489:
2490: final public ParsedElementAnnotation AnnotationElement(
2491: boolean nested) throws ParseException {
2492: ParsedElementAnnotation a;
2493: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2494: case PREFIXED_NAME:
2495: a = PrefixedAnnotationElement(nested);
2496: break;
2497: case 5:
2498: case 6:
2499: case 7:
2500: case 10:
2501: case 13:
2502: case 14:
2503: case 15:
2504: case 16:
2505: case 17:
2506: case 18:
2507: case 19:
2508: case 26:
2509: case 27:
2510: case 31:
2511: case 32:
2512: case 33:
2513: case 34:
2514: case 35:
2515: case 36:
2516: case IDENTIFIER:
2517: case ESCAPED_IDENTIFIER:
2518: a = UnprefixedAnnotationElement();
2519: break;
2520: default:
2521: jj_la1[61] = jj_gen;
2522: jj_consume_token(-1);
2523: throw new ParseException();
2524: }
2525: {
2526: if (true)
2527: return a;
2528: }
2529: throw new Error("Missing return statement in function");
2530: }
2531:
2532: final public ParsedElementAnnotation AnnotationElementNotKeyword()
2533: throws ParseException {
2534: ParsedElementAnnotation a;
2535: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2536: case PREFIXED_NAME:
2537: a = PrefixedAnnotationElement(false);
2538: break;
2539: case IDENTIFIER:
2540: case ESCAPED_IDENTIFIER:
2541: a = IdentifierAnnotationElement();
2542: break;
2543: default:
2544: jj_la1[62] = jj_gen;
2545: jj_consume_token(-1);
2546: throw new ParseException();
2547: }
2548: {
2549: if (true)
2550: return a;
2551: }
2552: throw new Error("Missing return statement in function");
2553: }
2554:
2555: final public ParsedElementAnnotation PrefixedAnnotationElement(
2556: boolean nested) throws ParseException {
2557: CommentList comments = getComments();
2558: Token t;
2559: ElementAnnotationBuilder eab;
2560: t = jj_consume_token(PREFIXED_NAME);
2561: String qn = t.image;
2562: int colon = qn.indexOf(':');
2563: String prefix = qn.substring(0, colon);
2564: String ns = lookupPrefix(prefix, t);
2565: if (ns == this .inheritedNs) {
2566: error("inherited_annotation_namespace", t);
2567: ns = "";
2568: } else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) {
2569: error("relax_ng_namespace", t);
2570: ns = "";
2571: } else {
2572: if (ns.length() == 0)
2573: prefix = null;
2574: }
2575: eab = sb.makeElementAnnotationBuilder(ns, qn
2576: .substring(colon + 1), prefix, makeLocation(t),
2577: comments, getContext());
2578: AnnotationElementContent(eab);
2579: {
2580: if (true)
2581: return eab.makeElementAnnotation();
2582: }
2583: throw new Error("Missing return statement in function");
2584: }
2585:
2586: final public ParsedElementAnnotation UnprefixedAnnotationElement()
2587: throws ParseException {
2588: CommentList comments = getComments();
2589: LocatedString name;
2590: ElementAnnotationBuilder eab;
2591: name = UnprefixedName();
2592: eab = sb.makeElementAnnotationBuilder("", name.getString(),
2593: null, name.getLocation(), comments, getContext());
2594: AnnotationElementContent(eab);
2595: {
2596: if (true)
2597: return eab.makeElementAnnotation();
2598: }
2599: throw new Error("Missing return statement in function");
2600: }
2601:
2602: final public ParsedElementAnnotation IdentifierAnnotationElement()
2603: throws ParseException {
2604: CommentList comments = getComments();
2605: LocatedString name;
2606: ElementAnnotationBuilder eab;
2607: name = Identifier();
2608: eab = sb.makeElementAnnotationBuilder("", name.getString(),
2609: null, name.getLocation(), comments, getContext());
2610: AnnotationElementContent(eab);
2611: {
2612: if (true)
2613: return eab.makeElementAnnotation();
2614: }
2615: throw new Error("Missing return statement in function");
2616: }
2617:
2618: final public void AnnotationElementContent(
2619: ElementAnnotationBuilder eab) throws ParseException {
2620: ParsedElementAnnotation e;
2621: jj_consume_token(1);
2622: clearAttributeList();
2623: label_23: while (true) {
2624: if (jj_2_8(2)) {
2625: ;
2626: } else {
2627: break label_23;
2628: }
2629: AnnotationAttribute(eab);
2630: }
2631: label_24: while (true) {
2632: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2633: case 5:
2634: case 6:
2635: case 7:
2636: case 10:
2637: case 13:
2638: case 14:
2639: case 15:
2640: case 16:
2641: case 17:
2642: case 18:
2643: case 19:
2644: case 26:
2645: case 27:
2646: case 31:
2647: case 32:
2648: case 33:
2649: case 34:
2650: case 35:
2651: case 36:
2652: case IDENTIFIER:
2653: case ESCAPED_IDENTIFIER:
2654: case PREFIXED_NAME:
2655: case LITERAL:
2656: ;
2657: break;
2658: default:
2659: jj_la1[63] = jj_gen;
2660: break label_24;
2661: }
2662: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2663: case LITERAL:
2664: AnnotationElementLiteral(eab);
2665: label_25: while (true) {
2666: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2667: case 8:
2668: ;
2669: break;
2670: default:
2671: jj_la1[64] = jj_gen;
2672: break label_25;
2673: }
2674: jj_consume_token(8);
2675: AnnotationElementLiteral(eab);
2676: }
2677: break;
2678: case 5:
2679: case 6:
2680: case 7:
2681: case 10:
2682: case 13:
2683: case 14:
2684: case 15:
2685: case 16:
2686: case 17:
2687: case 18:
2688: case 19:
2689: case 26:
2690: case 27:
2691: case 31:
2692: case 32:
2693: case 33:
2694: case 34:
2695: case 35:
2696: case 36:
2697: case IDENTIFIER:
2698: case ESCAPED_IDENTIFIER:
2699: case PREFIXED_NAME:
2700: e = AnnotationElement(true);
2701: eab.addElement(e);
2702: break;
2703: default:
2704: jj_la1[65] = jj_gen;
2705: jj_consume_token(-1);
2706: throw new ParseException();
2707: }
2708: }
2709: eab.addComment(getComments());
2710: jj_consume_token(9);
2711: }
2712:
2713: final public void AnnotationElementLiteral(
2714: ElementAnnotationBuilder eab) throws ParseException {
2715: Token t;
2716: CommentList comments = getComments();
2717: t = jj_consume_token(LITERAL);
2718: eab.addText(unquote(t.image), makeLocation(t), comments);
2719: }
2720:
2721: final public String Literal() throws ParseException {
2722: Token t;
2723: String s;
2724: StringBuffer buf;
2725: t = jj_consume_token(LITERAL);
2726: s = unquote(t.image);
2727: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2728: case 8:
2729: buf = new StringBuffer(s);
2730: label_26: while (true) {
2731: jj_consume_token(8);
2732: t = jj_consume_token(LITERAL);
2733: buf.append(unquote(t.image));
2734: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2735: case 8:
2736: ;
2737: break;
2738: default:
2739: jj_la1[66] = jj_gen;
2740: break label_26;
2741: }
2742: }
2743: s = buf.toString();
2744: break;
2745: default:
2746: jj_la1[67] = jj_gen;
2747: ;
2748: }
2749: {
2750: if (true)
2751: return s;
2752: }
2753: throw new Error("Missing return statement in function");
2754: }
2755:
2756: final public LocatedString LocatedLiteral() throws ParseException {
2757: Token t;
2758: Token t2;
2759: String s;
2760: StringBuffer buf;
2761: t = jj_consume_token(LITERAL);
2762: s = unquote(t.image);
2763: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2764: case 8:
2765: buf = new StringBuffer(s);
2766: label_27: while (true) {
2767: jj_consume_token(8);
2768: t2 = jj_consume_token(LITERAL);
2769: buf.append(unquote(t2.image));
2770: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2771: case 8:
2772: ;
2773: break;
2774: default:
2775: jj_la1[68] = jj_gen;
2776: break label_27;
2777: }
2778: }
2779: s = buf.toString();
2780: break;
2781: default:
2782: jj_la1[69] = jj_gen;
2783: ;
2784: }
2785: {
2786: if (true)
2787: return new LocatedString(s, t);
2788: }
2789: throw new Error("Missing return statement in function");
2790: }
2791:
2792: final public Token Keyword() throws ParseException {
2793: Token t;
2794: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
2795: case 26:
2796: t = jj_consume_token(26);
2797: break;
2798: case 27:
2799: t = jj_consume_token(27);
2800: break;
2801: case 13:
2802: t = jj_consume_token(13);
2803: break;
2804: case 31:
2805: t = jj_consume_token(31);
2806: break;
2807: case 32:
2808: t = jj_consume_token(32);
2809: break;
2810: case 10:
2811: t = jj_consume_token(10);
2812: break;
2813: case 17:
2814: t = jj_consume_token(17);
2815: break;
2816: case 18:
2817: t = jj_consume_token(18);
2818: break;
2819: case 34:
2820: t = jj_consume_token(34);
2821: break;
2822: case 33:
2823: t = jj_consume_token(33);
2824: break;
2825: case 19:
2826: t = jj_consume_token(19);
2827: break;
2828: case 5:
2829: t = jj_consume_token(5);
2830: break;
2831: case 7:
2832: t = jj_consume_token(7);
2833: break;
2834: case 14:
2835: t = jj_consume_token(14);
2836: break;
2837: case 15:
2838: t = jj_consume_token(15);
2839: break;
2840: case 35:
2841: t = jj_consume_token(35);
2842: break;
2843: case 36:
2844: t = jj_consume_token(36);
2845: break;
2846: case 16:
2847: t = jj_consume_token(16);
2848: break;
2849: case 6:
2850: t = jj_consume_token(6);
2851: break;
2852: default:
2853: jj_la1[70] = jj_gen;
2854: jj_consume_token(-1);
2855: throw new ParseException();
2856: }
2857: {
2858: if (true)
2859: return t;
2860: }
2861: throw new Error("Missing return statement in function");
2862: }
2863:
2864: final private boolean jj_2_1(int xla) {
2865: jj_la = xla;
2866: jj_lastpos = jj_scanpos = token;
2867: try {
2868: return !jj_3_1();
2869: } catch (LookaheadSuccess ls) {
2870: return true;
2871: } finally {
2872: jj_save(0, xla);
2873: }
2874: }
2875:
2876: final private boolean jj_2_2(int xla) {
2877: jj_la = xla;
2878: jj_lastpos = jj_scanpos = token;
2879: try {
2880: return !jj_3_2();
2881: } catch (LookaheadSuccess ls) {
2882: return true;
2883: } finally {
2884: jj_save(1, xla);
2885: }
2886: }
2887:
2888: final private boolean jj_2_3(int xla) {
2889: jj_la = xla;
2890: jj_lastpos = jj_scanpos = token;
2891: try {
2892: return !jj_3_3();
2893: } catch (LookaheadSuccess ls) {
2894: return true;
2895: } finally {
2896: jj_save(2, xla);
2897: }
2898: }
2899:
2900: final private boolean jj_2_4(int xla) {
2901: jj_la = xla;
2902: jj_lastpos = jj_scanpos = token;
2903: try {
2904: return !jj_3_4();
2905: } catch (LookaheadSuccess ls) {
2906: return true;
2907: } finally {
2908: jj_save(3, xla);
2909: }
2910: }
2911:
2912: final private boolean jj_2_5(int xla) {
2913: jj_la = xla;
2914: jj_lastpos = jj_scanpos = token;
2915: try {
2916: return !jj_3_5();
2917: } catch (LookaheadSuccess ls) {
2918: return true;
2919: } finally {
2920: jj_save(4, xla);
2921: }
2922: }
2923:
2924: final private boolean jj_2_6(int xla) {
2925: jj_la = xla;
2926: jj_lastpos = jj_scanpos = token;
2927: try {
2928: return !jj_3_6();
2929: } catch (LookaheadSuccess ls) {
2930: return true;
2931: } finally {
2932: jj_save(5, xla);
2933: }
2934: }
2935:
2936: final private boolean jj_2_7(int xla) {
2937: jj_la = xla;
2938: jj_lastpos = jj_scanpos = token;
2939: try {
2940: return !jj_3_7();
2941: } catch (LookaheadSuccess ls) {
2942: return true;
2943: } finally {
2944: jj_save(6, xla);
2945: }
2946: }
2947:
2948: final private boolean jj_2_8(int xla) {
2949: jj_la = xla;
2950: jj_lastpos = jj_scanpos = token;
2951: try {
2952: return !jj_3_8();
2953: } catch (LookaheadSuccess ls) {
2954: return true;
2955: } finally {
2956: jj_save(7, xla);
2957: }
2958: }
2959:
2960: final private boolean jj_3R_43() {
2961: if (jj_scan_token(1))
2962: return true;
2963: Token xsp;
2964: while (true) {
2965: xsp = jj_scanpos;
2966: if (jj_3R_52()) {
2967: jj_scanpos = xsp;
2968: break;
2969: }
2970: }
2971: if (jj_scan_token(9))
2972: return true;
2973: return false;
2974: }
2975:
2976: final private boolean jj_3R_51() {
2977: if (jj_scan_token(ESCAPED_IDENTIFIER))
2978: return true;
2979: return false;
2980: }
2981:
2982: final private boolean jj_3R_50() {
2983: if (jj_scan_token(IDENTIFIER))
2984: return true;
2985: return false;
2986: }
2987:
2988: final private boolean jj_3R_41() {
2989: Token xsp;
2990: xsp = jj_scanpos;
2991: if (jj_3R_50()) {
2992: jj_scanpos = xsp;
2993: if (jj_3R_51())
2994: return true;
2995: }
2996: return false;
2997: }
2998:
2999: final private boolean jj_3R_47() {
3000: if (jj_scan_token(PREFIXED_NAME))
3001: return true;
3002: if (jj_3R_56())
3003: return true;
3004: return false;
3005: }
3006:
3007: final private boolean jj_3R_55() {
3008: Token xsp;
3009: xsp = jj_scanpos;
3010: if (jj_scan_token(40)) {
3011: jj_scanpos = xsp;
3012: if (jj_scan_token(43))
3013: return true;
3014: }
3015: while (true) {
3016: xsp = jj_scanpos;
3017: if (jj_scan_token(41)) {
3018: jj_scanpos = xsp;
3019: break;
3020: }
3021: }
3022: return false;
3023: }
3024:
3025: final private boolean jj_3R_45() {
3026: Token xsp;
3027: if (jj_3R_55())
3028: return true;
3029: while (true) {
3030: xsp = jj_scanpos;
3031: if (jj_3R_55()) {
3032: jj_scanpos = xsp;
3033: break;
3034: }
3035: }
3036: return false;
3037: }
3038:
3039: final private boolean jj_3R_38() {
3040: if (jj_3R_48())
3041: return true;
3042: return false;
3043: }
3044:
3045: final private boolean jj_3R_42() {
3046: Token xsp;
3047: xsp = jj_scanpos;
3048: if (jj_scan_token(5)) {
3049: jj_scanpos = xsp;
3050: if (jj_scan_token(6)) {
3051: jj_scanpos = xsp;
3052: if (jj_scan_token(7))
3053: return true;
3054: }
3055: }
3056: return false;
3057: }
3058:
3059: final private boolean jj_3R_37() {
3060: if (jj_3R_47())
3061: return true;
3062: return false;
3063: }
3064:
3065: final private boolean jj_3R_54() {
3066: if (jj_3R_42())
3067: return true;
3068: return false;
3069: }
3070:
3071: final private boolean jj_3R_29() {
3072: Token xsp;
3073: xsp = jj_scanpos;
3074: if (jj_3R_37()) {
3075: jj_scanpos = xsp;
3076: if (jj_3R_38())
3077: return true;
3078: }
3079: return false;
3080: }
3081:
3082: final private boolean jj_3R_44() {
3083: Token xsp;
3084: xsp = jj_scanpos;
3085: if (jj_3R_53()) {
3086: jj_scanpos = xsp;
3087: if (jj_3R_54())
3088: return true;
3089: }
3090: return false;
3091: }
3092:
3093: final private boolean jj_3R_53() {
3094: if (jj_3R_41())
3095: return true;
3096: Token xsp;
3097: xsp = jj_scanpos;
3098: if (jj_scan_token(2)) {
3099: jj_scanpos = xsp;
3100: if (jj_scan_token(3)) {
3101: jj_scanpos = xsp;
3102: if (jj_scan_token(4))
3103: return true;
3104: }
3105: }
3106: return false;
3107: }
3108:
3109: final private boolean jj_3R_36() {
3110: if (jj_3R_45())
3111: return true;
3112: Token xsp;
3113: xsp = jj_scanpos;
3114: if (jj_3R_46())
3115: jj_scanpos = xsp;
3116: if (jj_3R_44())
3117: return true;
3118: return false;
3119: }
3120:
3121: final private boolean jj_3R_35() {
3122: if (jj_3R_43())
3123: return true;
3124: if (jj_3R_44())
3125: return true;
3126: return false;
3127: }
3128:
3129: final private boolean jj_3R_34() {
3130: if (jj_3R_42())
3131: return true;
3132: return false;
3133: }
3134:
3135: final private boolean jj_3R_33() {
3136: if (jj_3R_41())
3137: return true;
3138: Token xsp;
3139: xsp = jj_scanpos;
3140: if (jj_scan_token(1)) {
3141: jj_scanpos = xsp;
3142: if (jj_scan_token(2)) {
3143: jj_scanpos = xsp;
3144: if (jj_scan_token(3)) {
3145: jj_scanpos = xsp;
3146: if (jj_scan_token(4))
3147: return true;
3148: }
3149: }
3150: }
3151: return false;
3152: }
3153:
3154: final private boolean jj_3_1() {
3155: if (jj_3R_28())
3156: return true;
3157: return false;
3158: }
3159:
3160: final private boolean jj_3R_32() {
3161: if (jj_scan_token(PREFIXED_NAME))
3162: return true;
3163: if (jj_scan_token(1))
3164: return true;
3165: return false;
3166: }
3167:
3168: final private boolean jj_3R_28() {
3169: Token xsp;
3170: xsp = jj_scanpos;
3171: if (jj_3R_32()) {
3172: jj_scanpos = xsp;
3173: if (jj_3R_33()) {
3174: jj_scanpos = xsp;
3175: if (jj_3R_34()) {
3176: jj_scanpos = xsp;
3177: if (jj_3R_35()) {
3178: jj_scanpos = xsp;
3179: if (jj_3R_36())
3180: return true;
3181: }
3182: }
3183: }
3184: }
3185: return false;
3186: }
3187:
3188: final private boolean jj_3R_59() {
3189: if (jj_3R_43())
3190: return true;
3191: return false;
3192: }
3193:
3194: final private boolean jj_3_8() {
3195: if (jj_3R_31())
3196: return true;
3197: return false;
3198: }
3199:
3200: final private boolean jj_3R_56() {
3201: if (jj_scan_token(1))
3202: return true;
3203: return false;
3204: }
3205:
3206: final private boolean jj_3R_49() {
3207: if (jj_3R_57())
3208: return true;
3209: if (jj_scan_token(2))
3210: return true;
3211: return false;
3212: }
3213:
3214: final private boolean jj_3R_40() {
3215: if (jj_3R_49())
3216: return true;
3217: return false;
3218: }
3219:
3220: final private boolean jj_3_4() {
3221: if (jj_3R_29())
3222: return true;
3223: return false;
3224: }
3225:
3226: final private boolean jj_3R_48() {
3227: if (jj_3R_41())
3228: return true;
3229: if (jj_3R_56())
3230: return true;
3231: return false;
3232: }
3233:
3234: final private boolean jj_3_3() {
3235: if (jj_3R_29())
3236: return true;
3237: return false;
3238: }
3239:
3240: final private boolean jj_3_6() {
3241: if (jj_3R_29())
3242: return true;
3243: return false;
3244: }
3245:
3246: final private boolean jj_3R_62() {
3247: Token xsp;
3248: xsp = jj_scanpos;
3249: if (jj_scan_token(26)) {
3250: jj_scanpos = xsp;
3251: if (jj_scan_token(27)) {
3252: jj_scanpos = xsp;
3253: if (jj_scan_token(13)) {
3254: jj_scanpos = xsp;
3255: if (jj_scan_token(31)) {
3256: jj_scanpos = xsp;
3257: if (jj_scan_token(32)) {
3258: jj_scanpos = xsp;
3259: if (jj_scan_token(10)) {
3260: jj_scanpos = xsp;
3261: if (jj_scan_token(17)) {
3262: jj_scanpos = xsp;
3263: if (jj_scan_token(18)) {
3264: jj_scanpos = xsp;
3265: if (jj_scan_token(34)) {
3266: jj_scanpos = xsp;
3267: if (jj_scan_token(33)) {
3268: jj_scanpos = xsp;
3269: if (jj_scan_token(19)) {
3270: jj_scanpos = xsp;
3271: if (jj_scan_token(5)) {
3272: jj_scanpos = xsp;
3273: if (jj_scan_token(7)) {
3274: jj_scanpos = xsp;
3275: if (jj_scan_token(14)) {
3276: jj_scanpos = xsp;
3277: if (jj_scan_token(15)) {
3278: jj_scanpos = xsp;
3279: if (jj_scan_token(35)) {
3280: jj_scanpos = xsp;
3281: if (jj_scan_token(36)) {
3282: jj_scanpos = xsp;
3283: if (jj_scan_token(16)) {
3284: jj_scanpos = xsp;
3285: if (jj_scan_token(6))
3286: return true;
3287: }
3288: }
3289: }
3290: }
3291: }
3292: }
3293: }
3294: }
3295: }
3296: }
3297: }
3298: }
3299: }
3300: }
3301: }
3302: }
3303: }
3304: }
3305: return false;
3306: }
3307:
3308: final private boolean jj_3R_61() {
3309: if (jj_3R_62())
3310: return true;
3311: return false;
3312: }
3313:
3314: final private boolean jj_3_2() {
3315: if (jj_3R_28())
3316: return true;
3317: return false;
3318: }
3319:
3320: final private boolean jj_3R_30() {
3321: if (jj_scan_token(PREFIXED_NAME))
3322: return true;
3323: if (jj_scan_token(2))
3324: return true;
3325: return false;
3326: }
3327:
3328: final private boolean jj_3R_60() {
3329: if (jj_3R_41())
3330: return true;
3331: return false;
3332: }
3333:
3334: final private boolean jj_3R_58() {
3335: if (jj_3R_57())
3336: return true;
3337: return false;
3338: }
3339:
3340: final private boolean jj_3R_57() {
3341: Token xsp;
3342: xsp = jj_scanpos;
3343: if (jj_3R_60()) {
3344: jj_scanpos = xsp;
3345: if (jj_3R_61())
3346: return true;
3347: }
3348: return false;
3349: }
3350:
3351: final private boolean jj_3_5() {
3352: if (jj_3R_29())
3353: return true;
3354: return false;
3355: }
3356:
3357: final private boolean jj_3R_31() {
3358: Token xsp;
3359: xsp = jj_scanpos;
3360: if (jj_3R_39()) {
3361: jj_scanpos = xsp;
3362: if (jj_3R_40())
3363: return true;
3364: }
3365: return false;
3366: }
3367:
3368: final private boolean jj_3R_39() {
3369: if (jj_3R_30())
3370: return true;
3371: return false;
3372: }
3373:
3374: final private boolean jj_3_7() {
3375: if (jj_3R_30())
3376: return true;
3377: return false;
3378: }
3379:
3380: final private boolean jj_3R_46() {
3381: if (jj_3R_43())
3382: return true;
3383: return false;
3384: }
3385:
3386: final private boolean jj_3R_52() {
3387: Token xsp;
3388: xsp = jj_scanpos;
3389: if (jj_scan_token(57)) {
3390: jj_scanpos = xsp;
3391: if (jj_3R_58()) {
3392: jj_scanpos = xsp;
3393: if (jj_scan_token(2)) {
3394: jj_scanpos = xsp;
3395: if (jj_scan_token(58)) {
3396: jj_scanpos = xsp;
3397: if (jj_scan_token(8)) {
3398: jj_scanpos = xsp;
3399: if (jj_3R_59())
3400: return true;
3401: }
3402: }
3403: }
3404: }
3405: }
3406: return false;
3407: }
3408:
3409: public CompactSyntaxTokenManager token_source;
3410: JavaCharStream jj_input_stream;
3411: public Token token, jj_nt;
3412: private int jj_ntk;
3413: private Token jj_scanpos, jj_lastpos;
3414: private int jj_la;
3415: public boolean lookingAhead = false;
3416: private boolean jj_semLA;
3417: private int jj_gen;
3418: final private int[] jj_la1 = new int[71];
3419: static private int[] jj_la1_0;
3420: static private int[] jj_la1_1;
3421: static {
3422: jj_la1_0();
3423: jj_la1_1();
3424: }
3425:
3426: private static void jj_la1_0() {
3427: jj_la1_0 = new int[] { 0x9c0e0402, 0x1e, 0x2, 0xe2, 0x1c, 0xe0,
3428: 0xe0, 0x0, 0x0, 0x0, 0x8c0fe5e6, 0x8c0fe5e6, 0x402,
3429: 0x16000, 0x16000, 0x8c0fe4e0, 0x6000, 0x8000, 0x0,
3430: 0x9c0e0400, 0x100000, 0x200000, 0x400000, 0x700000,
3431: 0x700000, 0x3800000, 0x0, 0x3800000, 0x9e0fe4e0, 0x0,
3432: 0x100000, 0x100000, 0x9e0fe4e0, 0x9c0fe4e0, 0x2000000,
3433: 0x40000000, 0x40000000, 0xe2, 0xe0, 0x20, 0x1c, 0x800,
3434: 0x62, 0x60, 0x8000, 0x40000000, 0x40000000, 0x800, 0x0,
3435: 0x0, 0x0, 0x8c0fe4e0, 0x8c0fe4e0, 0x8c0fe4e2, 0x0, 0x0,
3436: 0x0, 0x0, 0x8c0fe4e0, 0x2, 0x8c0fe4e0, 0x8c0fe4e0, 0x0,
3437: 0x8c0fe4e0, 0x100, 0x8c0fe4e0, 0x100, 0x100, 0x100,
3438: 0x100, 0x8c0fe4e0, };
3439: }
3440:
3441: private static void jj_la1_1() {
3442: jj_la1_1 = new int[] { 0x6c0091f, 0x0, 0x0, 0x2c00900, 0x0,
3443: 0xc00000, 0x0, 0x900, 0x200, 0x900, 0x6c0001f,
3444: 0x6c0001f, 0x900, 0x0, 0x0, 0xc0001f, 0x0, 0x4000000,
3445: 0x8000000, 0x6c0001f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3446: 0x8000000, 0x0, 0x3c0001f, 0x8000000, 0x0, 0x0,
3447: 0x3c0001f, 0x2c0001f, 0x1000000, 0x0, 0x0, 0xc00900,
3448: 0xc00000, 0xc00000, 0x0, 0x0, 0xc00900, 0xc00000, 0x0,
3449: 0x0, 0x0, 0x0, 0x4000000, 0x2000018, 0xc00000,
3450: 0xc0001f, 0xc0001f, 0xc0091f, 0x900, 0x200, 0x900,
3451: 0x900, 0x2c0001f, 0x0, 0x2c0001f, 0x2c0001f, 0x2c00000,
3452: 0x6c0001f, 0x0, 0x6c0001f, 0x0, 0x0, 0x0, 0x0, 0x1f, };
3453: }
3454:
3455: final private JJCalls[] jj_2_rtns = new JJCalls[8];
3456: private boolean jj_rescan = false;
3457: private int jj_gc = 0;
3458:
3459: public CompactSyntax(java.io.InputStream stream) {
3460: jj_input_stream = new JavaCharStream(stream, 1, 1);
3461: token_source = new CompactSyntaxTokenManager(jj_input_stream);
3462: token = new Token();
3463: jj_ntk = -1;
3464: jj_gen = 0;
3465: for (int i = 0; i < 71; i++)
3466: jj_la1[i] = -1;
3467: for (int i = 0; i < jj_2_rtns.length; i++)
3468: jj_2_rtns[i] = new JJCalls();
3469: }
3470:
3471: public void ReInit(java.io.InputStream stream) {
3472: jj_input_stream.ReInit(stream, 1, 1);
3473: token_source.ReInit(jj_input_stream);
3474: token = new Token();
3475: jj_ntk = -1;
3476: jj_gen = 0;
3477: for (int i = 0; i < 71; i++)
3478: jj_la1[i] = -1;
3479: for (int i = 0; i < jj_2_rtns.length; i++)
3480: jj_2_rtns[i] = new JJCalls();
3481: }
3482:
3483: public CompactSyntax(java.io.Reader stream) {
3484: jj_input_stream = new JavaCharStream(stream, 1, 1);
3485: token_source = new CompactSyntaxTokenManager(jj_input_stream);
3486: token = new Token();
3487: jj_ntk = -1;
3488: jj_gen = 0;
3489: for (int i = 0; i < 71; i++)
3490: jj_la1[i] = -1;
3491: for (int i = 0; i < jj_2_rtns.length; i++)
3492: jj_2_rtns[i] = new JJCalls();
3493: }
3494:
3495: public void ReInit(java.io.Reader stream) {
3496: jj_input_stream.ReInit(stream, 1, 1);
3497: token_source.ReInit(jj_input_stream);
3498: token = new Token();
3499: jj_ntk = -1;
3500: jj_gen = 0;
3501: for (int i = 0; i < 71; i++)
3502: jj_la1[i] = -1;
3503: for (int i = 0; i < jj_2_rtns.length; i++)
3504: jj_2_rtns[i] = new JJCalls();
3505: }
3506:
3507: public CompactSyntax(CompactSyntaxTokenManager tm) {
3508: token_source = tm;
3509: token = new Token();
3510: jj_ntk = -1;
3511: jj_gen = 0;
3512: for (int i = 0; i < 71; i++)
3513: jj_la1[i] = -1;
3514: for (int i = 0; i < jj_2_rtns.length; i++)
3515: jj_2_rtns[i] = new JJCalls();
3516: }
3517:
3518: public void ReInit(CompactSyntaxTokenManager tm) {
3519: token_source = tm;
3520: token = new Token();
3521: jj_ntk = -1;
3522: jj_gen = 0;
3523: for (int i = 0; i < 71; i++)
3524: jj_la1[i] = -1;
3525: for (int i = 0; i < jj_2_rtns.length; i++)
3526: jj_2_rtns[i] = new JJCalls();
3527: }
3528:
3529: final private Token jj_consume_token(int kind)
3530: throws ParseException {
3531: Token oldToken;
3532: if ((oldToken = token).next != null)
3533: token = token.next;
3534: else
3535: token = token.next = token_source.getNextToken();
3536: jj_ntk = -1;
3537: if (token.kind == kind) {
3538: jj_gen++;
3539: if (++jj_gc > 100) {
3540: jj_gc = 0;
3541: for (int i = 0; i < jj_2_rtns.length; i++) {
3542: JJCalls c = jj_2_rtns[i];
3543: while (c != null) {
3544: if (c.gen < jj_gen)
3545: c.first = null;
3546: c = c.next;
3547: }
3548: }
3549: }
3550: return token;
3551: }
3552: token = oldToken;
3553: jj_kind = kind;
3554: throw generateParseException();
3555: }
3556:
3557: static private final class LookaheadSuccess extends java.lang.Error {
3558: }
3559:
3560: final private LookaheadSuccess jj_ls = new LookaheadSuccess();
3561:
3562: final private boolean jj_scan_token(int kind) {
3563: if (jj_scanpos == jj_lastpos) {
3564: jj_la--;
3565: if (jj_scanpos.next == null) {
3566: jj_lastpos = jj_scanpos = jj_scanpos.next = token_source
3567: .getNextToken();
3568: } else {
3569: jj_lastpos = jj_scanpos = jj_scanpos.next;
3570: }
3571: } else {
3572: jj_scanpos = jj_scanpos.next;
3573: }
3574: if (jj_rescan) {
3575: int i = 0;
3576: Token tok = token;
3577: while (tok != null && tok != jj_scanpos) {
3578: i++;
3579: tok = tok.next;
3580: }
3581: if (tok != null)
3582: jj_add_error_token(kind, i);
3583: }
3584: if (jj_scanpos.kind != kind)
3585: return true;
3586: if (jj_la == 0 && jj_scanpos == jj_lastpos)
3587: throw jj_ls;
3588: return false;
3589: }
3590:
3591: final public Token getNextToken() {
3592: if (token.next != null)
3593: token = token.next;
3594: else
3595: token = token.next = token_source.getNextToken();
3596: jj_ntk = -1;
3597: jj_gen++;
3598: return token;
3599: }
3600:
3601: final public Token getToken(int index) {
3602: Token t = lookingAhead ? jj_scanpos : token;
3603: for (int i = 0; i < index; i++) {
3604: if (t.next != null)
3605: t = t.next;
3606: else
3607: t = t.next = token_source.getNextToken();
3608: }
3609: return t;
3610: }
3611:
3612: final private int jj_ntk() {
3613: if ((jj_nt = token.next) == null)
3614: return (jj_ntk = (token.next = token_source.getNextToken()).kind);
3615: else
3616: return (jj_ntk = jj_nt.kind);
3617: }
3618:
3619: private java.util.Vector jj_expentries = new java.util.Vector();
3620: private int[] jj_expentry;
3621: private int jj_kind = -1;
3622: private int[] jj_lasttokens = new int[100];
3623: private int jj_endpos;
3624:
3625: private void jj_add_error_token(int kind, int pos) {
3626: if (pos >= 100)
3627: return;
3628: if (pos == jj_endpos + 1) {
3629: jj_lasttokens[jj_endpos++] = kind;
3630: } else if (jj_endpos != 0) {
3631: jj_expentry = new int[jj_endpos];
3632: for (int i = 0; i < jj_endpos; i++) {
3633: jj_expentry[i] = jj_lasttokens[i];
3634: }
3635: boolean exists = false;
3636: for (java.util.Enumeration e = jj_expentries.elements(); e
3637: .hasMoreElements();) {
3638: int[] oldentry = (int[]) (e.nextElement());
3639: if (oldentry.length == jj_expentry.length) {
3640: exists = true;
3641: for (int i = 0; i < jj_expentry.length; i++) {
3642: if (oldentry[i] != jj_expentry[i]) {
3643: exists = false;
3644: break;
3645: }
3646: }
3647: if (exists)
3648: break;
3649: }
3650: }
3651: if (!exists)
3652: jj_expentries.addElement(jj_expentry);
3653: if (pos != 0)
3654: jj_lasttokens[(jj_endpos = pos) - 1] = kind;
3655: }
3656: }
3657:
3658: public ParseException generateParseException() {
3659: jj_expentries.removeAllElements();
3660: boolean[] la1tokens = new boolean[61];
3661: for (int i = 0; i < 61; i++) {
3662: la1tokens[i] = false;
3663: }
3664: if (jj_kind >= 0) {
3665: la1tokens[jj_kind] = true;
3666: jj_kind = -1;
3667: }
3668: for (int i = 0; i < 71; i++) {
3669: if (jj_la1[i] == jj_gen) {
3670: for (int j = 0; j < 32; j++) {
3671: if ((jj_la1_0[i] & (1 << j)) != 0) {
3672: la1tokens[j] = true;
3673: }
3674: if ((jj_la1_1[i] & (1 << j)) != 0) {
3675: la1tokens[32 + j] = true;
3676: }
3677: }
3678: }
3679: }
3680: for (int i = 0; i < 61; i++) {
3681: if (la1tokens[i]) {
3682: jj_expentry = new int[1];
3683: jj_expentry[0] = i;
3684: jj_expentries.addElement(jj_expentry);
3685: }
3686: }
3687: jj_endpos = 0;
3688: jj_rescan_token();
3689: jj_add_error_token(0, 0);
3690: int[][] exptokseq = new int[jj_expentries.size()][];
3691: for (int i = 0; i < jj_expentries.size(); i++) {
3692: exptokseq[i] = (int[]) jj_expentries.elementAt(i);
3693: }
3694: return new ParseException(token, exptokseq, tokenImage);
3695: }
3696:
3697: final public void enable_tracing() {
3698: }
3699:
3700: final public void disable_tracing() {
3701: }
3702:
3703: final private void jj_rescan_token() {
3704: jj_rescan = true;
3705: for (int i = 0; i < 8; i++) {
3706: JJCalls p = jj_2_rtns[i];
3707: do {
3708: if (p.gen > jj_gen) {
3709: jj_la = p.arg;
3710: jj_lastpos = jj_scanpos = p.first;
3711: switch (i) {
3712: case 0:
3713: jj_3_1();
3714: break;
3715: case 1:
3716: jj_3_2();
3717: break;
3718: case 2:
3719: jj_3_3();
3720: break;
3721: case 3:
3722: jj_3_4();
3723: break;
3724: case 4:
3725: jj_3_5();
3726: break;
3727: case 5:
3728: jj_3_6();
3729: break;
3730: case 6:
3731: jj_3_7();
3732: break;
3733: case 7:
3734: jj_3_8();
3735: break;
3736: }
3737: }
3738: p = p.next;
3739: } while (p != null);
3740: }
3741: jj_rescan = false;
3742: }
3743:
3744: final private void jj_save(int index, int xla) {
3745: JJCalls p = jj_2_rtns[index];
3746: while (p.gen > jj_gen) {
3747: if (p.next == null) {
3748: p = p.next = new JJCalls();
3749: break;
3750: }
3751: p = p.next;
3752: }
3753: p.gen = jj_gen + xla - jj_la;
3754: p.first = token;
3755: p.arg = xla;
3756: }
3757:
3758: static final class JJCalls {
3759: int gen;
3760: Token first;
3761: int arg;
3762: JJCalls next;
3763: }
3764:
3765: }
|