This repository was archived by the owner on Oct 25, 2023. It is now read-only.
File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,17 @@ namespace Lake.DSL
11
11
open Lean Parser Command
12
12
13
13
syntax scriptDeclSpec :=
14
- ident (ppSpace "(" ident+ ")" )? (declValSimple <|> declValDo)
14
+ ident (ppSpace "(" ident ( " : " term)? ")" )? (declValSimple <|> declValDo)
15
15
16
16
scoped syntax (name := scriptDecl)
17
17
(docComment)? "script " scriptDeclSpec : command
18
18
19
19
@[macro scriptDecl]
20
20
def expandScriptDecl : Macro
21
- | `($[$doc?]? script $id:ident $[($args?* )]? do $seq $[$wds?]?) => do
22
- let args := args?.getD (α := Array FunBinder) #[← `(Term.hole|_)]
23
- `($[$doc?]? @[« script»] def $id : ScriptFn := fun $args* => do $seq $[$wds?]?)
24
- | `($[$doc?]? script $id:ident $[($ args?*)]? := $defn $[$wds?]?) => do
25
- let args := args?.getD (α := Array FunBinder) #[ ← `(Term.hole|_)]
26
- `($[$doc?]? @[«script»] def $id : ScriptFn := fun $args* => $defn $[$wds?]?)
21
+ | `($[$doc?]? script $id:ident $[($args? $[: $ty??]? )]? do $seq $[$wds?]?) => do
22
+ `($[$doc?]? script $id:ident $[($ args? $[: $ty??]?)]? := do $seq $[$wds?]?)
23
+ | `($[$doc?]? script $id:ident $[($args? $[: $ty??]?)]? := $defn $[$wds?]?) => do
24
+ let args := args?.getD (α := Syntax.Term) (← `(_))
25
+ let ty := ty??.bind (·) |>.getD ( ← `(_))
26
+ `($[$doc?]? @[«script»] def $id : ScriptFn := fun ( $args : $ty) => $defn $[$wds?]?)
27
27
| stx => Macro.throwErrorAt stx "ill-formed script declaration"
You can’t perform that action at this time.
0 commit comments