Change aggregate binding syntax
This commit is contained in:
@@ -8,13 +8,13 @@ define output decision Queen(Coord, Coord)
|
||||
Queen(row, col) :- Coord row, Coord col.
|
||||
|
||||
; Exactly one queen goes on each row.
|
||||
:- For(row), @count Queen(row, _) = 1.
|
||||
:- @count col : Queen(row, _) = 1.
|
||||
|
||||
; Exactly one queen goes on each column.
|
||||
:- For(col), @count Queen(_, col) = 1.
|
||||
:- @count col : Queen(_, col) = 1.
|
||||
|
||||
; At most one queen can go along each main diagonal.
|
||||
:- For(diag), @count { Queen (row, col), diag = row + col } <= 1.
|
||||
:- @count diag : { Queen (row, col), diag = row + col } <= 1.
|
||||
|
||||
; At most one queen can go along each orthogonal diagonal.
|
||||
:- For(diag), @count { Queen (row, col), diag = row - col } <= 1.
|
||||
:- @count diag : { Queen (row, col), diag = row - col } <= 1.
|
||||
|
||||
@@ -131,6 +131,7 @@ export default grammar({
|
||||
|
||||
aggregate: $ => seq(
|
||||
field("op", $.aggregate_op),
|
||||
optional(seq(list(field("witness", $.variable)), ":")),
|
||||
choice(
|
||||
field("atom", $.atom),
|
||||
seq("{", field("body", $.rule_body ), "}"),
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
(definition relation: (symbol) @function)
|
||||
(atom head: (symbol) @function)
|
||||
|
||||
[ ":-" "," "." ] @punctuation.delimiter
|
||||
[ ":-" "," "." ":" ] @punctuation.delimiter
|
||||
[ "(" ")" "{" "}" ] @punctuation.bracket
|
||||
|
||||
(aggregate_op) @keyword
|
||||
|
||||
50
tree-sitter-kerolox/src/grammar.json
generated
50
tree-sitter-kerolox/src/grammar.json
generated
@@ -742,6 +742,56 @@
|
||||
"name": "aggregate_op"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "witness",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "variable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ","
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "witness",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "variable"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ":"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
|
||||
14
tree-sitter-kerolox/src/node-types.json
generated
14
tree-sitter-kerolox/src/node-types.json
generated
@@ -32,6 +32,16 @@
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"witness": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "variable",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -669,6 +679,10 @@
|
||||
"type": "0",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ":",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ":-",
|
||||
"named": false
|
||||
|
||||
5249
tree-sitter-kerolox/src/parser.c
generated
5249
tree-sitter-kerolox/src/parser.c
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user