# _all: test all of the language features of ShEx

# This is intended to cover much of the ShEx language. If you are
# fiddling with a parser and want to run one test over and over, this
# test will likely catch any errors.

# omitted: unlabled semantic action, lexical constructs like bnode_with_leading_underscore
# todo: prohibit inclusion cycles, escaped strings in LONGn, escaped CODE

PREFIX prefix1: <http://all.example/>

%prefix1:act1{ START1 %}
%prefix1:act2{ START2 %}

<http://all.example/S1> EXTRA <http://all.example/p1> <http://all.example/p2> <http://all.example/p3> {
 $<http://all.example/S1e> (
   <http://all.example/p1> .;
   <http://all.example/p2> .;
   <http://all.example/p3> .)
}

prefix1:S2 EXTRA prefix1:p1 prefix1:p2 prefix1:p3 {
 $prefix1:S2e (
   prefix1:p1- .;
   prefix1:p2 .;
   prefix1:p3 .)
}

PREFIX a: <http://all.example/>
PREFIX prefix: <http://all.example/>
PREFIX base: <http://all.example/>
PREFIX PREFIX: <http://all.example/>
PREFIX BaSe: <http://all.example/>
PREFIX virtual: <http://all.example/>
PREFIX closed: <http://all.example/>
PREFIX extra: <http://all.example/>
PREFIX iri: <http://all.example/>
PREFIX bnode: <http://all.example/>
PREFIX literal: <http://all.example/>
PREFIX nonliteral: <http://all.example/>
PREFIX or: <http://all.example/>
prefix pattern: <http://all.example/>

PREfIX prefix1: <http://all.example/S>
stArt = @prefix1:3
PREFIX prefix1: <http://all.example/>
PREFIX S5: <http://all.example/S5>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://all.example/>

:IRI IRI
:vs1 [<http://a.example/a1> prefix:~ - prefix:a~ - prefix:b] AND :IRI

#VIRTUAL
prefix1:S3 EXTRA a:a prefix:prefix base:base # &a:S1
{
   &a:S1e;
   a:a .;
   prefix:prefix prefix:dt LENGTH 2?;
   (  base:base IRI*;
      PREFIX:PREFIX IRI /^http:\/\// LENGTH 5 +;
      BaSe:BaSe @prefix1:S5{2};
    | virtual:virtual NONLITERAL @ prefix1:S5{2,};
    | closed:closed  BNODE @S5: OR MINLENGTH 2 MAXLENGTH 4 @<http://all.example/S5> {2,*};
    | (  ^extra:extra { prefix1:p1 [
              "STRING_LITERAL2" "STRING_LITERAL2"@en-UK : prefix1:val1#comment
	      prefix1:#comment
	      <scheme:!$%25&amp;'()*+,-./0123456789:/@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~?#>
	      <http://a.example/p\u0031>
	      0.0 0e0 0E0 false 0 "ab"^^<http://all.example/bloodType> "o+"^^prefix1:bloodType
	      ' !"#$%&():;<=>?@[]^_`{|}~'
	      '	&([]' # Eliding \u0000 because it confuses UTF-8 detectors.
	      '߿ࠀ࿿က쿿퀀퟿�𐀀𿿽񀀀󿿽􀀀􏿽'
	      "\"\\"
	      "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡" # outside of BMP
	      """STRING_LITERAL_LONG2"""@en-UK
            ] }{2,3} %prefix1:act1{ code1 %};
         iri:iri LITERAL+ //
      <http://a.example/annot1> <http://a.example/IRIREF> //
      <http://a.example/annot2> "STRING_LITERAL2" //
      <http://a.example/annot3> 3 %prefix1:act1{ \%{printf("品川\\n")\u003b\%} %};
       | ^bnode:bnode .+ %prefix1:act1{ code1 %};
         ^literal:literal .+ %prefix1:act1{ code1 %}
      );
      nonliteral:nonliteral xsd:integer MININCLUSIVE 5 MAXINCLUSIVE 5 TOTALDIGITS 1 FRACTIONDIGITS 1
   );
   or:or @:vs1;
   pattern:pattern [. - prefix:a~ - prefix:b] %prefix1:act1{ code1 %} %prefix1:act2{ code2 %};
}

prefix1:S5 IRI

_:a·̀ͯ‿.⁀ CLOSED # &_:a·̀ͯ‿.⁀ &<http://all.example/S2>
{
  $_:a·̀ͯ‿.⁀e (
   &a:S1e;
   &<http://all.example/S2e> )
}

_:AZazÀÖØöø˿ͰͽͿ῿‌‍⁰↏Ⰰ⿯、퟿豈﷏ﷰ�𐀀󯿽 {
   &_:a·̀ͯ‿.⁀e
}
