Skip to content

Commit

Permalink
fixed the $.text node and $.php_node closes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
EmranMR committed Dec 3, 2023
1 parent a54fb1e commit 8353cbb
Show file tree
Hide file tree
Showing 6 changed files with 127,543 additions and 120,844 deletions.
12 changes: 0 additions & 12 deletions corpus/conditionals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ conditional keywords
(parameter)
(bracket_end)
(text)
(text)
(text)
(text)
(text)
(conditional_keyword
(directive)
(bracket_start)
Expand Down Expand Up @@ -352,10 +348,6 @@ conditional keywords
(parameter)
(bracket_end)
(text)
(text)
(text)
(text)
(text)
(conditional_keyword
(directive)
(bracket_start)
Expand Down Expand Up @@ -384,10 +376,6 @@ conditional keywords
(parameter)
(bracket_end)
(text)
(text)
(text)
(text)
(text)
(conditional_keyword
(directive)
(bracket_start)
Expand Down
12 changes: 0 additions & 12 deletions corpus/conflicts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ Orphan Punctuation Marks
--------------------------------------------------------------------------------

(blade
(text)
(text)
(text)
(text)
(text)
(text)
(text)
(text)
(text)
(text))

================================================================================
Expand All @@ -33,9 +24,6 @@ test@test.com
--------------------------------------------------------------------------------

(blade
(text)
(text)
(text)
(text)
(conditional
(directive_start)
Expand Down
16 changes: 4 additions & 12 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ module.exports = grammar({
$._inline_directive,
$._nested_directive,
$.loop_operator,
alias($._text, $.text)
$.text
),

comment: ($) =>
seq(
'{{--',
optional(repeat(alias($._text, $.text))),
'--}}'
),
comment: ($) => seq('{{--', optional($.text), '--}}'),

// !keywords
keyword: ($) =>
Expand Down Expand Up @@ -538,14 +533,11 @@ module.exports = grammar({
),
// !section parameters
_section_parameter: ($) =>
seq(
optional(/[\"\']/),
alias($._text, $.text),
optional(/[\"\']/)
),
seq(optional(/[\"\']/), $.text, optional(/[\"\']/)),

// !text definitions
php_only: ($) => prec.right(repeat1($._text)),
text: ($) => prec.right(repeat1($._text)),
// hidden to reduce AST noise in php_only #39
// It is selectively unhidden for other areas
_text: ($) =>
Expand Down
41 changes: 17 additions & 24 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@
"name": "loop_operator"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_text"
},
"named": true,
"value": "text"
"type": "SYMBOL",
"name": "text"
}
]
},
Expand All @@ -57,16 +52,8 @@
"type": "CHOICE",
"members": [
{
"type": "REPEAT",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_text"
},
"named": true,
"value": "text"
}
"type": "SYMBOL",
"name": "text"
},
{
"type": "BLANK"
Expand Down Expand Up @@ -2305,13 +2292,8 @@
]
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_text"
},
"named": true,
"value": "text"
"type": "SYMBOL",
"name": "text"
},
{
"type": "CHOICE",
Expand All @@ -2338,6 +2320,17 @@
}
}
},
"text": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_text"
}
}
},
"_text": {
"type": "CHOICE",
"members": [
Expand Down
2 changes: 1 addition & 1 deletion src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"named": true,
"fields": {},
"children": {
"multiple": true,
"multiple": false,
"required": false,
"types": [
{
Expand Down
Loading

0 comments on commit 8353cbb

Please sign in to comment.