com.sun.xml.internal.rngom.ast.builder.Annotations Java Examples

The following examples show how to use com.sun.xml.internal.rngom.ast.builder.Annotations. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaBuilderHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeChoice(List patterns,
    Location _loc, Annotations _anno) throws BuildException {

    List<ParsedPattern> lp = new ArrayList<ParsedPattern>();
    List<ParsedPattern> rp = new ArrayList<ParsedPattern>();
    for( int i=0; i<patterns.size(); i++ ) {
        lp.add( ((ParsedPatternHost)patterns.get(i)).lhs);
        rp.add( ((ParsedPatternHost)patterns.get(i)).rhs);
    }
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeChoice(lp, loc.lhs, anno.lhs),
        rhs.makeChoice(rp, loc.rhs, anno.rhs));
}
 
Example #2
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
final public ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) throws ParseException {
LocatedString ns;
ParsedNameClass nc;
  ns = NsName();
  checkNsName(context, ns);
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case 30:
    nc = ExceptNameClass(context | IN_NS_NAME);
   nc = ncb.makeNsName(ns.getString(), nc, ns.getLocation(), a);
    nc = AnnotateAfter(nc);
    break;
  default:
    jj_la1[35] = jj_gen;
    nc = ncb.makeNsName(ns.getString(), ns.getLocation(), a);
    nc = AnnotateAfter(nc);
    nc = NameClassAlternatives(context, nc, pa);
  }
  {if (true) return nc;}
  throw new Error("Missing return statement in function");
}
 
Example #3
Source File: CompactSyntax.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern ValueExpr(boolean topLevel, Annotations a) throws ParseException {
LocatedString s;
  s = LocatedLiteral();
  if (topLevel && annotationsIncludeElements) {
    error("top_level_follow_annotation", s.getToken());
    a = null;
  }
  {if (true) return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a);}
  throw new Error("Missing return statement in function");
}
 
Example #4
Source File: SchemaBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern annotate(ParsedPattern _p, Annotations _anno)
    throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    AnnotationsHost a = cast(_anno);

    return new ParsedPatternHost(
        lhs.annotate(p.lhs, a.lhs),
        rhs.annotate(p.lhs, a.lhs) );
}
 
Example #5
Source File: NameClassBuilderHost.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedNameClass makeNsName(String ns, ParsedNameClass _except, Location _loc, Annotations _anno) {
    ParsedNameClassHost except = (ParsedNameClassHost) _except;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedNameClassHost(
        lhs.makeNsName( ns, except.lhs, loc.lhs, anno.lhs ),
        rhs.makeNsName( ns, except.rhs, loc.rhs, anno.rhs ) );
}
 
Example #6
Source File: SchemaBuilderImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeChoice(List patterns, Location loc, Annotations anno)
        throws BuildException {
    if (patterns.isEmpty()) {
        throw new IllegalArgumentException();
    }
    Pattern result = (Pattern) patterns.get(0);
    for (int i = 1; i < patterns.size(); i++) {
        result = pb.makeChoice(result, (Pattern) patterns.get(i));
    }
    return result;
}
 
Example #7
Source File: GrammarHost.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern endGrammar(Location _loc, Annotations _anno) throws BuildException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.endGrammar(loc.lhs, anno.lhs),
        rhs.endGrammar(loc.rhs, anno.rhs));
}
 
Example #8
Source File: CompactSyntax.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern MixedExpr(Scope scope, Annotations a) throws ParseException {
Token t;
ParsedPattern p;
  t = jj_consume_token(32);
  jj_consume_token(11);
  p = Expr(false, scope, null, null);
  p = afterComments(p);
  jj_consume_token(12);
  {if (true) return sb.makeMixed(p, makeLocation(t), a);}
  throw new Error("Missing return statement in function");
}
 
Example #9
Source File: SchemaBuilderHost.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Annotations makeAnnotations(CommentList _comments, Context context) {
    CommentListHost comments = (CommentListHost) _comments;
    Annotations l = lhs.makeAnnotations((comments!=null)?comments.lhs:null, context);
    Annotations r = rhs.makeAnnotations((comments!=null)?comments.rhs:null, context);
    if(l==null || r==null)
        throw new IllegalArgumentException("annotations cannot be null");
    return new AnnotationsHost(l,r);
}
 
