feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,92 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
class AnnotationsHost extends Base implements Annotations {
final Annotations lhs;
final Annotations rhs;
AnnotationsHost( Annotations lhs, Annotations rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
public void addAttribute(String ns, String localName, String prefix,
String value, Location _loc) throws BuildException {
LocationHost loc = cast(_loc);
lhs.addAttribute(ns, localName, prefix, value, loc.lhs);
rhs.addAttribute(ns, localName, prefix, value, loc.rhs);
}
public void addComment(CommentList _comments) throws BuildException {
CommentListHost comments = (CommentListHost) _comments;
lhs.addComment(comments==null?null:comments.lhs);
rhs.addComment(comments==null?null:comments.rhs);
}
public void addElement(ParsedElementAnnotation _ea) throws BuildException {
ParsedElementAnnotationHost ea = (ParsedElementAnnotationHost) _ea;
lhs.addElement(ea.lhs);
rhs.addElement(ea.rhs);
}
public void addLeadingComment(CommentList _comments) throws BuildException {
CommentListHost comments = (CommentListHost) _comments;
lhs.addLeadingComment(comments.lhs);
rhs.addLeadingComment(comments.rhs);
}
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.om.Location;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class Base {
protected AnnotationsHost cast( Annotations ann ) {
if(ann==null)
return nullAnnotations;
else
return (AnnotationsHost)ann;
}
protected LocationHost cast( Location loc ) {
if(loc==null)
return nullLocation;
else
return (LocationHost)loc;
}
private static final AnnotationsHost nullAnnotations = new AnnotationsHost(null,null);
private static final LocationHost nullLocation = new LocationHost(null,null);
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.om.Location;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
class CommentListHost extends Base implements CommentList {
final CommentList lhs;
final CommentList rhs;
CommentListHost(CommentList lhs, CommentList rhs) {
this.lhs = lhs;
this.rhs = rhs;
}
public void addComment(String value, Location _loc) throws BuildException {
LocationHost loc = cast(_loc);
if(lhs!=null)
lhs.addComment(value,loc.lhs);
if(rhs!=null)
rhs.addComment(value,loc.rhs);
}
}

View File

@@ -0,0 +1,103 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.DataPatternBuilder;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
import com.sun.xml.internal.rngom.parse.Context;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class DataPatternBuilderHost extends Base implements DataPatternBuilder {
final DataPatternBuilder lhs;
final DataPatternBuilder rhs;
DataPatternBuilderHost( DataPatternBuilder lhs, DataPatternBuilder rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
public void addParam(String name, String value, Context context, String ns, Location _loc, Annotations _anno) throws BuildException {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
lhs.addParam( name, value, context, ns, loc.lhs, anno.lhs );
rhs.addParam( name, value, context, ns, loc.rhs, anno.rhs );
}
public void annotation(ParsedElementAnnotation _ea) {
ParsedElementAnnotationHost ea = (ParsedElementAnnotationHost) _ea;
lhs.annotation(ea.lhs);
rhs.annotation(ea.rhs);
}
public ParsedPattern makePattern(Location _loc, Annotations _anno) throws BuildException {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makePattern( loc.lhs, anno.lhs ),
rhs.makePattern( loc.rhs, anno.rhs ));
}
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));
}
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.Div;
import com.sun.xml.internal.rngom.ast.om.Location;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class DivHost extends GrammarSectionHost implements Div {
private final Div lhs;
private final Div rhs;
DivHost(Div lhs, Div rhs) {
super(lhs, rhs);
this.lhs = lhs;
this.rhs = rhs;
}
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 );
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.builder.ElementAnnotationBuilder;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class ElementAnnotationBuilderHost extends AnnotationsHost implements ElementAnnotationBuilder {
final ElementAnnotationBuilder lhs;
final ElementAnnotationBuilder rhs;
ElementAnnotationBuilderHost( ElementAnnotationBuilder lhs, ElementAnnotationBuilder rhs ) {
super(lhs,rhs);
this.lhs = lhs;
this.rhs = rhs;
}
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 );
}
public ParsedElementAnnotation makeElementAnnotation() throws BuildException {
return new ParsedElementAnnotationHost(
lhs.makeElementAnnotation(),
rhs.makeElementAnnotation() );
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.Grammar;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
/**
* Wraps {@link Grammar} and provides error checking.
*
* <p>
* The following errors are checked by this host:
*
* <ol>
* <li>referenced to undefined patterns.
* </ol>
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class GrammarHost extends ScopeHost implements Grammar {
final Grammar lhs;
final Grammar rhs;
public GrammarHost(Grammar lhs,Grammar rhs) {
super(lhs,rhs);
this.lhs = lhs;
this.rhs = rhs;
}
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));
}
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.builder.Div;
import com.sun.xml.internal.rngom.ast.builder.GrammarSection;
import com.sun.xml.internal.rngom.ast.builder.Include;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class GrammarSectionHost extends Base implements GrammarSection {
private final GrammarSection lhs;
private final GrammarSection rhs;
GrammarSectionHost( GrammarSection lhs, GrammarSection rhs ) {
this.lhs = lhs;
this.rhs = rhs;
if(lhs==null || rhs==null)
throw new IllegalArgumentException();
}
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);
}
public Div makeDiv() {
return new DivHost( lhs.makeDiv(), rhs.makeDiv() );
}
public Include makeInclude() {
Include l = lhs.makeInclude();
if(l==null) return null;
return new IncludeHost( l, rhs.makeInclude() );
}
public void topLevelAnnotation(ParsedElementAnnotation _ea) throws BuildException {
ParsedElementAnnotationHost ea = (ParsedElementAnnotationHost) _ea;
lhs.topLevelAnnotation(ea==null?null:ea.lhs);
rhs.topLevelAnnotation(ea==null?null:ea.rhs);
}
public void topLevelComment(CommentList _comments) throws BuildException {
CommentListHost comments = (CommentListHost) _comments;
lhs.topLevelComment(comments==null?null:comments.lhs);
rhs.topLevelComment(comments==null?null:comments.rhs);
}
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.Include;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.parse.IllegalSchemaException;
import com.sun.xml.internal.rngom.parse.Parseable;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class IncludeHost extends GrammarSectionHost implements Include {
private final Include lhs;
private final Include rhs;
IncludeHost(Include lhs, Include rhs) {
super(lhs, rhs);
this.lhs = lhs;
this.rhs = rhs;
}
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.om.Location;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class LocationHost implements Location {
final Location lhs;
final Location rhs;
LocationHost( Location lhs, Location rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
}

View File

@@ -0,0 +1,165 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.builder.NameClassBuilder;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
import com.sun.xml.internal.rngom.ast.om.ParsedNameClass;
import java.util.List;
import java.util.ArrayList;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class NameClassBuilderHost extends Base implements NameClassBuilder {
final NameClassBuilder lhs;
final NameClassBuilder rhs;
NameClassBuilderHost( NameClassBuilder lhs, NameClassBuilder rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
public ParsedNameClass annotate(ParsedNameClass _nc, Annotations _anno) throws BuildException {
ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.annotate(nc.lhs, anno.lhs),
rhs.annotate(nc.rhs, anno.rhs) );
}
public ParsedNameClass annotateAfter(ParsedNameClass _nc, ParsedElementAnnotation _e) throws BuildException {
ParsedNameClassHost nc = (ParsedNameClassHost) _nc;
ParsedElementAnnotationHost e = (ParsedElementAnnotationHost) _e;
return new ParsedNameClassHost(
lhs.annotateAfter(nc.lhs, e.lhs),
rhs.annotateAfter(nc.rhs, e.rhs));
}
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));
}
public ParsedNameClass makeChoice(List _nameClasses, Location _loc, Annotations _anno) {
List<ParsedNameClass> lnc = new ArrayList<ParsedNameClass>();
List<ParsedNameClass> rnc = new ArrayList<ParsedNameClass>();
for( int i=0; i<_nameClasses.size(); i++ ) {
lnc.add(((ParsedNameClassHost)_nameClasses.get(i)).lhs);
rnc.add(((ParsedNameClassHost)_nameClasses.get(i)).rhs);
}
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.makeChoice( lnc, loc.lhs, anno.lhs ),
rhs.makeChoice( rnc, loc.rhs, anno.rhs ) );
}
public ParsedNameClass makeName(String ns, String localName, String prefix, Location _loc, Annotations _anno) {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.makeName( ns, localName, prefix, loc.lhs, anno.lhs ),
rhs.makeName( ns, localName, prefix, loc.rhs, anno.rhs ) );
}
public ParsedNameClass makeNsName(String ns, Location _loc, Annotations _anno) {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.makeNsName( ns, loc.lhs, anno.lhs ),
rhs.makeNsName( ns, loc.rhs, anno.rhs ) );
}
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 ) );
}
public ParsedNameClass makeAnyName(Location _loc, Annotations _anno) {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.makeAnyName( loc.lhs, anno.lhs ),
rhs.makeAnyName( loc.rhs, anno.rhs ) );
}
public ParsedNameClass makeAnyName(ParsedNameClass _except, Location _loc, Annotations _anno) {
ParsedNameClassHost except = (ParsedNameClassHost) _except;
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedNameClassHost(
lhs.makeAnyName( except.lhs, loc.lhs, anno.lhs ),
rhs.makeAnyName( except.rhs, loc.rhs, anno.rhs ) );
}
public ParsedNameClass makeErrorNameClass() {
return new ParsedNameClassHost( lhs.makeErrorNameClass(), rhs.makeErrorNameClass() );
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class ParsedElementAnnotationHost implements ParsedElementAnnotation {
final ParsedElementAnnotation lhs;
final ParsedElementAnnotation rhs;
ParsedElementAnnotationHost( ParsedElementAnnotation lhs, ParsedElementAnnotation rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.om.ParsedNameClass;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
final class ParsedNameClassHost implements ParsedNameClass {
final ParsedNameClass lhs;
final ParsedNameClass rhs;
ParsedNameClassHost( ParsedNameClass lhs, ParsedNameClass rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class ParsedPatternHost implements ParsedPattern {
public final ParsedPattern lhs;
public final ParsedPattern rhs;
ParsedPatternHost( ParsedPattern lhs, ParsedPattern rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
}

View File

@@ -0,0 +1,372 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import com.sun.xml.internal.rngom.ast.builder.DataPatternBuilder;
import com.sun.xml.internal.rngom.ast.builder.ElementAnnotationBuilder;
import com.sun.xml.internal.rngom.ast.builder.Grammar;
import com.sun.xml.internal.rngom.ast.builder.NameClassBuilder;
import com.sun.xml.internal.rngom.ast.builder.SchemaBuilder;
import com.sun.xml.internal.rngom.ast.builder.Scope;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
import com.sun.xml.internal.rngom.ast.om.ParsedNameClass;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
import com.sun.xml.internal.rngom.parse.Context;
import com.sun.xml.internal.rngom.parse.IllegalSchemaException;
import com.sun.xml.internal.rngom.parse.Parseable;
import java.util.List;
import java.util.ArrayList;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class SchemaBuilderHost extends Base implements SchemaBuilder {
final SchemaBuilder lhs;
final SchemaBuilder rhs;
public SchemaBuilderHost( SchemaBuilder lhs, SchemaBuilder rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
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) );
}
public ParsedPattern annotateAfter(ParsedPattern _p,
ParsedElementAnnotation _e) throws BuildException {
ParsedPatternHost p = (ParsedPatternHost) _p;
ParsedElementAnnotationHost e = (ParsedElementAnnotationHost) _e;
return new ParsedPatternHost(
lhs.annotateAfter(p.lhs, e.lhs),
rhs.annotateAfter(p.rhs, e.rhs));
}
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));
}
public ParsedPattern expandPattern(ParsedPattern _p) throws BuildException, IllegalSchemaException {
ParsedPatternHost p = (ParsedPatternHost) _p;
return new ParsedPatternHost(
lhs.expandPattern(p.lhs),
rhs.expandPattern(p.rhs));
}
public NameClassBuilder getNameClassBuilder() throws BuildException {
return new NameClassBuilderHost( lhs.getNameClassBuilder(), rhs.getNameClassBuilder() );
}
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);
}
public ParsedPattern makeAttribute(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.makeAttribute(nc.lhs, p.lhs, loc.lhs, anno.lhs),
rhs.makeAttribute(nc.rhs, p.rhs, loc.rhs, anno.rhs));
}
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));
}
public CommentList makeCommentList() {
return new CommentListHost(
lhs.makeCommentList(),
rhs.makeCommentList() );
}
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary,
String type, Location _loc) throws BuildException {
LocationHost loc = cast(_loc);
return new DataPatternBuilderHost(
lhs.makeDataPatternBuilder(datatypeLibrary, type, loc.lhs),
rhs.makeDataPatternBuilder(datatypeLibrary, type, loc.rhs) );
}
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));
}
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) );
}
public ParsedPattern makeEmpty(Location _loc, Annotations _anno) {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeEmpty(loc.lhs, anno.lhs),
rhs.makeEmpty(loc.rhs, anno.rhs));
}
public ParsedPattern makeErrorPattern() {
return new ParsedPatternHost(
lhs.makeErrorPattern(),
rhs.makeErrorPattern() );
}
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) );
}
public Grammar makeGrammar(Scope _parent) {
ScopeHost parent = (ScopeHost) _parent;
return new GrammarHost(
lhs.makeGrammar((parent!=null)?parent.lhs:null),
rhs.makeGrammar((parent!=null)?parent.rhs:null) );
}
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));
}
public ParsedPattern makeInterleave(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.makeInterleave(lp, loc.lhs, anno.lhs),
rhs.makeInterleave(rp, loc.rhs, anno.rhs));
}
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));
}
public Location makeLocation(String systemId, int lineNumber,
int columnNumber) {
return new LocationHost(
lhs.makeLocation(systemId, lineNumber, columnNumber),
rhs.makeLocation(systemId, lineNumber, columnNumber));
}
public ParsedPattern makeMixed(ParsedPattern _p, Location _loc,
Annotations _anno) throws BuildException {
ParsedPatternHost p = (ParsedPatternHost) _p;
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeMixed(p.lhs, loc.lhs, anno.lhs),
rhs.makeMixed(p.rhs, loc.rhs, anno.rhs));
}
public ParsedPattern makeNotAllowed(Location _loc, Annotations _anno) {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeNotAllowed(loc.lhs, anno.lhs),
rhs.makeNotAllowed(loc.rhs, anno.rhs));
}
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));
}
public ParsedPattern makeZeroOrMore(ParsedPattern _p, Location _loc,
Annotations _anno) throws BuildException {
ParsedPatternHost p = (ParsedPatternHost) _p;
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeZeroOrMore(p.lhs, loc.lhs, anno.lhs),
rhs.makeZeroOrMore(p.rhs, loc.rhs, anno.rhs));
}
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));
}
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));
}
public ParsedPattern makeValue(String datatypeLibrary, String type,
String value, Context c, String ns, Location _loc, Annotations _anno)
throws BuildException {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeValue(datatypeLibrary,type,value,c,ns,loc.lhs,anno.lhs),
rhs.makeValue(datatypeLibrary,type,value,c,ns,loc.rhs,anno.rhs));
}
public boolean usesComments() {
return lhs.usesComments() || rhs.usesComments();
}
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (C) 2004-2011
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sun.xml.internal.rngom.parse.host;
import com.sun.xml.internal.rngom.ast.builder.Annotations;
import com.sun.xml.internal.rngom.ast.builder.BuildException;
import com.sun.xml.internal.rngom.ast.builder.Scope;
import com.sun.xml.internal.rngom.ast.om.Location;
import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
/**
*
* @author
* Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class ScopeHost extends GrammarSectionHost implements Scope {
protected final Scope lhs;
protected final Scope rhs;
protected ScopeHost( Scope lhs, Scope rhs ) {
super(lhs,rhs);
this.lhs = lhs;
this.rhs = rhs;
}
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));
}
public ParsedPattern makeRef(String name, Location _loc, Annotations _anno) throws BuildException {
LocationHost loc = cast(_loc);
AnnotationsHost anno = cast(_anno);
return new ParsedPatternHost(
lhs.makeRef(name, loc.lhs, anno.lhs),
rhs.makeRef(name, loc.rhs, anno.rhs));
}
}