Skip to content
Open
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
44 changes: 0 additions & 44 deletions .github/workflows/nix-github-actions.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/publish.yml

This file was deleted.

5 changes: 5 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const PREC = {
pipe_forward: 0,
pipe_backward: 0,
impl: 1,
or: 2,
and: 3,
Expand All @@ -15,6 +17,7 @@ const PREC = {
"*": 9,
"/": 9,
concat: 10,
pipe: 10,
"?": 11,
negate: 12,
};
Expand Down Expand Up @@ -213,6 +216,7 @@ module.exports = grammar({
choice(
// left assoc.
...[
["|>", PREC.pipe_forward],
["==", PREC.eq],
["!=", PREC.neq],
["<", PREC["<"]],
Expand All @@ -237,6 +241,7 @@ module.exports = grammar({
),
// right assoc.
...[
["<|", PREC.pipe_backward],
["->", PREC.impl],
["//", PREC.update],
["++", PREC.concat],
Expand Down
Binary file added nix.so
Binary file not shown.
17 changes: 1 addition & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,5 @@
"dependencies": {
"nan": "^2.17.0"
},
"devDependencies": {},
"tree-sitter": [
{
"file-types": [
"nix"
],
"highlights": [
"queries/highlights.scm"
],
"injection-regex": "^(nix)$",
"locals": [
"queries/locals.scm"
],
"scope": "source.nix"
}
]
"devDependencies": {}
}
73 changes: 70 additions & 3 deletions src/grammar.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
"name": "nix",
"word": "keyword",
"rules": {
Expand Down Expand Up @@ -745,6 +746,39 @@
"binary_expression": {
"type": "CHOICE",
"members": [
{
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "_expr_op"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING",
"value": "|>"
}
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_expr_op"
}
}
]
}
},
{
"type": "PREC_LEFT",
"value": 4,
Expand Down Expand Up @@ -1141,6 +1175,39 @@
]
}
},
{
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "_expr_op"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING",
"value": "<|"
}
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_expr_op"
}
}
]
}
},
{
"type": "PREC_RIGHT",
"value": 1,
Expand Down Expand Up @@ -2005,6 +2072,6 @@
"inline": [],
"supertypes": [
"_expression"
]
}

],
"reserved": {}
}
20 changes: 19 additions & 1 deletion src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@
"type": "<=",
"named": false
},
{
"type": "<|",
"named": false
},
{
"type": "==",
"named": false
Expand All @@ -546,6 +550,10 @@
"type": ">=",
"named": false
},
{
"type": "|>",
"named": false
},
{
"type": "||",
"named": false
Expand Down Expand Up @@ -1540,6 +1548,7 @@
{
"type": "source_code",
"named": true,
"root": true,
"fields": {
"expression": {
"multiple": false,
Expand Down Expand Up @@ -1900,6 +1909,10 @@
"type": "<=",
"named": false
},
{
"type": "<|",
"named": false
},
{
"type": "=",
"named": false
Expand Down Expand Up @@ -1938,7 +1951,8 @@
},
{
"type": "comment",
"named": true
"named": true,
"extra": true
},
{
"type": "dollar_escape",
Expand Down Expand Up @@ -2020,6 +2034,10 @@
"type": "{",
"named": false
},
{
"type": "|>",
"named": false
},
{
"type": "||",
"named": false
Expand Down
Loading