[Mulgara-svn] r1567 - in trunk/src/jar/content-rlog: java/org/mulgara/krule/rlog/ast java/org/mulgara/krule/rlog/parser java/org/mulgara/krule/rlog/rdf javacc/org/mulgara/krule/rlog

pag at mulgara.org pag at mulgara.org
Sat Feb 28 07:05:38 UTC 2009


Author: pag
Date: 2009-02-27 23:05:37 -0800 (Fri, 27 Feb 2009)
New Revision: 1567

Modified:
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Axiom.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicate.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicateLiteral.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/IntegerLiteral.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/InvertedPredicate.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Node.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/NullPredicate.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Predicate.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/PredicateLiteral.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Rule.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Statement.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/StringLiteral.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeLiteral.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeStatement.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Variable.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/parser/NSUtils.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/MulgaraGraphs.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/RDF.java
   trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/URIReference.java
   trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.java
   trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.jj
   trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserConstants.java
   trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserTokenManager.java
Log:
Added in a parsing context so that the parser can set up domain/namespaces as it goes and pass these on to the AST

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Axiom.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Axiom.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Axiom.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -18,6 +18,7 @@
 
 import java.util.Set;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.RDFNode;
 import org.mulgara.krule.rlog.rdf.URIReference;
@@ -37,8 +38,10 @@
   /**
    * Takes a predicate for a statement and checks that there are not variables in it.
    * @param p A Predicate containing no variables.
+   * @param context The context passed in from the parser.
    */
