skw->silent; kw->keyword

This commit is contained in:
Scott Richmond 2023-11-27 01:18:30 -05:00
parent 41fcdaa2e5
commit 62b1484829

View File

@ -6,12 +6,12 @@ line { (expression | toplevel) terminator+ }
toplevel { Import | Use | Ns }
Import { skw<"import"> String skw<"as"> Word }
Import { silent<"import"> String silent<"as"> Word }
Use { skw<"use"> Word }
Use { silent<"use"> Word }
Ns {
skw<"ns"> Word "{"
silent<"ns"> Word "{"
separator*
assoc_term (separator+ assoc_term)*
separator*
@ -22,7 +22,7 @@ expression { non_binding | binding }
binding { Let | Ref | Fn_Named | Fn_Compound }
Ref { skw<"ref"> Word "=" expression }
Ref { silent<"ref"> Word "=" expression }
non_binding { simple | complex }
@ -56,13 +56,13 @@ complex {
| Each
}
Repeat { skw<"repeat"> (Word | Number) Block }
Repeat { silent<"repeat"> (Word | Number) Block }
Each { skw<"each"> simple "do" (Fn_Clause | Fn_Clauses) }
Each { silent<"each"> simple "do" (Fn_Clause | Fn_Clauses) }
Recur { skw<"recur"> Args }
Recur { silent<"recur"> Args }
Loop { skw<"loop"> simple "with" (Fn_Clause | Fn_Clauses) }
Loop { silent<"loop"> simple "with" (Fn_Clause | Fn_Clauses) }
simple { atom | collection | Synthetic | Fn_Lambda | Recur }
@ -76,21 +76,21 @@ Fn_Clauses {
"}"
}
Fn_Compound { skw<"fn"> Word Fn_Clauses }
Fn_Compound { silent<"fn"> Word Fn_Clauses }
Fn_Named { skw<"fn"> Word Fn_Clause }
Fn_Named { silent<"fn"> Word Fn_Clause }
Fn_Lambda { skw<"fn"> Fn_Clause }
Fn_Lambda { silent<"fn"> Fn_Clause }
// TODO: figure out precedence with do/bind exprs
// do_expr { Fn_Lambda | Synthetic | Word | Keyword }
// Do {
// skw<"do"> simple (~ambig newline* ">" do_expr)+
// silent<"do"> simple (~ambig newline* ">" do_expr)+
// }
// Bind {
// skw<"bind">
// silent<"bind">
// simple
// (!pipeline pipeline)+
// }
@ -148,9 +148,9 @@ Struct_Pattern {
"}")
}
Let { skw<"let"> Pattern "=" non_binding }
Let { silent<"let"> Pattern "=" non_binding }
Else { skw<"else"> }
Else { silent<"else"> }
Match_Clause {(Pattern | Else) "->" newline* expression}
@ -166,9 +166,9 @@ match_body {
}
Match {
skw<"match">
silent<"match">
simple
skw<"with">
silent<"with">
match_body
}
@ -177,7 +177,7 @@ When_Clause {
}
When {
skw<"when"> "{"
silent<"when"> "{"
terminator*
When_Clause (terminator+ When_Clause)*
terminator*
@ -185,16 +185,16 @@ When {
}
If {
skw<"if"> simple newline*
skw<"then"> expression newline*
skw<"else"> expression
silent<"if"> simple newline*
silent<"then"> expression newline*
silent<"else"> expression
}
If_Let {
skw<"if"> skw<"let">
silent<"if"> silent<"let">
Pattern "=" simple newline*
skw<"then"> expression newline*
skw<"else"> expression
silent<"then"> expression newline*
silent<"else"> expression
}
Block {
@ -268,15 +268,15 @@ Struct {
atom { Boolean | Nil | String | Number | Keyword | Word }
kw<term> { @specialize[@name={term}]<Word, term> }
keyword<term> { @specialize[@name={term}]<Word, term> }
skw<term> { @specialize<Word, term> }
silent<term> { @specialize<Word, term> }
Keyword { ":" Word }
Boolean { kw<"true"> | kw<"false"> }
Boolean { keyword<"true"> | keyword<"false"> }
Nil { skw<"nil"> }
Nil { silent<"nil"> }
@tokens {
Word { $[a-z] $[a-zA-Z_\-?/!]* }