Example #10
Source File: CompactSyntax.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
final public void IncludeComponent(GrammarSection section, Scope scope) throws ParseException {
ParsedElementAnnotation e;
Annotations a;
  a = Annotations();
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case 5:
  case IDENTIFIER:
  case ESCAPED_IDENTIFIER:
    Definition(section, scope, a);
    break;
  case 6:
    IncludeDiv(section, scope, a);
    break;
  default:
    jj_la1[43] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  label_17:
  while (true) {
    if (jj_2_6(2)) {
      ;
    } else {
      break label_17;
    }
    e = AnnotationElementNotKeyword();
                                                  section.topLevelAnnotation(e);
  }
}
 
Example #11
Source File: DataPatternBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makePattern(ParsedPattern _except, Location _loc, Annotations _anno) throws BuildException {
    ParsedPatternHost except = (ParsedPatternHost) _except;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makePattern(except.lhs, loc.lhs, anno.lhs),
        rhs.makePattern(except.rhs, loc.rhs, anno.rhs));
}
 
Example #12
Source File: ScopeHost.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeParentRef(String name, Location _loc, Annotations _anno) throws BuildException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeParentRef(name, loc.lhs, anno.lhs),
        rhs.makeParentRef(name, loc.rhs, anno.rhs));
}
 
Example #13
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern Except(Scope scope, Token[] except) throws ParseException {
Annotations a;
ParsedPattern p;
Token t;
Token[] innerExcept = new Token[1];
  t = jj_consume_token(30);
  a = Annotations();
  p = PrimaryExpr(false, scope, a, innerExcept);
  checkExcept(innerExcept);
  except[0] = t;
  {if (true) return p;}
  throw new Error("Missing return statement in function");
}
 
Example #14
Source File: CompactSyntax.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
final public void GrammarComponent(GrammarSection section, Scope scope) throws ParseException {
ParsedElementAnnotation e;
Annotations a;
  a = Annotations();
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case 5:
  case IDENTIFIER:
  case ESCAPED_IDENTIFIER:
    Definition(section, scope, a);
    break;
  case 7:
    Include(section, scope, a);
    break;
  case 6:
    Div(section, scope, a);
    break;
  default:
    jj_la1[38] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  label_14:
  while (true) {
    if (jj_2_4(2)) {
      ;
    } else {
      break label_14;
    }
    e = AnnotationElementNotKeyword();
                                                  section.topLevelAnnotation(e);
  }
}
 
Example #15
Source File: CompactSyntax.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern MixedExpr(Scope scope, Annotations a) throws ParseException {
Token t;
ParsedPattern p;
  t = jj_consume_token(32);
  jj_consume_token(11);
  p = Expr(false, scope, null, null);
  p = afterComments(p);
  jj_consume_token(12);
  {if (true) return sb.makeMixed(p, makeLocation(t), a);}
  throw new Error("Missing return statement in function");
}
 
Example #16
Source File: CompactSyntax.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
final public void IncludeDiv(GrammarSection section, Scope scope, Annotations a) throws ParseException {
Token t;
Div div = section.makeDiv();
  t = jj_consume_token(6);
  jj_consume_token(11);
  a = IncludeBody(div, scope, a);
                                               topLevelComments(div);
  jj_consume_token(12);
  div.endDiv(makeLocation(t), a);
}
 
Example #17
Source File: DivHost.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void endDiv(Location _loc, Annotations _anno) throws BuildException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endDiv( loc.lhs, anno.lhs );
    rhs.endDiv( loc.rhs, anno.rhs );
}
 
Example #18
Source File: SchemaBuilderHost.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeOneOrMore(ParsedPattern _p, Location _loc,
    Annotations _anno) throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeOneOrMore(p.lhs, loc.lhs, anno.lhs),
        rhs.makeOneOrMore(p.rhs, loc.rhs, anno.rhs));
}
 
Example #19
Source File: CompactSyntax.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern ElementExpr(Scope scope, Annotations a) throws ParseException {
Token t;
ParsedNameClass nc;
ParsedPattern p;
  t = jj_consume_token(26);
  nc = NameClass(IN_ELEMENT, null);
  jj_consume_token(11);
  p = Expr(false, scope, null, null);
  p = afterComments(p);
  jj_consume_token(12);
  {if (true) return sb.makeElement(nc, p, makeLocation(t), a);}
  throw new Error("Missing return statement in function");
}
 
Example #20
Source File: SchemaBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #21
Source File: CompactSyntax.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedNameClass PrimaryNameClass(int context, Annotations a) throws ParseException {
ParsedNameClass nc;
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case 5:
  case 6:
  case 7:
  case 10:
  case 13:
  case 14:
  case 15:
  case 16:
  case 17:
  case 18:
  case 19:
  case 26:
  case 27:
  case 31:
  case 32:
  case 33:
  case 34:
  case 35:
  case 36:
  case IDENTIFIER:
  case ESCAPED_IDENTIFIER:
    nc = UnprefixedNameClass(context, a);
    break;
  case PREFIXED_NAME:
    nc = PrefixedNameClass(a);
    break;
  case 28:
    nc = ParenNameClass(context, a);
    break;
  default:
    jj_la1[33] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  {if (true) return nc;}
  throw new Error("Missing return statement in function");
}
 
Example #22
Source File: SchemaBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeList(ParsedPattern _p, Location _loc,
    Annotations _anno) throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeList(p.lhs, loc.lhs, anno.lhs),
        rhs.makeList(p.rhs, loc.rhs, anno.rhs));
}
 
Example #23
Source File: IncludeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException {
    // check for overridden pattern
    if(name==START) {
        if(startOverriden)
            return;
    } else {
        if(overridenPatterns.contains(name))
            return;
    }
    // otherwise define
    super.define(name, combine, pattern, loc, anno);
}
 
Example #24
Source File: SchemaBuilderHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeOptional(ParsedPattern _p, Location _loc,
    Annotations _anno) throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeOptional(p.lhs, loc.lhs, anno.lhs),
        rhs.makeOptional(p.rhs, loc.rhs, anno.rhs));
}
 
Example #25
Source File: CompactSyntax.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern GrammarExpr(Scope scope, Annotations a) throws ParseException {
Token t;
Grammar g;
  t = jj_consume_token(10);
                g = sb.makeGrammar(scope);
  jj_consume_token(11);
  a = GrammarBody(g, g, a);
                               topLevelComments(g);
  jj_consume_token(12);
  {if (true) return g.endGrammar(makeLocation(t), a);}
  throw new Error("Missing return statement in function");
}
 
Example #26
Source File: CompactSyntax.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern ParentExpr(Scope scope, Annotations a) throws ParseException {
LocatedString name;
  jj_consume_token(34);
           a = addCommentsToChildAnnotations(a);
  name = Identifier();
  if(scope==null) {
    error("parent_ref_outside_grammar",name.getToken());
    {if (true) return sb.makeErrorPattern();}
  } else {
    {if (true) return scope.makeParentRef(name.getString(), name.getLocation(), a);}
  }
  throw new Error("Missing return statement in function");
}
 
Example #27
Source File: SchemaBuilderImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException {
    // TODO: do this check by the caller
    if (parent == null) {
        sb.error("parent_ref_outside_grammar", (Locator) loc);
        return sb.makeErrorPattern();
    }
    return parent.makeRef(name, loc, anno);
}
 
Example #28
Source File: CompactSyntax.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
final public void PrefixedAnnotationAttribute(Annotations a, boolean nested) throws ParseException {
Token t;
String value;
  t = jj_consume_token(PREFIXED_NAME);
  jj_consume_token(2);
  value = Literal();
  String qn = t.image;
  int colon = qn.indexOf(':');
  String prefix = qn.substring(0, colon);
  String ns = lookupPrefix(prefix, t);
  if (ns == this.inheritedNs)
    error("inherited_annotation_namespace", t);
  else if (ns.length() == 0 && !nested)
    error("unqualified_annotation_attribute", t);
  else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested)
    error("relax_ng_namespace", t);
  /*else if (ns.length() == 0
           && qn.length() - colon - 1 == 5
           && qn.regionMatches(colon + 1, "xmlns", 0, 5))
    error("xmlns_annotation_attribute", t);*/
  else if (ns.equals(WellKnownNamespaces.XMLNS))
    error("xmlns_annotation_attribute_uri", t);
  else {
    if (ns.length() == 0)
      prefix = null;
    addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t);
  }
}
 
Example #29
Source File: SchemaBuilderHost.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Annotations makeAnnotations(CommentList _comments, Context context) {
    CommentListHost comments = (CommentListHost) _comments;
    Annotations l = lhs.makeAnnotations((comments!=null)?comments.lhs:null, context);
    Annotations r = rhs.makeAnnotations((comments!=null)?comments.rhs:null, context);
    if(l==null || r==null)
        throw new IllegalArgumentException("annotations cannot be null");
    return new AnnotationsHost(l,r);
}
 
Example #30
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedPattern AttributeExpr(Scope scope, Annotations a) throws ParseException {
Token t;
ParsedNameClass nc;
ParsedPattern p;
  t = jj_consume_token(27);
  nc = NameClass(IN_ATTRIBUTE, null);
  jj_consume_token(11);
  p = Expr(false, scope, null, null);
  p = afterComments(p);
  jj_consume_token(12);
  {if (true) return sb.makeAttribute(nc, p, makeLocation(t), a);}
  throw new Error("Missing return statement in function");
}