| 1 |
From elpi Require Import elpi. |
| 2 |
|
| 3 |
|
| 4 |
Elpi Command test.program1. |
| 5 |
Elpi Accumulate lp:{{ |
| 6 |
pred foo i:list argument. |
| 7 |
main X :- coq.say "test1", foo X. |
| 8 |
}}. |
| 9 |
|
| 10 |
Elpi Command test.program2. |
| 11 |
Elpi Accumulate lp:{{ |
| 12 |
main _ :- coq.say "test2". |
| 13 |
}}. |
| 14 |
|
| 15 |
Elpi Accumulate test.program1 lp:{{ |
| 16 |
foo [S] :- coq.say S. |
| 17 |
foo [X,Y] :- coq.say X, coq.say Y. |
| 18 |
foo _ :- coq.say "too many arguments". |
| 19 |
}}. |
| 20 |
|
| 21 |
Elpi test.program2. |
| 22 |
Elpi test.program1 "hello". |
| 23 |
Elpi test.program1 "hello" -my. |
| 24 |
Elpi test.program1 "hello my" Dear. |
| 25 |
Elpi test.program1 "hello" too many args. |
| 26 |
|
| 27 |
Elpi Command test.program3. |
| 28 |
Fail Elpi Accumulate lp:{{ |
| 29 |
main. |
| 30 |
}}. |
| 31 |
(* Fail *) |
| 32 |
|
| 33 |
Elpi Command test.att. |
| 34 |
Elpi Accumulate lp:{{ |
| 35 |
|
| 36 |
main _ :- |
| 37 |
attributes A, |
| 38 |
coq.say A, |
| 39 |
A = [attribute "elpi.loc" _, attribute "elpi.phase" _, attribute "foo" (leaf-str "bar")| _], |
| 40 |
coq.parse-attributes A [att "foo" string, |
| 41 |
att "poly" bool, |
| 42 |
att-ignore-unknown] CL, |
| 43 |
coq.say CL. |
| 44 |
|
| 45 |
}}. |
| 46 |
|
| 47 |
#[foo="bar"] |
| 48 |
Elpi test.att. |
| 49 |
|
| 50 |
Elpi Export test.att. |
| 51 |
|
| 52 |
#[foo="bar",poly] test.att. |
| 53 |
#[foo="bar",poly,suppa(duppa)] test.att. |
| 54 |
|
| 55 |
Elpi Command test.axx. |
| 56 |
Elpi Accumulate lp:{{ |
| 57 |
main _ :- |
| 58 |
attributes A, coq.parse-attributes A [att "foo" attmap] CL, |
| 59 |
CL = [get-option "elpi.loc" _, get-option "elpi.phase" _, get-option "foo" [get-option "A" "3", get-option "b_2" "yes"]]. |
| 60 |
}}. |
| 61 |
|
| 62 |
Elpi Export test.axx. |
| 63 |
|
| 64 |
#[foo(A="3", b_2="yes")] test.axx. |
| 65 |
|
| 66 |
Elpi Query test.att lp:{{ X = 3 }}. |
| 67 |
|
| 68 |
Elpi Command test.scope. |
| 69 |
Elpi Accumulate lp:{{ |
| 70 |
main [trm X, str"%", str Id] :- coq.say X Id. |
| 71 |
main L :- coq.error L. |
| 72 |
}}. |
| 73 |
Elpi test.scope (_ * _)%type. |
| 74 |
Fail Elpi test.scope ((_ * _)%type). |