anchor.diff:  				| productionLabel? encapsulatedShape
   				;
   encapsulatedShape  : '(' innerShape ')' cardinality? annotation* semanticActions ;
  -include			: '&' shapeLabel ;
  -shapeLabel      : iri
  -				| blankNode
  -				;
  -tripleConstraint : senseFlags? predicate shapeExpression cardinality? annotation* semanticActions;
  -senseFlags      : '!' '^'?
  -				| '^' '!'?		// inverse not
  -				;
  -// BNF: predicate ::= iri | RDF_TYPE
  -predicate       : iri
  -				| rdfType
  -				;
   shapeAtom       : KW_LITERAL xsFacet*			# shapeAtomLiteral
   				| nonLiteralKind stringFacet* shapeOrRef?	# shapeAtomNonLiteral
   				| datatype xsFacet*				# shapeAtomDataType
  
positive.code: numericLength   : KW_TOTALDIGITS
  				| KW_FRACTIONDIGITS
  				;
  datatype        : iri ;
  annotation      : '//' predicate (iri | literal) ;
  cardinality     :  '*'
  				| '+'
  				| '?'
  				| repeatRange
  				;
  // BNF: REPEAT_RANGE ::= '{' INTEGER (',' (INTEGER | '*')?)? '}'
  repeatRange     : '{' min_range (',' max_range?)? '}' ;
  
negative.code: // May 23, 2016 - Update to match http://www.w3.org/2005/01/yacker/uploads/ShEx2/bnf with last change "EGP20160520" AND ';' separator and '//' for annotations
  // May 24, 2016 - EGP20150424
  // Aug 11, 2016 - EGP20160708
  // Sep 14, 2016 - Revised to match Eric's latest reshuffle
  
  grammar ShExDoc;
  
  
  shExDoc 		: directive* ((notStartAction | startActions) statement*)? EOF;  // leading CODE
  directive       : baseDecl
  				| prefixDecl
  				;
  baseDecl 		: KW_BASE  IRIREF ;
  prefixDecl		: KW_PREFIX PNAME_NS IRIREF ;
  notStartAction  : start
  			    | shape
  			    ;
  start           : KW_START '=' shapeExpression semanticActions ;
  startActions	: codeDecl+ ;
  statement		: directive
  				| notStartAction
  				;
  shape           : shapeLabel (stringFacet* shapeExpression | KW_EXTERNAL) semanticActions ;
  shapeExpression : shapeOr ;
  shapeOr  		: shapeAnd (KW_OR shapeAnd)* ;
  shapeAnd		: shapeNot (KW_AND shapeNot)* ;
  shapeNot	    : (KW_NOT | '!')? shapeAtom ;
  shapeDefinition : (includeSet | extraPropertySet | KW_CLOSED)* '{' someOfShape? '}' ;
  extraPropertySet : KW_EXTRA predicate+ ;
  someOfShape     : groupShape
  				| multiElementSomeOf
  				;
  