Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit c326f43

Browse files
Khatydeu
authored andcommitted
fix: restore script arg syntax
1 parent a4764ed commit c326f43

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: Lake/DSL/Script.lean

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace Lake.DSL
1111
open Lean Parser Command
1212

1313
syntax scriptDeclSpec :=
14-
ident (ppSpace "(" ident+ ")")? (declValSimple <|> declValDo)
14+
ident (ppSpace "(" ident (" : " term)? ")")? (declValSimple <|> declValDo)
1515

1616
scoped syntax (name := scriptDecl)
1717
(docComment)? "script " scriptDeclSpec : command
1818

1919
@[macro scriptDecl]
2020
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?]?)
2727
| stx => Macro.throwErrorAt stx "ill-formed script declaration"

0 commit comments

Comments
 (0)