-  public Axiom(Predicate p) {
+  public Axiom(Predicate p, ParseContext context) {
+    super(context);
     predicate = p;
     if (predicate.containsVariables()) throw new IllegalArgumentException("Axioms may not contain variables.");
     predicate.setParent(this);

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicate.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicate.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicate.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -19,6 +19,7 @@
 import java.util.HashSet;
 import java.util.Collection;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.MulgaraGraphs;
 import org.mulgara.krule.rlog.rdf.URIReference;
@@ -47,8 +48,10 @@
    * @param label The predicate name.
    * @param left The first parameter of the predicate.
    * @param right The second parameter of the predicate.
+   * @param context The context passed in from the parser.
    */
-  public BPredicate(BPredicateLabel label, PredicateParam left, PredicateParam right) {
+  public BPredicate(BPredicateLabel label, PredicateParam left, PredicateParam right, ParseContext context) {
+    super(context);
     this.label = label;
     this.left = left;
     this.right = right;

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicateLiteral.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicateLiteral.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/BPredicateLiteral.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -16,6 +16,8 @@
 
 package org.mulgara.krule.rlog.ast;
 
+import org.mulgara.krule.rlog.ParseContext;
+
 /**
  * Represents a value (not a variable) at any place in a predicate.
  * Basic String and integer literals have a separate type.
@@ -30,9 +32,10 @@
    * Creates a new literal, including a domain, for use in a binary predicate.
    * @param domain The domain for the name (eg. rdfs or owl).
    * @param name The name of the literal.
+   * @param context The context passed in from the parser.
    */
-  public BPredicateLiteral(String domain, String name) {
-    super(domain, name);
+  public BPredicateLiteral(String domain, String name, ParseContext context) {
+    super(domain, name, context);
   }
 
   /** {@inheritDoc} */

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/IntegerLiteral.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/IntegerLiteral.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/IntegerLiteral.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -34,10 +34,10 @@
 
   /**
    * A new numeric literal.
-   * @param value The value of the number.
+   * @param s The string representation of the number.
    */
   public IntegerLiteral(String s) {
-    this.value = Long.valueOf(s);
+    this(Long.valueOf(s));
   }
 
   /**
@@ -45,6 +45,7 @@
    * @param value The value of the number.
    */
   public IntegerLiteral(Long value) {
+    super(null);
     this.value = value;
   }
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/InvertedPredicate.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/InvertedPredicate.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/InvertedPredicate.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -18,6 +18,7 @@
 
 import java.util.Collection;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.RDFNode;
 import org.mulgara.krule.rlog.rdf.Var;
@@ -33,8 +34,12 @@
 
   public final Predicate invertPredicate;
 
-  public InvertedPredicate(Predicate typeStatement) {
-    super();
+  /**
+   * Create this inverted predicate instance, with the context it requires.
+   * @param context The context passed in from the parser.
+   */
+  public InvertedPredicate(Predicate typeStatement, ParseContext context) {
+    super(context);
     this.invertPredicate = typeStatement;
   }
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Node.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Node.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Node.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -16,6 +16,8 @@
 
 package org.mulgara.krule.rlog.ast;
 
+import org.mulgara.krule.rlog.ParseContext;
+
 /**
  * Base class for all nodes in the AST.
  * 
@@ -24,7 +26,19 @@
  * @copyright &copy; 2008 <a href="http://www.fedora-commons.org/">Fedora Commons</a>
  */
 public abstract class Node {
+
+  /** This contains domain data relevant to the parsing context. */
+  protected ParseContext parseContext;
+
   /**
+   * Create this node, with the context it requires.
+   * @param context The context passed in from the parser.
+   */
+  protected Node(ParseContext context) {
+    parseContext = context;
+  }
+
+  /**
    * Double binding return point for use with the visitor pattern.
    * @param walker The Visitor object.
    */

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/NullPredicate.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/NullPredicate.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/NullPredicate.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -39,7 +39,7 @@
    * Creates a null predicate.
    */
   private NullPredicate() {
-    super();
+    super(null);
   }
 
   /** {@inheritDoc} */

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Predicate.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Predicate.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Predicate.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -20,6 +20,7 @@
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.RDFNode;
 import org.mulgara.krule.rlog.rdf.URIReference;
@@ -59,6 +60,14 @@
   protected URIParseException delayedObjectException = null;
 
   /**
+   * Create this predicate instance, with the context it requires.
+   * @param context The context passed in from the parser.
+   */
+  public Predicate(ParseContext context) {
+    super(context);
+  }
+
+  /**
    * Sets the parent AST node.
    * @param parent The statement which contains this predicate.
    */

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/PredicateLiteral.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/PredicateLiteral.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/PredicateLiteral.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -18,6 +18,7 @@
 
 import java.net.URISyntaxException;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.NSUtils;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.RDFNode;
@@ -43,8 +44,10 @@
    * Creates a new literal, including a domain, for use in a binary predicate.
    * @param domain The domain for the name (eg. rdfs or owl).
    * @param name The name of the literal.
+   * @param context The context passed in from the parser.
    */
-  public PredicateLiteral(String domain, String name) {
+  public PredicateLiteral(String domain, String name, ParseContext context) {
+    super(context);
     // use some indirect references to let the compiler know we are really setting the final values
     // storing null in ref means that the URI syntax is invalid
     URIReference r = null;
@@ -52,10 +55,10 @@
     try {
       if (domain == null) {
         n = NSUtils.newName(name);
-        r = new URIReference(name);
+        r = new URIReference(name, context);
       } else {
         n = NSUtils.newName(domain, name);
-        r = new URIReference(domain, name);
+        r = new URIReference(domain, name, context);
       }
     } catch (URISyntaxException e) { /* r == null */ }
     this.name = n;

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Rule.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Rule.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Rule.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -25,6 +25,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.TypeException;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.RDFNode;
@@ -32,7 +33,7 @@
 import org.mulgara.krule.rlog.rdf.Var;
 
 /**
- *  Represents a rule statement.
+ * Represents a rule statement.
  * 
  * @created May 16, 2008
  * @author Paul Gearon
@@ -55,8 +56,8 @@
   /** The name of this rule. Used in RDF. */
   private String name;
 
-  public Rule(List<Predicate> body) {
-    this(NullPredicate.NULL, body);
+  public Rule(List<Predicate> body,  ParseContext context) {
+    this(NullPredicate.NULL, body, context);
   }
 
   /**
@@ -64,8 +65,10 @@
    * and checks for soundness.
    * @param head A Predicate containing a subset of variables from the body.
    * @param body A set of Predicates for the body.
+   * @param context The context passed in from the parser.
    */
-  public Rule(Predicate head, List<Predicate> body) {
+  public Rule(Predicate head, List<Predicate> body, ParseContext context) {
+    super(context);
     this.head = head;
     this.body = body;
     this.bodySubtractions = new LinkedList<Predicate>();

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Statement.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Statement.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Statement.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -16,6 +16,8 @@
 
 package org.mulgara.krule.rlog.ast;
 
+import org.mulgara.krule.rlog.ParseContext;
+
 /**
  * Marker class to represent top level nodes in the AST.
  * 
@@ -24,5 +26,14 @@
  * @copyright &copy; 2008 <a href="http://www.fedora-commons.org/">Fedora Commons</a>
  */
 public abstract class Statement extends Node {
+
+  /**
+   * Create this statement, with the context it requires.
+   * @param context The context passed in from the parser.
+   */
+  protected Statement(ParseContext context) {
+    super(context);
+  }
+
 }
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/StringLiteral.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/StringLiteral.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/StringLiteral.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -16,6 +16,7 @@
 
 package org.mulgara.krule.rlog.ast;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.rdf.Literal;
 import org.mulgara.krule.rlog.rdf.RDFNode;
 
@@ -34,8 +35,11 @@
   /**
    * A new string literal.
    * @param value The contents of the quoted string.
+   * @param context The context passed in from the parser. Keeping this in case we need it
+   *        in future for datatyped literals.
    */
-  public StringLiteral(String value) {
+  public StringLiteral(String value, ParseContext context) {
+    super(context);
     this.value = value;
   }
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeLiteral.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeLiteral.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeLiteral.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -16,6 +16,8 @@
 
 package org.mulgara.krule.rlog.ast;
 
+import org.mulgara.krule.rlog.ParseContext;
+
 /**
  * A literal for use in unary type predicates.
  * 
@@ -29,9 +31,10 @@
    * Creates a new literal with a domain for a type predicate.
    * @param domain The domain for the literal.
    * @param name The text of the literal.
+   * @param context The context passed in from the parser.
    */
-  public TypeLiteral(String domain, String name) {
-    super(domain, name);
+  public TypeLiteral(String domain, String name, ParseContext context) {
+    super(domain, name, context);
   }
 
   //inheritdoc

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeStatement.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeStatement.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/TypeStatement.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -19,6 +19,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.URIParseException;
 import org.mulgara.krule.rlog.rdf.MulgaraGraphs;
 import org.mulgara.krule.rlog.rdf.RDF;
@@ -45,9 +46,10 @@
    * Creates a unary predicate indicating a type statement.
    * @param typeLabel The declared type.
    * @param param The object declared to be of the specified type.
+   * @param context The context passed in from the parser.
    */
-  public TypeStatement(TypeLabel typeLabel, PredicateParam param) {
-    super();
+  public TypeStatement(TypeLabel typeLabel, PredicateParam param, ParseContext context) {
+    super(context);
     this.typeLabel = typeLabel;
     this.param = param;
     // get the referenced nodes, delaying any exceptions until later.

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Variable.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Variable.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/ast/Variable.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -30,7 +30,11 @@
 
   public final String name;
 
+  /**
+   * Create this variable, with the context it requires.
+   */
   public Variable(String name) {
+    super(null);
     this.name = name;
   }
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/parser/NSUtils.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/parser/NSUtils.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/parser/NSUtils.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -120,4 +120,14 @@
     String namespace = registeredDomains.get(domain);
     return (namespace == null ? domain + ":" : namespace) + uriStr;
   }
+
+  /**
+   * Retrieves the namespace registered for a domain.
+   * @param domain The registered domain.
+   * @return The namespace associated with the domain, or <code>null</code> if the domain
+   *         was not registered.
+   */
+  public static String getRegisteredNamespace(String domain) {
+    return registeredDomains.get(domain);
+  }
 }

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/MulgaraGraphs.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/MulgaraGraphs.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/MulgaraGraphs.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -36,11 +36,11 @@
  */
 public class MulgaraGraphs {
 
-  public static final URIReference MULGARA_PRE = URIReference.create(MULGARA_PREFIX, "prefix");
+  public static final URIReference MULGARA_PRE = URIReference.contextFreeCreate(MULGARA_PREFIX, "prefix");
 
-  public static final URIReference MULGARA_URI_REF = URIReference.create(MULGARA_PREFIX, "UriReference");
+  public static final URIReference MULGARA_URI_REF = URIReference.contextFreeCreate(MULGARA_PREFIX, "UriReference");
 
-  public static final URIReference MULGARA_LITERAL = URIReference.create(RDFS_PREFIX, "Literal");
+  public static final URIReference MULGARA_LITERAL = URIReference.contextFreeCreate(RDFS_PREFIX, "Literal");
 
   public static final URIReference MULGARA_PRE_GRAPH = URIReference.create(MULGARA_PREFIX, "prefixGraph", "sys:prefix");
 

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/RDF.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/RDF.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/RDF.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -31,7 +31,7 @@
 
   public static final String PREFIX = "rdf";
 
-  public static final URIReference TYPE = URIReference.create(PREFIX, "type");
+  public static final URIReference TYPE = URIReference.contextFreeCreate(PREFIX, "type");
 
   public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema#";
 
@@ -67,6 +67,6 @@
 
   // Specific URIs used by the standard parser
 
-  public static final URIReference XSD_LONG = URIReference.create(XSD_PREFIX, "long");
+  public static final URIReference XSD_LONG = URIReference.contextFreeCreate(XSD_PREFIX, "long");
 
 }

Modified: trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/URIReference.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/URIReference.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/java/org/mulgara/krule/rlog/rdf/URIReference.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -19,6 +19,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.mulgara.krule.rlog.ParseContext;
 import org.mulgara.krule.rlog.parser.NSUtils;
 
 /**
@@ -37,16 +38,28 @@
 
   private final String value;
 
-  public URIReference(String prefix, String value) throws URISyntaxException {
+  /**
+   * This constructor is for context free use only, such as static initialization.
+   * @param prefix The prefix of the URI.
+   * @param value The value inside the namespace for the domain.
+   * @throws URISyntaxException If the URI is syntactically incorrect. Should not happen.
+   */
+  private URIReference(String prefix, String value) throws URISyntaxException {
     this.prefix = prefix;
     this.value = value;
     this.uri = NSUtils.newURI(prefix, value);
   }
 
-  public URIReference(String value) throws URISyntaxException {
+  public URIReference(String prefix, String value, ParseContext context) throws URISyntaxException {
+    this.prefix = prefix;
+    this.value = value;
+    this.uri = context.newURI(prefix, value);
+  }
+
+  public URIReference(String value, ParseContext context) throws URISyntaxException {
     this.prefix = NSUtils.getDefaultPrefix();
     this.value = value;
-    this.uri = NSUtils.newURI(prefix, value);
+    this.uri = context.newURI(prefix, value);
   }
 
   /** Internal mechanism for setting each element manually from a factory. */
@@ -61,11 +74,12 @@
    * can fail then use the constructor instead.
    * @param prefix A namespace prefix.
    * @param value The value within the namespace.
+   * @param context The current context of the parser.
    * @return A new URIReference.
    */
-  public static URIReference create(String prefix, String value) {
+  public static URIReference create(String prefix, String value, ParseContext context) {
     try {
-      return new URIReference(prefix, value);
+      return new URIReference(prefix, value, context);
     } catch (URISyntaxException e) {
       throw new IllegalArgumentException("Unable to create a URI for: " + prefix + ":" + value);
     }
@@ -75,13 +89,14 @@
    * Creates a URIReference. This requires the URI to be clean. If it is possible that this
    * can fail then use the constructor instead.
    * @param value The value within the namespace.
+   * @param context The current context of the parser.
    * @return A new URIReference.
    */
-  public static URIReference create(String value) {
+  public static URIReference create(String value, ParseContext context) {
     try {
-      return new URIReference(value);
+      return new URIReference(value, context);
     } catch (URISyntaxException e) {
-      throw new IllegalArgumentException("Unable to create a URI for: " + NSUtils.getDefaultDomain() + ":" + value);
+      throw new IllegalArgumentException("Unable to create a URI for: " + context.getBase() + ":" + value);
     }
   }
 
@@ -96,6 +111,20 @@
     return new URIReference(prefix, value, URI.create(uriStr));
   }
 
+  /**
+   * Creates a context free URIReference. This requires the URI to be clean.
+   * @param prefix A namespace prefix.
+   * @param value The value within the namespace.
+   * @return A new URIReference.
+   */
+  public static URIReference contextFreeCreate(String prefix, String value) {
+    try {
+      return new URIReference(prefix, value);
+    } catch (URISyntaxException e) {
+      throw new IllegalArgumentException("Unable to create a URI for: " + prefix + ":" + value);
+    }
+  }
+
   /** @see org.mulgara.krule.rlog.rdf.RDFNode#isVariable() */
   public boolean isVariable() {
     return false;

Modified: trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.java
===================================================================
--- trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -24,11 +24,25 @@
 
 public class RlogParser implements RlogParserConstants {
 
+  /** This context holds parse-specific domain mappings. */
+  private ParseContext context = new ParseContext();
+
+  /**
+   * Parse an entire document into statements.
+   * @param query The document as a string.
+   * @return A list of Statements parsed from the document.
+   * @throws ParseException Due to a syntactical or grammatical error in the query document.
+   */
   public static List<Statement> parse(String query) throws ParseException {
     RlogParser parser = new RlogParser(new StringReader(query));
     return parser.statements();
   }
 
+  /**
+   * Remove quotation marks from the front and back of a string.
+   * @param str The string to unquote.
+   * @return A string containing everything from <var>str</var> between the outermost quotes.
+   */
   private static final String unq(String str) {
     return str.substring(1, str.length() - 1);
   }
@@ -40,8 +54,10 @@
     label_1:
     while (true) {
       s = statement();
-                   sList.add(s);
+                   if (s != null) sList.add(s);
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case PREFIX:
+      case BASE:
       case IMPLIED_BY:
       case INVERT:
       case IDENTIFIER:
@@ -55,32 +71,54 @@
         break label_1;
       }
     }
-                                        {if (true) return sList;}
+                                                       {if (true) return sList;}
     throw new Error("Missing return statement in function");
   }
 
 /* statement   ::= axiom | rule */
   final public Statement statement() throws ParseException {
+  String d, ns;
   Statement s;
-    if (jj_2_1(10)) {
-      s = axiom();
-    } else {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case IMPLIED_BY:
-      case INVERT:
-      case IDENTIFIER:
-      case VARIABLE:
-      case TYPE:
-      case DOMAIN:
-        s = rule();
-        break;
-      default:
-        jj_la1[1] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case PREFIX:
+      prefix();
+             {if (true) return null;}
+      break;
+    case BASE:
+      base();
+           {if (true) return null;}
+      break;
+    case IMPLIED_BY:
+    case INVERT:
+    case IDENTIFIER:
+    case VARIABLE:
+    case TYPE:
+    case DOMAIN:
+      if (jj_2_1(10)) {
+        s = axiom();
+      } else {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case IMPLIED_BY:
+        case INVERT:
+        case IDENTIFIER:
+        case VARIABLE:
+        case TYPE:
+        case DOMAIN:
+          s = rule();
+          break;
+        default:
+          jj_la1[1] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
       }
+                                           {if (true) return s;}
+      break;
+    default:
+      jj_la1[2] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
     }
-                                           {if (true) return s;}
     throw new Error("Missing return statement in function");
   }
 
@@ -89,7 +127,7 @@
   Predicate p;
     p = predicate();
     jj_consume_token(DOT);
-                        {if (true) return new Axiom(p);}
+                        {if (true) return new Axiom(p, context);}
     throw new Error("Missing return statement in function");
   }
 
@@ -102,7 +140,7 @@
       jj_consume_token(IMPLIED_BY);
       body = predicateList();
       jj_consume_token(DOT);
-                                            {if (true) return new Rule(body);}
+                                            {if (true) return new Rule(body, context);}
       break;
     case INVERT:
     case IDENTIFIER:
@@ -113,10 +151,10 @@
       jj_consume_token(IMPLIED_BY);
       body = predicateList();
       jj_consume_token(DOT);
-                                                             {if (true) return new Rule(head, body);}
+                                                             {if (true) return new Rule(head, body, context);}
       break;
     default:
-      jj_la1[2] = jj_gen;
+      jj_la1[3] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -140,10 +178,10 @@
       case INVERT:
         jj_consume_token(INVERT);
         p = predicate();
-                           {if (true) return new InvertedPredicate(p);}
+                           {if (true) return new InvertedPredicate(p, context);}
         break;
       default:
-        jj_la1[3] = jj_gen;
+        jj_la1[4] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -164,24 +202,24 @@
         d = dom();
         break;
       default:
-        jj_la1[4] = jj_gen;
+        jj_la1[5] = jj_gen;
         ;
       }
       t = jj_consume_token(TYPE);
       jj_consume_token(LPAR);
       p = parameterElt();
       jj_consume_token(RPAR);
-    {if (true) return new TypeStatement(new TypeLiteral(d, t.image), p);}
+    {if (true) return new TypeStatement(new TypeLiteral(d, t.image, context), p, context);}
       break;
     case VARIABLE:
       t = jj_consume_token(VARIABLE);
       jj_consume_token(LPAR);
       p = parameterElt();
       jj_consume_token(RPAR);
-                                                {if (true) return new TypeStatement(new Variable(t.image), p);}
+                                                {if (true) return new TypeStatement(new Variable(t.image), p, context);}
       break;
     default:
-      jj_la1[5] = jj_gen;
+      jj_la1[6] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -202,7 +240,7 @@
         d = dom();
         break;
       default:
-        jj_la1[6] = jj_gen;
+        jj_la1[7] = jj_gen;
         ;
       }
       pred = jj_consume_token(IDENTIFIER);
@@ -211,7 +249,7 @@
       jj_consume_token(COMMA);
       right = parameter();
       jj_consume_token(RPAR);
-    {if (true) return new BPredicate(new BPredicateLiteral(d, pred.image), left, right);}
+    {if (true) return new BPredicate(new BPredicateLiteral(d, pred.image, context), left, right, context);}
       break;
     case VARIABLE:
       pred = jj_consume_token(VARIABLE);
@@ -220,10 +258,10 @@
       jj_consume_token(COMMA);
       right = parameter();
       jj_consume_token(RPAR);
-    {if (true) return new BPredicate(new Variable(pred.image), left, right);}
+    {if (true) return new BPredicate(new Variable(pred.image), left, right, context);}
       break;
     default:
-      jj_la1[7] = jj_gen;
+      jj_la1[8] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -241,11 +279,11 @@
         d = dom();
         break;
       default:
-        jj_la1[8] = jj_gen;
+        jj_la1[9] = jj_gen;
         ;
       }
       t = jj_consume_token(IDENTIFIER);
-                              {if (true) return new BPredicateLiteral(d, t.image);}
+                              {if (true) return new BPredicateLiteral(d, t.image, context);}
     } else {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case TYPE:
@@ -255,18 +293,18 @@
           d = dom();
           break;
         default:
-          jj_la1[9] = jj_gen;
+          jj_la1[10] = jj_gen;
           ;
         }
         t = jj_consume_token(TYPE);
-                        {if (true) return new TypeLiteral(d, t.image);}
+                        {if (true) return new TypeLiteral(d, t.image, context);}
         break;
       case VARIABLE:
         t = jj_consume_token(VARIABLE);
                  {if (true) return new Variable(t.image);}
         break;
       default:
-        jj_la1[10] = jj_gen;
+        jj_la1[11] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -291,7 +329,7 @@
                 {if (true) return p;}
       break;
     default:
-      jj_la1[11] = jj_gen;
+      jj_la1[12] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -308,10 +346,10 @@
       break;
     case STRING_LITERAL:
       t = jj_consume_token(STRING_LITERAL);
-                       {if (true) return new StringLiteral(StringUtil.unescapeJavaString(unq(t.image)));}
+                       {if (true) return new StringLiteral(StringUtil.unescapeJavaString(unq(t.image)), context);}
       break;
     default:
-      jj_la1[12] = jj_gen;
+      jj_la1[13] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -331,7 +369,7 @@
         ;
         break;
       default:
-        jj_la1[13] = jj_gen;
+        jj_la1[14] = jj_gen;
         break label_2;
       }
       jj_consume_token(COMMA);
@@ -342,6 +380,25 @@
     throw new Error("Missing return statement in function");
   }
 
+/* prefix  := PREFIX dom uri DOT */
+  final public void prefix() throws ParseException {
+  String d, ns;
+    jj_consume_token(PREFIX);
+    d = dom();
+    ns = uri();
+    jj_consume_token(DOT);
+                                    context.registerDomain(d, ns);
+  }
+
+/* base  := BASE uri DOT */
+  final public void base() throws ParseException {
+  String ns;
+    jj_consume_token(BASE);
+    ns = uri();
+    jj_consume_token(DOT);
+                          context.setBase(ns);
+  }
+
 /* dom              ::= DOMAIN */
   final public String dom() throws ParseException {
   Token d;
@@ -350,6 +407,14 @@
     throw new Error("Missing return statement in function");
   }
 
+/* uri              ::= URI */
+  final public String uri() throws ParseException {
+  Token u;
+    u = jj_consume_token(URI);
+            {if (true) return unq(u.image);}
+    throw new Error("Missing return statement in function");
+  }
+
   final private boolean jj_2_1(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_1(); }
@@ -371,6 +436,96 @@
     finally { jj_save(2, xla); }
   }
 
+  final private boolean jj_3R_8() {
+    if (jj_scan_token(VARIABLE)) return true;
+    if (jj_scan_token(LPAR)) return true;
+    if (jj_3R_13()) return true;
+    if (jj_scan_token(RPAR)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_26() {
+    if (jj_scan_token(STRING_LITERAL)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_25() {
+    if (jj_scan_token(INTEGER_LITERAL)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_24() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_25()) {
+    jj_scanpos = xsp;
+    if (jj_3R_26()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_12() {
+    if (jj_3R_9()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_7() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_12()) jj_scanpos = xsp;
+    if (jj_scan_token(TYPE)) return true;
+    if (jj_scan_token(LPAR)) return true;
+    if (jj_3R_13()) return true;
+    if (jj_scan_token(RPAR)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_4() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_7()) {
+    jj_scanpos = xsp;
+    if (jj_3R_8()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_23() {
+    if (jj_3R_24()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_22() {
+    if (jj_3R_13()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_21() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_22()) {
+    jj_scanpos = xsp;
+    if (jj_3R_23()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_11() {
+    if (jj_scan_token(INVERT)) return true;
+    if (jj_3R_6()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_10() {
+    if (jj_3R_14()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_9() {
+    if (jj_scan_token(DOMAIN)) return true;
+    return false;
+  }
+
   final private boolean jj_3R_6() {
     Token xsp;
     xsp = jj_scanpos;
@@ -433,11 +588,6 @@
     return false;
   }
 
-  final private boolean jj_3R_9() {
-    if (jj_scan_token(DOMAIN)) return true;
-    return false;
-  }
-
   final private boolean jj_3R_3() {
     if (jj_3R_6()) return true;
     if (jj_scan_token(DOT)) return true;
@@ -487,91 +637,6 @@
     return false;
   }
 
-  final private boolean jj_3R_8() {
-    if (jj_scan_token(VARIABLE)) return true;
-    if (jj_scan_token(LPAR)) return true;
-    if (jj_3R_13()) return true;
-    if (jj_scan_token(RPAR)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_26() {
-    if (jj_scan_token(STRING_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_25() {
-    if (jj_scan_token(INTEGER_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_24() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_25()) {
-    jj_scanpos = xsp;
-    if (jj_3R_26()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_12() {
-    if (jj_3R_9()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_7() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_12()) jj_scanpos = xsp;
-    if (jj_scan_token(TYPE)) return true;
-    if (jj_scan_token(LPAR)) return true;
-    if (jj_3R_13()) return true;
-    if (jj_scan_token(RPAR)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_4() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_7()) {
-    jj_scanpos = xsp;
-    if (jj_3R_8()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_23() {
-    if (jj_3R_24()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_22() {
-    if (jj_3R_13()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_21() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_22()) {
-    jj_scanpos = xsp;
-    if (jj_3R_23()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_11() {
-    if (jj_scan_token(INVERT)) return true;
-    if (jj_3R_6()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_10() {
-    if (jj_3R_14()) return true;
-    return false;
-  }
-
   public RlogParserTokenManager token_source;
   SimpleCharStream jj_input_stream;
   public Token token, jj_nt;
@@ -581,13 +646,13 @@
   public boolean lookingAhead = false;
   private boolean jj_semLA;
   private int jj_gen;
-  final private int[] jj_la1 = new int[14];
+  final private int[] jj_la1 = new int[15];
   static private int[] jj_la1_0;
   static {
       jj_la1_0();
    }
    private static void jj_la1_0() {
-      jj_la1_0 = new int[] {0x1703000,0x1703000,0x1703000,0x1302000,0x1000000,0x1600000,0x1000000,0x1300000,0x1000000,0x1000000,0x1600000,0x1f80000,0x880000,0x10000,};
+      jj_la1_0 = new int[] {0xb80c300,0xb80c000,0xb80c300,0xb80c000,0x9808000,0x8000000,0xb000000,0x8000000,0x9800000,0x8000000,0x8000000,0xb000000,0xfa00000,0x4200000,0x40000,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[3];
   private boolean jj_rescan = false;
@@ -602,7 +667,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -615,7 +680,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -625,7 +690,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -635,7 +700,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -644,7 +709,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -653,7 +718,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 14; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 15; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -764,15 +829,15 @@
 
   public ParseException generateParseException() {
     jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[25];
-    for (int i = 0; i < 25; i++) {
+    boolean[] la1tokens = new boolean[28];
+    for (int i = 0; i < 28; i++) {
       la1tokens[i] = false;
     }
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
     }
-    for (int i = 0; i < 14; i++) {
+    for (int i = 0; i < 15; i++) {
       if (jj_la1[i] == jj_gen) {
         for (int j = 0; j < 32; j++) {
           if ((jj_la1_0[i] & (1<<j)) != 0) {
@@ -781,7 +846,7 @@
         }
       }
     }
-    for (int i = 0; i < 25; i++) {
+    for (int i = 0; i < 28; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;

Modified: trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.jj
===================================================================
--- trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.jj	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParser.jj	2009-02-28 07:05:37 UTC (rev 1567)
@@ -34,11 +34,25 @@
 
 public class RlogParser {
 
+  /** This context holds parse-specific domain mappings. */
+  private ParseContext context = new ParseContext();
+
+  /**
+   * Parse an entire document into statements.
+   * @param query The document as a string.
+   * @return A list of Statements parsed from the document.
+   * @throws ParseException Due to a syntactical or grammatical error in the query document.
+   */
   public static List<Statement> parse(String query) throws ParseException {
     RlogParser parser = new RlogParser(new StringReader(query));
     return parser.statements();
   }
 
+  /**
+   * Remove quotation marks from the front and back of a string.
+   * @param str The string to unquote.
+   * @return A string containing everything from <var>str</var> between the outermost quotes.
+   */
   private static final String unq(String str) {
     return str.substring(1, str.length() - 1);
   }
@@ -53,6 +67,12 @@
 <IN_COMMENT>
 SPECIAL_TOKEN : { < COMMENT: (~["\r","\n"])* > : DEFAULT }
 
+TOKEN [IGNORE_CASE] :
+{
+    < PREFIX : "@prefix" >
+  | < BASE : "@base" >
+}
+
 TOKEN :
 {
     < #LOWER_CASE_LETTER: ["a"-"z"] >
@@ -85,6 +105,7 @@
       )*
       "\""
   >
+  | < URI : "<" ( ~[" ", ">", "\n", "\r"] )* ">" >
 }
 
 TOKEN :
@@ -93,7 +114,7 @@
   | < VARIABLE : <UPPER_CASE_LETTER> >
   | < TYPE : <UPPER_CASE_LETTER> (<J_LETTER_DIGIT>)+ >
   | < INTEGER_LITERAL : ("0" | ["1"-"9"] (<DIGIT>)*) >
-  | < DOMAIN : (<LOWER_CASE_LETTER>)+ ":" >
+  | < DOMAIN : (<LOWER_CASE_LETTER>)* ":" >
 }
 
 
@@ -102,15 +123,18 @@
   List<Statement> sList = new ArrayList<Statement>();
   Statement s;
 } {
-  (s=statement() { sList.add(s); } )+ { return sList; }
+  (s=statement() { if (s != null) sList.add(s); } )+ { return sList; }
 }
 
 
 /* statement   ::= axiom | rule */
 Statement statement() : {
+  String d, ns;
   Statement s;
 } {
-  ( LOOKAHEAD(10) s=axiom() | s=rule() ) { return s; }
+  prefix() { return null; }
+| base() { return null; }
+| ( LOOKAHEAD(10) s=axiom() | s=rule() ) { return s; }
 }
 
 
@@ -118,7 +142,7 @@
 Axiom axiom() : {
   Predicate p;
 } {
-  p=predicate() <DOT> { return new Axiom(p); }
+  p=predicate() <DOT> { return new Axiom(p, context); }
 }
 
 /* rule        ::= IMPLIED_BY predicate_list DOT | predicate IMPLIED_BY predicate_list DOT */
@@ -126,8 +150,8 @@
   List<Predicate> body;
   Predicate head;
 } {
-  <IMPLIED_BY> body=predicateList() <DOT> { return new Rule(body); }
-| head=predicate() <IMPLIED_BY> body=predicateList() <DOT> { return new Rule(head, body); }
+  <IMPLIED_BY> body=predicateList() <DOT> { return new Rule(body, context); }
+| head=predicate() <IMPLIED_BY> body=predicateList() <DOT> { return new Rule(head, body, context); }
 }
 
 /* predicate   ::= type_decl | binary_predicate | INVERT predicate */
@@ -137,7 +161,7 @@
   LOOKAHEAD(5)
   p=typeDecl() { return p; }
 | p=binaryPredicate() { return p; }
-| <INVERT> p=predicate() { return new InvertedPredicate(p); }
+| <INVERT> p=predicate() { return new InvertedPredicate(p, context); }
 }
 
 /* type_decl   ::= dom? TYPE LPAR parameter_elt RPAR | VARIABLE LPAREN parameter_elt RPAREN */
@@ -147,9 +171,9 @@
   String d = null;
 } {
   (d=dom())? t=<TYPE> <LPAR> p=parameterElt() <RPAR> {
-    return new TypeStatement(new TypeLiteral(d, t.image), p);
+    return new TypeStatement(new TypeLiteral(d, t.image, context), p, context);
   }
-| t=<VARIABLE> <LPAR> p=parameterElt() <RPAR> { return new TypeStatement(new Variable(t.image), p); }
+| t=<VARIABLE> <LPAR> p=parameterElt() <RPAR> { return new TypeStatement(new Variable(t.image), p, context); }
 }
 
 /* binary_predicate ::= dom? IDENTIFIER LPAR parameter_elt COMMA parameter RPAR
@@ -160,10 +184,10 @@
   PredicateParam left, right;
 } {
   (d=dom())? pred=<IDENTIFIER> <LPAR> left=parameterElt() <COMMA> right=parameter() <RPAR> {
-    return new BPredicate(new BPredicateLiteral(d, pred.image), left, right);
+    return new BPredicate(new BPredicateLiteral(d, pred.image, context), left, right, context);
   }
 | pred=<VARIABLE> <LPAR> left=parameterElt() <COMMA> right=parameter() <RPAR> {
-    return new BPredicate(new Variable(pred.image), left, right);
+    return new BPredicate(new Variable(pred.image), left, right, context);
   }
 }
 
@@ -175,8 +199,8 @@
   PredicateParam p;
 } {
   LOOKAHEAD(2)
-  (d=dom())? t=<IDENTIFIER> { return new BPredicateLiteral(d, t.image); }
-| (d=dom())? t=<TYPE> { return new TypeLiteral(d, t.image); }
+  (d=dom())? t=<IDENTIFIER> { return new BPredicateLiteral(d, t.image, context); }
+| (d=dom())? t=<TYPE> { return new TypeLiteral(d, t.image, context); }
 | t=<VARIABLE> { return new Variable(t.image); }
 }
 
@@ -195,7 +219,7 @@
   Token t;
 } {
   t=<INTEGER_LITERAL> { return new IntegerLiteral(t.image); }
-| t=<STRING_LITERAL> { return new StringLiteral(StringUtil.unescapeJavaString(unq(t.image))); }
+| t=<STRING_LITERAL> { return new StringLiteral(StringUtil.unescapeJavaString(unq(t.image)), context); }
 }
 
 
@@ -209,9 +233,34 @@
   { return predicates; }
 }
 
+
+/* prefix  := PREFIX dom uri DOT */
+void prefix() : {
+  String d, ns;
+} {
+  <PREFIX> d=dom() ns=uri() <DOT> { context.registerDomain(d, ns); }
+}
+
+
+/* base  := BASE uri DOT */
+void base() : {
+  String ns;
+} {
+  <BASE> ns=uri() <DOT> { context.setBase(ns); }
+}
+
+
 /* dom              ::= DOMAIN */
 String dom() : {
   Token d;
 } {
   d=<DOMAIN> { return d.image.substring(0, d.image.length() - 1); }
 }
+
+
+/* uri              ::= URI */
+String uri() : {
+  Token u;
+} {
+  u=<URI> { return unq(u.image); }
+}

Modified: trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserConstants.java
===================================================================
--- trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserConstants.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserConstants.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -5,23 +5,26 @@
 
   int EOF = 0;
   int COMMENT = 7;
-  int LOWER_CASE_LETTER = 8;
-  int UPPER_CASE_LETTER = 9;
-  int DIGIT = 10;
-  int J_LETTER_DIGIT = 11;
-  int IMPLIED_BY = 12;
-  int INVERT = 13;
-  int NEGATE = 14;
-  int DOT = 15;
-  int COMMA = 16;
-  int LPAR = 17;
-  int RPAR = 18;
-  int STRING_LITERAL = 19;
-  int IDENTIFIER = 20;
-  int VARIABLE = 21;
-  int TYPE = 22;
-  int INTEGER_LITERAL = 23;
-  int DOMAIN = 24;
+  int PREFIX = 8;
+  int BASE = 9;
+  int LOWER_CASE_LETTER = 10;
+  int UPPER_CASE_LETTER = 11;
+  int DIGIT = 12;
+  int J_LETTER_DIGIT = 13;
+  int IMPLIED_BY = 14;
+  int INVERT = 15;
+  int NEGATE = 16;
+  int DOT = 17;
+  int COMMA = 18;
+  int LPAR = 19;
+  int RPAR = 20;
+  int STRING_LITERAL = 21;
+  int URI = 22;
+  int IDENTIFIER = 23;
+  int VARIABLE = 24;
+  int TYPE = 25;
+  int INTEGER_LITERAL = 26;
+  int DOMAIN = 27;
 
   int DEFAULT = 0;
   int IN_COMMENT = 1;
@@ -35,6 +38,8 @@
     "\" \"",
     "\"--\"",
     "<COMMENT>",
+    "\"@prefix\"",
+    "\"@base\"",
     "<LOWER_CASE_LETTER>",
     "<UPPER_CASE_LETTER>",
     "<DIGIT>",
@@ -47,6 +52,7 @@
     "\"(\"",
     "\")\"",
     "<STRING_LITERAL>",
+    "<URI>",
     "<IDENTIFIER>",
     "<VARIABLE>",
     "<TYPE>",

Modified: trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserTokenManager.java
===================================================================
--- trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserTokenManager.java	2009-02-28 07:04:39 UTC (rev 1566)
+++ trunk/src/jar/content-rlog/javacc/org/mulgara/krule/rlog/RlogParserTokenManager.java	2009-02-28 07:05:37 UTC (rev 1567)
@@ -24,51 +24,53 @@
 {
   public  java.io.PrintStream debugStream = System.out;
   public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
-   switch (pos)
-   {
-      default :
-         return -1;
-   }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
-   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
 private final int jjStopAtPos(int pos, int kind)
 {
    jjmatchedKind = kind;
    jjmatchedPos = pos;
    return pos + 1;
 }
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_0(state, pos + 1);
-}
 private final int jjMoveStringLiteralDfa0_0()
 {
    switch(curChar)
    {
+      case 9:
+         jjmatchedKind = 1;
+         return jjMoveNfa_0(0, 0);
+      case 10:
+         jjmatchedKind = 2;
+         return jjMoveNfa_0(0, 0);
+      case 12:
+         jjmatchedKind = 4;
+         return jjMoveNfa_0(0, 0);
+      case 13:
+         jjmatchedKind = 3;
+         return jjMoveNfa_0(0, 0);
+      case 32:
+         jjmatchedKind = 5;
+         return jjMoveNfa_0(0, 0);
       case 40:
-         return jjStopAtPos(0, 17);
+         jjmatchedKind = 19;
+         return jjMoveNfa_0(0, 0);
       case 41:
-         return jjStopAtPos(0, 18);
+         jjmatchedKind = 20;
+         return jjMoveNfa_0(0, 0);
       case 44:
-         return jjStopAtPos(0, 16);
+         jjmatchedKind = 18;
+         return jjMoveNfa_0(0, 0);
       case 45:
-         jjmatchedKind = 14;
+         jjmatchedKind = 16;
          return jjMoveStringLiteralDfa1_0(0x40L);
       case 46:
-         return jjStopAtPos(0, 15);
+         jjmatchedKind = 17;
+         return jjMoveNfa_0(0, 0);
       case 58:
-         return jjMoveStringLiteralDfa1_0(0x1000L);
+         return jjMoveStringLiteralDfa1_0(0x4000L);
+      case 64:
+         return jjMoveStringLiteralDfa1_0(0x300L);
       case 126:
-         return jjStopAtPos(0, 13);
+         jjmatchedKind = 15;
+         return jjMoveNfa_0(0, 0);
       default :
          return jjMoveNfa_0(0, 0);
    }
@@ -77,22 +79,162 @@
 {
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(0, active0);
-      return 1;
+   return jjMoveNfa_0(0, 0);
    }
    switch(curChar)
    {
       case 45:
          if ((active0 & 0x40L) != 0L)
-            return jjStopAtPos(1, 6);
-         else if ((active0 & 0x1000L) != 0L)
-            return jjStopAtPos(1, 12);
+         {
+            jjmatchedKind = 6;
+            jjmatchedPos = 1;
+         }
+         else if ((active0 & 0x4000L) != 0L)
+         {
+            jjmatchedKind = 14;
+            jjmatchedPos = 1;
+         }
          break;
+      case 66:
+         return jjMoveStringLiteralDfa2_0(active0, 0x200L);
+      case 80:
+         return jjMoveStringLiteralDfa2_0(active0, 0x100L);
+      case 98:
+         return jjMoveStringLiteralDfa2_0(active0, 0x200L);
+      case 112:
+         return jjMoveStringLiteralDfa2_0(active0, 0x100L);
       default :
          break;
    }
-   return jjStartNfa_0(0, active0);
+   return jjMoveNfa_0(0, 1);
 }
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjMoveNfa_0(0, 1);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+   return jjMoveNfa_0(0, 1);
+   }
+   switch(curChar)
+   {
+      case 65:
+         return jjMoveStringLiteralDfa3_0(active0, 0x200L);
+      case 82:
+         return jjMoveStringLiteralDfa3_0(active0, 0x100L);
+      case 97:
+         return jjMoveStringLiteralDfa3_0(active0, 0x200L);
+      case 114:
+         return jjMoveStringLiteralDfa3_0(active0, 0x100L);
+      default :
+         break;
+   }
+   return jjMoveNfa_0(0, 2);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjMoveNfa_0(0, 2);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+   return jjMoveNfa_0(0, 2);
+   }
+   switch(curChar)
+   {
+      case 69:
+         return jjMoveStringLiteralDfa4_0(active0, 0x100L);
+      case 83:
+         return jjMoveStringLiteralDfa4_0(active0, 0x200L);
+      case 101:
+         return jjMoveStringLiteralDfa4_0(active0, 0x100L);
+      case 115:
+         return jjMoveStringLiteralDfa4_0(active0, 0x200L);
+      default :
+         break;
+   }
+   return jjMoveNfa_0(0, 3);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjMoveNfa_0(0, 3);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+   return jjMoveNfa_0(0, 3);
+   }
+   switch(curChar)
+   {
+      case 69:
+         if ((active0 & 0x200L) != 0L)
+         {
+            jjmatchedKind = 9;
+            jjmatchedPos = 4;
+         }
+         break;
+      case 70:
+         return jjMoveStringLiteralDfa5_0(active0, 0x100L);
+      case 101:
+         if ((active0 & 0x200L) != 0L)
+         {
+            jjmatchedKind = 9;
+            jjmatchedPos = 4;
+         }
+         break;
+      case 102:
+         return jjMoveStringLiteralDfa5_0(active0, 0x100L);
+      default :
+         break;
+   }
+   return jjMoveNfa_0(0, 4);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjMoveNfa_0(0, 4);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+   return jjMoveNfa_0(0, 4);
+   }
+   switch(curChar)
+   {
+      case 73:
+         return jjMoveStringLiteralDfa6_0(active0, 0x100L);
+      case 105:
+         return jjMoveStringLiteralDfa6_0(active0, 0x100L);
+      default :
+         break;
+   }
+   return jjMoveNfa_0(0, 5);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjMoveNfa_0(0, 5);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+   return jjMoveNfa_0(0, 5);
+   }
+   switch(curChar)
+   {
+      case 88:
+         if ((active0 & 0x100L) != 0L)
+         {
+            jjmatchedKind = 8;
+            jjmatchedPos = 6;
+         }
+         break;
+      case 120:
+         if ((active0 & 0x100L) != 0L)
+         {
+            jjmatchedKind = 8;
+            jjmatchedPos = 6;
+         }
+         break;
+      default :
+         break;
+   }
+   return jjMoveNfa_0(0, 6);
+}
 private final void jjCheckNAdd(int state)
 {
    if (jjrounds[state] != jjround)
@@ -131,9 +273,16 @@
 };
 private final int jjMoveNfa_0(int startState, int curPos)
 {
+   int strKind = jjmatchedKind;
+   int strPos = jjmatchedPos;
+   int seenUpto;
+   input_stream.backup(seenUpto = curPos + 1);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { throw new Error("Internal Error"); }
+   curPos = 0;
    int[] nextStates;
    int startsAt = 0;
-   jjnewStateCnt = 18;
+   jjnewStateCnt = 21;
    int i = 1;
    jjstateSet[0] = startState;
    int j, kind = 0x7fffffff;
@@ -151,15 +300,22 @@
                case 0:
                   if ((0x3fe000000000000L & l) != 0L)
                   {
-                     if (kind > 23)
-                        kind = 23;
-                     jjCheckNAdd(11);
+                     if (kind > 26)
+                        kind = 26;
+                     jjCheckNAdd(14);
                   }
+                  else if (curChar == 58)
+                  {
+                     if (kind > 27)
+                        kind = 27;
+                  }
                   else if (curChar == 48)
                   {
-                     if (kind > 23)
-                        kind = 23;
+                     if (kind > 26)
+                        kind = 26;
                   }
+                  else if (curChar == 60)
+                     jjCheckNAddTwoStates(10, 11);
                   else if (curChar == 34)
                      jjCheckNAddStates(0, 2);
                   break;
@@ -172,8 +328,8 @@
                      jjCheckNAddStates(0, 2);
                   break;
                case 4:
-                  if (curChar == 34 && kind > 19)
-                     kind = 19;
+                  if (curChar == 34 && kind > 21)
+                     kind = 21;
                   break;
                case 5:
                   if ((0xff000000000000L & l) != 0L)
@@ -192,41 +348,53 @@
                      jjCheckNAdd(6);
                   break;
                case 9:
-                  if (curChar == 48 && kind > 23)
-                     kind = 23;
+                  if (curChar == 60)
+                     jjCheckNAddTwoStates(10, 11);
                   break;
                case 10:
-                  if ((0x3fe000000000000L & l) == 0L)
-                     break;
-                  if (kind > 23)
-                     kind = 23;
-                  jjCheckNAdd(11);
+                  if ((0xbffffffeffffdbffL & l) != 0L)
+                     jjCheckNAddTwoStates(10, 11);
                   break;
                case 11:
-                  if ((0x3ff000000000000L & l) == 0L)
+                  if (curChar == 62 && kind > 22)
+                     kind = 22;
+                  break;
+               case 12:
+                  if (curChar == 48 && kind > 26)
+                     kind = 26;
+                  break;
+               case 13:
+                  if ((0x3fe000000000000L & l) == 0L)
                      break;
-                  if (kind > 23)
-                     kind = 23;
-                  jjCheckNAdd(11);
+                  if (kind > 26)
+                     kind = 26;
+                  jjCheckNAdd(14);
                   break;
-               case 13:
+               case 14:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 20)
-                     kind = 20;
-                  jjstateSet[jjnewStateCnt++] = 13;
+                  if (kind > 26)
+                     kind = 26;
+                  jjCheckNAdd(14);
                   break;
                case 15:
-                  if (curChar == 58 && kind > 24)
-                     kind = 24;
+                  if (curChar == 58 && kind > 27)
+                     kind = 27;
                   break;
                case 17:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 22)
-                     kind = 22;
+                  if (kind > 23)
+                     kind = 23;
                   jjstateSet[jjnewStateCnt++] = 17;
                   break;
+               case 20:
+                  if ((0x3ff000000000000L & l) == 0L)
+                     break;
+                  if (kind > 25)
+                     kind = 25;
+                  jjstateSet[jjnewStateCnt++] = 20;
+                  break;
                default : break;
             }
          } while(i != startsAt);
@@ -241,14 +409,14 @@
                case 0:
                   if ((0x7fffffeL & l) != 0L)
                   {
-                     if (kind > 21)
-                        kind = 21;
-                     jjCheckNAdd(17);
+                     if (kind > 24)
+                        kind = 24;
+                     jjCheckNAdd(20);
                   }
                   else if ((0x7fffffe00000000L & l) != 0L)
                   {
-                     if (kind > 20)
-                        kind = 20;
+                     if (kind > 23)
+                        kind = 23;
                      jjCheckNAddStates(7, 9);
                   }
                   break;
@@ -264,37 +432,40 @@
                   if ((0x14404410000000L & l) != 0L)
                      jjCheckNAddStates(0, 2);
                   break;
-               case 12:
+               case 10:
+                  jjAddStates(13, 14);
+                  break;
+               case 16:
                   if ((0x7fffffe00000000L & l) == 0L)
                      break;
-                  if (kind > 20)
-                     kind = 20;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddStates(7, 9);
                   break;
-               case 13:
+               case 17:
                   if ((0x7fffffe87fffffeL & l) == 0L)
                      break;
-                  if (kind > 20)
-                     kind = 20;
-                  jjCheckNAdd(13);
+                  if (kind > 23)
+                     kind = 23;
+                  jjCheckNAdd(17);
                   break;
-               case 14:
+               case 18:
                   if ((0x7fffffe00000000L & l) != 0L)
-                     jjCheckNAddTwoStates(14, 15);
+                     jjCheckNAddTwoStates(18, 15);
                   break;
-               case 16:
+               case 19:
                   if ((0x7fffffeL & l) == 0L)
                      break;
-                  if (kind > 21)
-                     kind = 21;
-                  jjCheckNAdd(17);
+                  if (kind > 24)
+                     kind = 24;
+                  jjCheckNAdd(20);
                   break;
-               case 17:
+               case 20:
                   if ((0x7fffffe87fffffeL & l) == 0L)
                      break;
-                  if (kind > 22)
-                     kind = 22;
-                  jjCheckNAdd(17);
+                  if (kind > 25)
+                     kind = 25;
+                  jjCheckNAdd(20);
                   break;
                default : break;
             }
@@ -315,6 +486,10 @@
                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjAddStates(0, 2);
                   break;
+               case 10:
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+                     jjAddStates(13, 14);
+                  break;
                default : break;
             }
          } while(i != startsAt);
@@ -326,11 +501,30 @@
          kind = 0x7fffffff;
       }
       ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 18 - (jjnewStateCnt = startsAt)))
-         return curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 21 - (jjnewStateCnt = startsAt)))
+         break;
       try { curChar = input_stream.readChar(); }
-      catch(java.io.IOException e) { return curPos; }
+      catch(java.io.IOException e) { break; }
    }
+   if (jjmatchedPos > strPos)
+      return curPos;
+
+   int toRet = Math.max(curPos, seenUpto);
+
+   if (curPos < toRet)
+      for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; )
+         try { curChar = input_stream.readChar(); }
+         catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); }
+
+   if (jjmatchedPos < strPos)
+   {
+      jjmatchedKind = strKind;
+      jjmatchedPos = strPos;
+   }
+   else if (jjmatchedPos == strPos && jjmatchedKind > strKind)
+      jjmatchedKind = strKind;
+
+   return toRet;
 }
 private final int jjMoveStringLiteralDfa0_1()
 {
@@ -416,7 +610,7 @@
    }
 }
 static final int[] jjnextStates = {
-   1, 2, 4, 1, 2, 6, 4, 13, 14, 15, 3, 5, 7, 
+   1, 2, 4, 1, 2, 6, 4, 17, 18, 15, 3, 5, 7, 10, 11, 
 };
 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
 {
@@ -431,17 +625,19 @@
    }
 }
 public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, null, null, null, null, null, 
-"\72\55", "\176", "\55", "\56", "\54", "\50", "\51", null, null, null, null, null, null, };
+"", null, null, null, null, null, null, null, null, null, null, null, null, 
+null, "\72\55", "\176", "\55", "\56", "\54", "\50", "\51", null, null, null, null, 
+null, null, null, };
 public static final String[] lexStateNames = {
    "DEFAULT", 
    "IN_COMMENT", 
 };
 public static final int[] jjnewLexState = {
    -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, 
 };
 static final long[] jjtoToken = {
-   0x1fff001L, 
+   0xfffc301L, 
 };
 static final long[] jjtoSkip = {
    0xbeL, 
@@ -453,8 +649,8 @@
    0x40L, 
 };
 protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[18];
-private final int[] jjstateSet = new int[36];
+private final int[] jjrounds = new int[21];
+private final int[] jjstateSet = new int[42];
 StringBuffer image;
 int jjimageLen;
 int lengthOfMatch;
@@ -479,7 +675,7 @@
 {
    int i;
    jjround = 0x80000001;
-   for (i = 18; i-- > 0;)
+   for (i = 21; i-- > 0;)
       jjrounds[i] = 0x80000000;
 }
 public void ReInit(SimpleCharStream stream, int lexState)
@@ -556,11 +752,6 @@
      switch(curLexState)
      {
        case 0:
-         try { input_stream.backup(0);
-            while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
-               curChar = input_stream.BeginToken();
-         }
-         catch (java.io.IOException e1) { continue EOFLoop; }
          jjmatchedKind = 0x7fffffff;
          jjmatchedPos = 0;
          curPos = jjMoveStringLiteralDfa0_0();




More information about the Mulgara-svn mailing list