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

The following examples show how to use com.sun.xml.internal.rngom.ast.builder.CommentList. 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: CompactSyntax.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Annotations addCommentsToLeadingAnnotations(Annotations a) {
  CommentList comments = getComments();
  if (comments == null)
    return a;
  if (a == null)
    return sb.makeAnnotations(comments, getContext());
  a.addLeadingComment(comments);
  return a;
}
 
Example #2
Source File: CompactSyntax.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private CommentList getComments(CommentList comments) {
  Token nextToken = getToken(1);
  if (lastCommentSourceToken != nextToken) {
    if (lastCommentSourceToken == null)
      lastCommentSourceToken = token;
    do {
      lastCommentSourceToken = lastCommentSourceToken.next;
      Token t = lastCommentSourceToken.specialToken;
      if (t != null) {
        while (t.specialToken != null)
          t = t.specialToken;
        if (comments == null)
          comments = sb.makeCommentList();
        for (; t != null; t = t.next) {
          String s = mungeComment(t.image);
          Location loc = makeLocation(t);
          if (t.next != null
              && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) {
            StringBuffer buf = new StringBuffer(s);
            do {
              t = t.next;
              buf.append('\u005cn');
              buf.append(mungeComment(t.image));
            } while (t.next != null
                     && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE);
            s = buf.toString();
          }
          comments.addComment(s, loc);
        }
      }
    } while (lastCommentSourceToken != nextToken);
  }
  return comments;
}
 
Example #3
Source File: CompactSyntax.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedElementAnnotation Documentation() throws ParseException {
CommentList comments = getComments();
ElementAnnotationBuilder eab;
Token t;
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case DOCUMENTATION:
    t = jj_consume_token(DOCUMENTATION);
    break;
  case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
    t = jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT);
    break;
  default:
    jj_la1[54] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS,
                                        "documentation",
                                        getCompatibilityPrefix(),
                                        makeLocation(t),
                                        comments,
                                        getContext());
  eab.addText(mungeComment(t.image), makeLocation(t), null);
  label_19:
  while (true) {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOCUMENTATION_CONTINUE:
      ;
      break;
    default:
      jj_la1[55] = jj_gen;
      break label_19;
    }
    t = jj_consume_token(DOCUMENTATION_CONTINUE);
                                eab.addText("\u005cn" + mungeComment(t.image), makeLocation(t), null);
  }
  {if (true) return eab.makeElementAnnotation();}
  throw new Error("Missing return statement in function");
}
 
Example #4
Source File: NameClassBuilderHost.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ParsedNameClass commentAfter(ParsedNameClass _nc, CommentList _comments) throws BuildException {
    ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedNameClassHost(
        lhs.commentAfter(nc.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(nc.rhs, comments==null?null:comments.rhs));
}
 
Example #5
Source File: CompactSyntax.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private CommentList getComments(CommentList comments) {
  Token nextToken = getToken(1);
  if (lastCommentSourceToken != nextToken) {
    if (lastCommentSourceToken == null)
      lastCommentSourceToken = token;
    do {
      lastCommentSourceToken = lastCommentSourceToken.next;
      Token t = lastCommentSourceToken.specialToken;
      if (t != null) {
        while (t.specialToken != null)
          t = t.specialToken;
        if (comments == null)
          comments = sb.makeCommentList();
        for (; t != null; t = t.next) {
          String s = mungeComment(t.image);
          Location loc = makeLocation(t);
          if (t.next != null
              && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) {
            StringBuffer buf = new StringBuffer(s);
            do {
              t = t.next;
              buf.append('\u005cn');
              buf.append(mungeComment(t.image));
            } while (t.next != null
                     && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE);
            s = buf.toString();
          }
          comments.addComment(s, loc);
        }
      }
    } while (lastCommentSourceToken != nextToken);
  }
  return comments;
}
 
Example #6
Source File: SchemaBuilderHost.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns,
    String localName, String prefix, Location _loc, CommentList _comments,
    Context context) {
    LocationHost loc = cast(_loc);
    CommentListHost comments = (CommentListHost) _comments;

    return new ElementAnnotationBuilderHost(
        lhs.makeElementAnnotationBuilder(ns, localName, prefix, loc.lhs, comments==null?null:comments.lhs, context),
        rhs.makeElementAnnotationBuilder(ns, localName, prefix, loc.rhs, comments==null?null:comments.rhs, context) );
}
 
