Skip to content

Commit

Permalink
fixes #23, new tests for conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
EmranMR committed Aug 13, 2023
1 parent 319c255 commit f20858b
Show file tree
Hide file tree
Showing 6 changed files with 66,937 additions and 63,645 deletions.
40 changes: 40 additions & 0 deletions corpus/conflicts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
==================
Orphan Punctuation Marks
==================

@ { } {} () !

---

(blade
(php)
(php)
(php)
(php)
(php)
(php))

==================
text starting with @
==================

[email protected]

@test

@custom('test')
hello
@endcustom

---

(blade
(php)
(php)
(php)
(php)
(conditional
(directive_start)
(parameter)
(php)
(directive_end)))
5 changes: 3 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,12 @@ module.exports = grammar({
// !text
text: ($) =>
choice(
token(prec(-2, /[{}!@()?-]/)),
token(prec(-1, /[{}!@()?-][a-zA-Z\d]*[^\(]/)), // custom directive conflict resolution
token(prec(-2, /[{}!@()?-]/)), // orphan tags
token(
prec(
-1,
/[^\s(){!}@-]([^(){!}@?]*[^\s{!}()@?-])?/
/[^\s(){!}@-]([^(){!}@?]*[^\s{!}()@?-])?/ //general text
)
)
),
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tree-sitter-blade",
"version": "0.3.0",
"version": "0.3.1",
"description": "tree-sitter-blade for Laravel Blade files",
"main": "bindings/node",
"keywords": [
Expand All @@ -27,7 +27,7 @@
"nan": "^2.17.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.7"
"tree-sitter-cli": "^0.20.8"
},
"tree-sitter": [
{
Expand Down
11 changes: 11 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,17 @@
"text": {
"type": "CHOICE",
"members": [
{
"type": "TOKEN",
"content": {
"type": "PREC",
"value": -1,
"content": {
"type": "PATTERN",
"value": "[{}!@()?-][a-zA-Z\\d]*[^\\(]"
}
}
},
{
"type": "TOKEN",
"content": {
Expand Down
Loading

0 comments on commit f20858b

Please sign in to comment.