Skip to content

Commit

Permalink
update form statement to accept variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hankthetank27 committed Mar 20, 2024
1 parent a155332 commit a1e0d5a
Show file tree
Hide file tree
Showing 5 changed files with 9,028 additions and 8,837 deletions.
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ module.exports = grammar({
// (inside vs. outside a liquid tag), we abstract their rules to constructors
// which allow for a flexible internal representations of sub-rules and tagging.

//tagged
// tagged
if_statement: ($) => paired($).tagged._if,

elsif_clause: ($) => paired($).tagged._elsif,
Expand Down Expand Up @@ -639,7 +639,7 @@ function statements($, rules) {
_form: seq(
rules.wrapper(
"form",
field("type", $.string),
field("type", choice($.string, $.identifier, $.access)),
optional(
field(
"parameters",
Expand Down
25 changes: 17 additions & 8 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
] @punctuation.delimiter
(#set! priority 101))

([
"|"
":"
"="
(predicate)
] @operator
(#set! priority 101))

([
"as"
Expand Down Expand Up @@ -61,7 +54,6 @@
"for"
"form"
"if"
"in"
"include"
"increment"
"javascript"
Expand All @@ -81,6 +73,22 @@
] @keyword
(#set! priority 101))

([
"and"
"contains"
"in"
"or"
] @keyword.operator
(#set! priority 101))

([
"|"
":"
"="
(predicate)
] @operator
(#set! priority 101))

((identifier) @variable (#set! priority 101))
((string) @string (#set! priority 101))
((boolean) @boolean (#set! priority 101))
Expand All @@ -94,3 +102,4 @@

((comment) @comment (#set! priority 102))


34 changes: 30 additions & 4 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2457,8 +2457,21 @@
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "string"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "access"
}
]
}
},
{
Expand Down Expand Up @@ -3267,8 +3280,21 @@
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "string"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "access"
}
]
}
},
{
Expand Down
8 changes: 8 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,14 @@
"multiple": false,
"required": true,
"types": [
{
"type": "access",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "string",
"named": true
Expand Down
Loading

0 comments on commit a1e0d5a

Please sign in to comment.