com.sun.xml.internal.rngom.ast.om.ParsedPattern Java Examples
The following examples show how to use
com.sun.xml.internal.rngom.ast.om.ParsedPattern.
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: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope, Location loc, Annotations anno) throws BuildException { for (OpenIncludes inc = openIncludes; inc != null; inc = inc.parent) { if (inc.uri.equals(uri)) { error("recursive_include", uri, (Locator) loc); return pb.makeError(); } } try { return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns); } catch (IllegalSchemaException e) { noteError(); return pb.makeError(); } }
Example #2
Source File: SchemaBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public ParsedPattern makeGroup(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.makeGroup(lp, loc.lhs, anno.lhs), rhs.makeGroup(rp, loc.rhs, anno.rhs)); }
Example #3
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException { for (Enumeration e = defines.keys(); e.hasMoreElements();) { String name = (String) e.nextElement(); RefPattern rp = (RefPattern) defines.get(name); if (rp.getPattern() == null) { sb.error("reference_to_undefined", name, rp.getRefLocator()); rp.setPattern(sb.pb.makeError()); } } Pattern start = startRef.getPattern(); if (start == null) { sb.error("missing_start_element", (Locator) loc); start = sb.pb.makeError(); } return start; }
Example #4
Source File: DataPatternBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #5
Source File: SchemaParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override void endChild(ParsedPattern pattern) { if (childPatterns == null) { childPatterns = new ArrayList<ParsedPattern>(INIT_CHILD_ALLOC); } childPatterns.add(pattern); }
Example #6
Source File: SchemaBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makeText(Location _loc, Annotations _anno) { LocationHost loc = cast(_loc); AnnotationsHost anno = cast(_anno); return new ParsedPatternHost( lhs.makeText(loc.lhs, anno.lhs), rhs.makeText(loc.rhs, anno.rhs)); }
Example #7
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
final public ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) throws ParseException { Token t; ParsedPattern p; t = jj_consume_token(28); p = Expr(topLevel, scope, t, a); p = afterComments(p); jj_consume_token(29); {if (true) return p;} throw new Error("Missing return statement in function"); }
Example #8
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #9
Source File: IncludeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@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 #10
Source File: IncludeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException { super.define(name, combine, pattern, loc, anno); if(name==START) startOverriden = true; else overridenPatterns.add(name); }
Example #11
Source File: GrammarHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #12
Source File: SchemaParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void end() throws SAXException { ParsedPattern p; if (dpb != null) { if (except != null) { p = dpb.makePattern(except, startLocation, annotations); } else { p = dpb.makePattern(startLocation, annotations); } } else { p = schemaBuilder.makeErrorPattern(); } // XXX need to capture comments parent.endChild(p); }
Example #13
Source File: GrammarBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException { if(name==START) { grammar.start = (DPattern)pattern; } else { // TODO: handle combine DDefine d = grammar.getOrAdd(name); d.setPattern( (DPattern) pattern ); if (anno!=null) { d.annotation = ((Annotation)anno).getResult(); } } }
Example #14
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #15
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) throws BuildException { try { return pb.makeDataExcept(dtb.createDatatype(), (Pattern) except, (Locator) loc); } catch (DatatypeException e) { String detail = e.getMessage(); if (detail != null) { error("invalid_params_detail", detail, (Locator) loc); } else { error("invalid_params", (Locator) loc); } return pb.makeError(); } }
Example #16
Source File: SchemaParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
ParsedPattern makePattern() throws SAXException { if (name == null) { return schemaBuilder.makeErrorPattern(); } if (scope == null) { error("ref_outside_grammar", name); return schemaBuilder.makeErrorPattern(); } else { return scope.makeRef(name, startLocation, annotations); } }
Example #17
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makePattern(Location loc, Annotations anno) throws BuildException { try { return pb.makeData(dtb.createDatatype()); } catch (DatatypeException e) { String detail = e.getMessage(); if (detail != null) { error("invalid_params_detail", detail, (Locator) loc); } else { error("invalid_params", (Locator) loc); } return pb.makeError(); } }
Example #18
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
final public void Define(GrammarSection section, Scope scope, Annotations a) throws ParseException { LocatedString name; GrammarSection.Combine combine; ParsedPattern p; name = Identifier(); combine = AssignOp(); p = Expr(false, scope, null, null); section.define(name.getString(), combine, p, name.getLocation(), a); }
Example #19
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException { RefPattern p = lookup1(name); if (p.getRefLocator() == null && loc != null) { p.setRefLocator((Locator) loc); } return p; }
Example #20
Source File: SchemaBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makeElement(ParsedNameClass _nc, ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException { ParsedNameClassHost nc = (ParsedNameClassHost) _nc; ParsedPatternHost p = (ParsedPatternHost) _p; LocationHost loc = cast(_loc); AnnotationsHost anno = cast(_anno); return new ParsedPatternHost( lhs.makeElement(nc.lhs, p.lhs, loc.lhs, anno.lhs), rhs.makeElement(nc.rhs, p.rhs, loc.rhs, anno.rhs)); }
Example #21
Source File: SchemaBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #22
Source File: GrammarSectionHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void define(String name, Combine combine, ParsedPattern _pattern, Location _loc, Annotations _anno) throws BuildException { ParsedPatternHost pattern = (ParsedPatternHost) _pattern; LocationHost loc = cast(_loc); AnnotationsHost anno = cast(_anno); lhs.define(name, combine, pattern.lhs, loc.lhs, anno.lhs); rhs.define(name, combine, pattern.rhs, loc.rhs, anno.rhs); }
Example #23
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #24
Source File: DataPatternBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) throws BuildException { p.except = (DPattern)except; if (anno!=null) { p.annotation = ((Annotation)anno).getResult(); } return p; }
Example #25
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #26
Source File: SchemaBuilderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ParsedPattern makeInterleave(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.makeInterleave(result, (Pattern) patterns.get(i)); } return result; }
Example #27
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
final public ParsedPattern Input(Scope scope) throws ParseException { ParsedPattern p; Preamble(); if (jj_2_1(2147483647)) { p = TopLevelGrammar(scope); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 10: case 17: case 18: case 19: case 26: case 27: case 28: case 31: case 32: case 33: case 34: case 35: case 36: case DOCUMENTATION: case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: case IDENTIFIER: case ESCAPED_IDENTIFIER: case PREFIXED_NAME: case LITERAL: p = Expr(true, scope, null, null); p = afterComments(p); jj_consume_token(0); break; default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return p;} throw new Error("Missing return statement in function"); }
Example #28
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) { if (i >= patterns.length) { ParsedPattern[] oldPatterns = patterns; patterns = new ParsedPattern[oldPatterns.length*2]; System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length); } patterns[i] = p; return patterns; }
Example #29
Source File: SchemaBuilderHost.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #30
Source File: CompactSyntax.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
final public ParsedPattern IdentifierExpr(Scope scope, Annotations a) throws ParseException { LocatedString name; name = Identifier(); if(scope==null) { error("ref_outside_grammar",name.getToken()); {if (true) return sb.makeErrorPattern();} } else { {if (true) return scope.makeRef(name.getString(), name.getLocation(), a);} } throw new Error("Missing return statement in function"); }