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

Commit

Permalink
fix: restore script arg syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha authored and tydeu committed Jul 9, 2022
1 parent a4764ed commit c326f43
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Lake/DSL/Script.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ namespace Lake.DSL
open Lean Parser Command

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

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

@[macro scriptDecl]
def expandScriptDecl : Macro
| `($[$doc?]? script $id:ident $[($args?*)]? do $seq $[$wds?]?) => do
let args := args?.getD (α := Array FunBinder) #[← `(Term.hole|_)]
`($[$doc?]? @[«script»] def $id : ScriptFn := fun $args* => do $seq $[$wds?]?)
| `($[$doc?]? script $id:ident $[($args?*)]? := $defn $[$wds?]?) => do
let args := args?.getD (α := Array FunBinder) #[← `(Term.hole|_)]
`($[$doc?]? @[«script»] def $id : ScriptFn := fun $args* => $defn $[$wds?]?)
| `($[$doc?]? script $id:ident $[($args? $[: $ty??]?)]? do $seq $[$wds?]?) => do
`($[$doc?]? script $id:ident $[($args? $[: $ty??]?)]? := do $seq $[$wds?]?)
| `($[$doc?]? script $id:ident $[($args? $[: $ty??]?)]? := $defn $[$wds?]?) => do
let args := args?.getD (α := Syntax.Term) (← `(_))
let ty := ty??.bind (·) |>.getD (← `(_))
`($[$doc?]? @[«script»] def $id : ScriptFn := fun ($args : $ty) => $defn $[$wds?]?)
| stx => Macro.throwErrorAt stx "ill-formed script declaration"

0 comments on commit c326f43

Please sign in to comment.