Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for namespaced primops #48

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,15 @@ module.exports = grammar({
//grammar.lalrpop: 509
// Different from lalrpop grammar, we parse all possible builtins, not just
// the defined ones.
builtin: $ => seq(
builtin: _ => seq(
"%",
$.ident,
// We are a bit more liberal with what can go in a builtin function than
// for identifiers, because builtins are properly delimited by `%`.
// Upstream Nickel added `/` as a valid character already, so there's a
// precendent for extensions (although it's not very likely), so we try to
// be a bit future-proof. We just make sure the builtin starts with either
// a letter or an undescore, to ensure reasonable names.
/_*[a-zA-Z][a-zA-Z0-9./_'-]*/,
"%",
),

Expand Down
4 changes: 2 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1909,8 +1909,8 @@
"value": "%"
},
{
"type": "SYMBOL",
"name": "ident"
"type": "PATTERN",
"value": "_*[a-zA-Z][a-zA-Z0-9./_'-]*"
},
{
"type": "STRING",
Expand Down
12 changes: 1 addition & 11 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,7 @@
{
"type": "builtin",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "ident",
"named": true
}
]
}
"fields": {}
},
{
"type": "chunk_expr",
Expand Down
Loading
Loading