All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.msv.grammar.trex.TREXGrammar Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: TREXGrammar.java,v 1.12 2003/06/09 20:37:20 kk122374 Exp $
 *
 * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the proprietary information of Sun Microsystems, Inc.  
 * Use is subject to license terms.
 * 
 */
package com.sun.msv.grammar.trex;

import com.sun.msv.grammar.Expression;
import com.sun.msv.grammar.ExpressionPool;
import com.sun.msv.grammar.Grammar;
import com.sun.msv.grammar.ReferenceContainer;
import com.sun.msv.grammar.ReferenceExp;
import com.sun.msv.reader.datatype.DataTypeVocabularyMap;

/**
 * TREX grammar, which is expressed as <grammar> element.
 * 
 * 

* The exp field keeps the start pattern. * * @author Kohsuke KAWAGUCHI */ public class TREXGrammar extends ReferenceExp implements Grammar{ static final public class RefContainer extends ReferenceContainer { public ReferenceExp getOrCreate( String name ) { return super._getOrCreate(name); } protected ReferenceExp createReference( String name ) { return new ReferenceExp(name); } } /** named patterns which are defined by using <define> element. * * this is a map from pattern name to RefPattern object */ public final RefContainer namedPatterns = new RefContainer(); /** gets the start pattern. * * The pattern defined under <start> element. * This pattern will be used to verify document element. */ public Expression getTopLevel() { return this.exp; } /** ExpressionPool that is associated with this grammar */ public final ExpressionPool pool; public ExpressionPool getPool() { return pool; } /** in case of nested grammar, this variable points to the parent grammar. * Otherwise null. */ protected final TREXGrammar parentGrammar; /** * gets a parent TREXGrammar. * * In case of nested grammar, the parent grammar will be returned. * Otherwise, it returns null. */ public final TREXGrammar getParentGrammar() { return parentGrammar; } /** * data type vocabularies used and defined by this grammar. */ public final DataTypeVocabularyMap dataTypes = new DataTypeVocabularyMap(); /** * * @param parentGrammar * this object is used to resolve <ref> element with parent * attribute. */ public TREXGrammar( ExpressionPool pool, TREXGrammar parentGrammar ) { super(null); this.pool = pool; this.parentGrammar = parentGrammar; } public TREXGrammar( ExpressionPool pool ) { this(pool,null); } public TREXGrammar() { this(new ExpressionPool(),null); } // serialization support private static final long serialVersionUID = 1; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy