anchor.diff:    static String occi_core_self          = "occi.core.self";
     static String occi_core_category      = "occi.core.category";
   
  +  private String last_error = "";
  +
     public static OcciParser getParser(String occiHeader) throws Exception {
   
       CharStream stream = new ANTLRStringStream(occiHeader);
  -    OcciLexer lexer = new OcciLexer(stream);
  -    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
  -    OcciParser parser = new OcciParser(tokenStream);
  -
  -    if(parser.getNumberOfSyntaxErrors() > 0)
  -      throw new Exception("Errors (" + parser.getNumberOfSyntaxErrors() + ") in parsing the input string");
  +	  OcciLexer lexer = new OcciLexer(stream);
  +	  CommonTokenStream tokenStream = new CommonTokenStream(lexer);
  +	  OcciParser parser = new OcciParser(tokenStream);
   
       return parser;
  +  }
  +
  +  public String getLastError(){
  +    return last_error;
  +  }
  +}
  +
  +@rulecatch{
  +  catch(RecognitionException rex) {
  +
  +    last_error = getErrorHeader(rex) + " " + getErrorMessage(rex, OcciParser.tokenNames);
  +    //System.out.println("Parser error: " + last_error);
  +
  +    throw new OcciParserException(last_error);
     }
   }
   
  
positive.code: URL           : ( 'http://' | 'https://' )( 'a'..'z' | 'A'..'Z' | '0'..'9' | '@' | ':' | '%' | '_' | '\\' | '+' | '.' | '~' | '#' | '?' | '&' | '/' | '=' )*;
  DIGITS        : ('0'..'9')* ;
  QUOTE         : '"' | '\'' ;
  TERM_VALUE    : ('a'..'z' | 'A..Z' | '0'..'9' | '-' | '_')* ;
  TARGET_VALUE  : ('a'..'z' | 'A'..'Z' | '0'..'9' | '/' | '-')* ;
  QUOTED_VALUE  : QUOTE ( options {greedy=false;} : . )* QUOTE ;
  
  
negative.code: 	                       }
  	                       ;
  
  //this value can be passed on to the uri rule in Location for validation
  rel_attr               returns [String value] :
  	                       ';' 'rel' '='
  