Example #7
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private CommentList getComments(CommentList comments) {
  Token nextToken = getToken(1);
  if (lastCommentSourceToken != nextToken) {
    if (lastCommentSourceToken == null)
      lastCommentSourceToken = token;
    do {
      lastCommentSourceToken = lastCommentSourceToken.next;
      Token t = lastCommentSourceToken.specialToken;
      if (t != null) {
        while (t.specialToken != null)
          t = t.specialToken;
        if (comments == null)
          comments = sb.makeCommentList();
        for (; t != null; t = t.next) {
          String s = mungeComment(t.image);
          Location loc = makeLocation(t);
          if (t.next != null
              && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) {
            StringBuffer buf = new StringBuffer(s);
            do {
              t = t.next;
              buf.append('\u005cn');
              buf.append(mungeComment(t.image));
            } while (t.next != null
                     && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE);
            s = buf.toString();
          }
          comments.addComment(s, loc);
        }
      }
    } while (lastCommentSourceToken != nextToken);
  }
  return comments;
}
 
Example #8
Source File: ElementAnnotationBuilderHost.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void addText(String value, Location _loc, CommentList _comments) throws BuildException {
    LocationHost loc = cast(_loc);
    CommentListHost comments = (CommentListHost) _comments;

    lhs.addText( value, loc.lhs, comments==null?null:comments.lhs );
    rhs.addText( value, loc.rhs, comments==null?null:comments.rhs );
}
 
Example #9
Source File: NameClassBuilderHost.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedNameClass commentAfter(ParsedNameClass _nc, CommentList _comments) throws BuildException {
    ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedNameClassHost(
        lhs.commentAfter(nc.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(nc.rhs, comments==null?null:comments.rhs));
}
 
Example #10
Source File: NameClassBuilderHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ParsedNameClass commentAfter(ParsedNameClass _nc, CommentList _comments) throws BuildException {
    ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedNameClassHost(
        lhs.commentAfter(nc.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(nc.rhs, comments==null?null:comments.rhs));
}
 
Example #11
Source File: ElementAnnotationBuilderHost.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void addText(String value, Location _loc, CommentList _comments) throws BuildException {
    LocationHost loc = cast(_loc);
    CommentListHost comments = (CommentListHost) _comments;

    lhs.addText( value, loc.lhs, comments==null?null:comments.lhs );
    rhs.addText( value, loc.rhs, comments==null?null:comments.rhs );
}
 
Example #12
Source File: CompactSyntax.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedElementAnnotation Documentation() throws ParseException {
CommentList comments = getComments();
ElementAnnotationBuilder eab;
Token t;
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case DOCUMENTATION:
    t = jj_consume_token(DOCUMENTATION);
    break;
  case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
    t = jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT);
    break;
  default:
    jj_la1[54] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS,
                                        "documentation",
                                        getCompatibilityPrefix(),
                                        makeLocation(t),
                                        comments,
                                        getContext());
  eab.addText(mungeComment(t.image), makeLocation(t), null);
  label_19:
  while (true) {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOCUMENTATION_CONTINUE:
      ;
      break;
    default:
      jj_la1[55] = jj_gen;
      break label_19;
    }
    t = jj_consume_token(DOCUMENTATION_CONTINUE);
                                eab.addText("\u005cn" + mungeComment(t.image), makeLocation(t), null);
  }
  {if (true) return eab.makeElementAnnotation();}
  throw new Error("Missing return statement in function");
}
 
Example #13
Source File: SchemaBuilderHost.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern commentAfter(ParsedPattern _p, CommentList _comments)
    throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedPatternHost(
        lhs.commentAfter(p.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(p.rhs, comments==null?null:comments.rhs));
}
 
Example #14
Source File: NameClassBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedNameClass commentAfter(ParsedNameClass _nc, CommentList _comments) throws BuildException {
    ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedNameClassHost(
        lhs.commentAfter(nc.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(nc.rhs, comments==null?null:comments.rhs));
}
 
Example #15
Source File: CompactSyntax.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) throws ParseException {
CommentList comments = getComments();
Token t;
ElementAnnotationBuilder eab;
  t = jj_consume_token(PREFIXED_NAME);
  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);
    ns = "";
  }
  else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) {
    error("relax_ng_namespace", t);
    ns = "";
  }
  else {
    if (ns.length() == 0)
      prefix = null;
  }
  eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix,
                                        makeLocation(t), comments, getContext());
  AnnotationElementContent(eab);
  {if (true) return eab.makeElementAnnotation();}
  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 ParsedElementAnnotation Documentation() throws ParseException {
CommentList comments = getComments();
ElementAnnotationBuilder eab;
Token t;
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case DOCUMENTATION:
    t = jj_consume_token(DOCUMENTATION);
    break;
  case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT:
    t = jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT);
    break;
  default:
    jj_la1[54] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
  eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS,
                                        "documentation",
                                        getCompatibilityPrefix(),
                                        makeLocation(t),
                                        comments,
                                        getContext());
  eab.addText(mungeComment(t.image), makeLocation(t), null);
  label_19:
  while (true) {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOCUMENTATION_CONTINUE:
      ;
      break;
    default:
      jj_la1[55] = jj_gen;
      break label_19;
    }
    t = jj_consume_token(DOCUMENTATION_CONTINUE);
                                eab.addText("\u005cn" + mungeComment(t.image), makeLocation(t), null);
  }
  {if (true) return eab.makeElementAnnotation();}
  throw new Error("Missing return statement in function");
}
 
