anchor.diff:  	;
   
   valueExpr throws XPathException
  -:
  -	pathExpr (BANG^ pathExpr)*
  +{ Boolean inFunctionBodyState = lexer.inFunctionBody; }
  +:
  +	pathExpr (
  +	    BANG^
  +	    {
  +	        // simple map operator might add new document context
  +	        lexer.inFunctionBody = false;
  +        }
  +	    pathExpr
  +	    {
  +	        // reset state
  +	        lexer.inFunctionBody = inFunctionBodyState;
  +        }
  +    )*
   	|
   	extensionExpr
   	;
  
positive.code: 	protected boolean inStringConstructor = false;
  	protected boolean inElementContent= false;
  	protected boolean inAttributeContent= false;
  	protected char attrDelimChar = '"';
  	protected boolean inComment= false;
  	protected boolean inPragma = false;
  
negative.code: 	relativePathExpr
  	|
  	( SLASH relativePathExpr )
  	=> s1:SLASH relPath:relativePathExpr
  	{
  	  if (lexer.inFunctionBody) {
          throw new XPathException(#s1.getLine(), #s1.getColumn(), ErrorCodes.XPDY0002,
                 "Leading '/' selects nothing, ContextItem is absent in function body");
  	  }
  	  #pathExpr= #(#[ABSOLUTE_SLASH, "AbsoluteSlash"], #relPath);
  	}
  	// lone slash
  	|
  	s2:SLASH
  	{
  	  if (lexer.inFunctionBody) {
          throw new XPathException(#s2.getLine(), #s2.getColumn(), ErrorCodes.XPDY0002,
                 "Leading '/' selects nothing, ContextItem is absent in function body");
  	  }
  	  #pathExpr= #[ABSOLUTE_SLASH, "AbsoluteSlash"];
  	}
  	|
  	ds:DSLASH relPath2:relativePathExpr
  	{
  	  if (lexer.inFunctionBody) {
          throw new XPathException(#ds.getLine(), #ds.getColumn(), ErrorCodes.XPDY0002,
                 "Leading '//' selects nothing, ContextItem is absent in function body");
  	  }
  	  #pathExpr= #(#[ABSOLUTE_DSLASH, "AbsoluteSlashSlash"], #relPath2);
  	}
  	;
  
  relativePathExpr throws XPathException
  