Example #17
Source File: SchemaBuilderHost.java    From TencentKona-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 #18
Source File: SchemaBuilderHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern commentAfter(ParsedPattern _p, CommentList _comments)
    throws BuildException {

    ParsedPatternHost p = (ParsedPatternHost) _p;
    CommentListHost comments = (CommentListHost) _comments;

    return new ParsedPatternHost(
        lhs.commentAfter(p.lhs, comments==null?null:comments.lhs),
        rhs.commentAfter(p.rhs, comments==null?null:comments.rhs));
}
 
Example #19
Source File: CompactSyntax.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedElementAnnotation UnprefixedAnnotationElement() throws ParseException {
CommentList comments = getComments();
LocatedString name;
ElementAnnotationBuilder eab;
  name = UnprefixedName();
  eab = sb.makeElementAnnotationBuilder("", name.getString(), null,
                                        name.getLocation(), comments, getContext());
  AnnotationElementContent(eab);
  {if (true) return eab.makeElementAnnotation();}
  throw new Error("Missing return statement in function");
}
 
Example #20
Source File: ElementAnnotationBuilderHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void addText(String value, Location _loc, CommentList _comments) throws BuildException {
    LocationHost loc = cast(_loc);
    CommentListHost comments = (CommentListHost) _comments;

    lhs.addText( value, loc.lhs, comments==null?null:comments.lhs );
    rhs.addText( value, loc.rhs, comments==null?null:comments.rhs );
}
 
Example #21
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
final public ParsedElementAnnotation UnprefixedAnnotationElement() throws ParseException {
CommentList comments = getComments();
LocatedString name;
ElementAnnotationBuilder eab;
  name = UnprefixedName();
  eab = sb.makeElementAnnotationBuilder("", name.getString(), null,
                                        name.getLocation(), comments, getContext());
  AnnotationElementContent(eab);
  {if (true) return eab.makeElementAnnotation();}
  throw new Error("Missing return statement in function");
}
 
Example #22
Source File: SchemaBuilderHost.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns,
    String localName, String prefix, Location _loc, CommentList _comments,
    Context context) {
    LocationHost loc = cast(_loc);
    CommentListHost comments = (CommentListHost) _comments;

    return new ElementAnnotationBuilderHost(
        lhs.makeElementAnnotationBuilder(ns, localName, prefix, loc.lhs, comments==null?null:comments.lhs, context),
        rhs.makeElementAnnotationBuilder(ns, localName, prefix, loc.rhs, comments==null?null:comments.rhs, context) );
}
 
Example #23
Source File: CommentListHost.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
CommentListHost(CommentList lhs, CommentList rhs) {
    this.lhs = lhs;
    this.rhs = rhs;
}
 
Example #24
Source File: SchemaBuilderImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Annotations makeAnnotations(CommentList comments, Context context) {
    return this;
}
 
Example #25
Source File: GrammarBuilderImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void topLevelComment(CommentList comments) throws BuildException {
}
 
Example #26
Source File: SchemaBuilderImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void addText(String value, Location loc, CommentList comments) throws BuildException {
}
 
Example #27
Source File: SchemaBuilderImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void addLeadingComment(CommentList comments) throws BuildException {
    // nothing needed
}
 
Example #28
Source File: ElementAnnotationBuilderImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void addComment(CommentList comments) throws BuildException {
}
 
Example #29
Source File: SchemaBuilderImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public Annotations makeAnnotations(CommentList comments, Context context) {
    return this;
}
 
Example #30
Source File: SchemaBuilderImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Annotations makeAnnotations(CommentList comments, Context context) {
    return this;
}