Skip to content

Commit

Permalink
wip #10 & #35. ❌ inline @section
Browse files Browse the repository at this point in the history
  • Loading branch information
EmranMR committed Sep 3, 2023
1 parent faf11e0 commit 902310a
Show file tree
Hide file tree
Showing 6 changed files with 7,388 additions and 7,284 deletions.
11 changes: 11 additions & 0 deletions corpus/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@

---

(blade
(keyword
(directive)))
==================
@parent
==================

@parent

---

(blade
(keyword
(directive)))
20 changes: 17 additions & 3 deletions corpus/nested-directives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
@section
================================================================================

@section('test')
section
@endsection
@section('sidebar')
This is the master sidebar.
@show

@section('test')
@parent
test
@endsection


--------------------------------------------------------------------------------
Expand All @@ -36,6 +41,15 @@
(parameter)
(bracket_end)
(php)
(directive_end))
(section
(directive_start)
(bracket_start)
(parameter)
(bracket_end)
(keyword
(directive))
(php)
(directive_end)))

================================================================================
Expand Down
5 changes: 5 additions & 0 deletions example-file.blade
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@section('test' , 'test')

@section('test')
text
@endsection
6 changes: 3 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = grammar({
// !keywords
keyword: ($) =>
alias(
/@(csrf|viteReactRefresh|livewireStyles|livewireScripts|livewireScriptConfig)/,
/@(csrf|viteReactRefresh|livewireStyles|livewireScripts|livewireScriptConfig|parent)/,
$.directive
),
// ! PHP Statements
Expand Down Expand Up @@ -64,7 +64,7 @@ module.exports = grammar({
_inline_directive: ($) =>
seq(
alias(
/@(extends|yield|include|includeIf|includeWhen|includeUnless|includeFirst|props|method|inject|each|vite|livewire|aware)/,
/@(extends|yield|include|includeIf|includeWhen|includeUnless|includeFirst|props|method|inject|each|vite|livewire|aware|section)/,
$.directive
),
$._directive_parameter
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = grammar({
seq(
alias('@section', $.directive_start),
$._directive_body_with_parameter,
alias('@endsection', $.directive_end)
alias(/@(endsection|show)/, $.directive_end)
),

// once
Expand Down
8 changes: 4 additions & 4 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "@(csrf|viteReactRefresh|livewireStyles|livewireScripts|livewireScriptConfig)"
"value": "@(csrf|viteReactRefresh|livewireStyles|livewireScripts|livewireScriptConfig|parent)"
},
"named": true,
"value": "directive"
Expand Down Expand Up @@ -285,7 +285,7 @@
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "@(extends|yield|include|includeIf|includeWhen|includeUnless|includeFirst|props|method|inject|each|vite|livewire|aware)"
"value": "@(extends|yield|include|includeIf|includeWhen|includeUnless|includeFirst|props|method|inject|each|vite|livewire|aware|section)"
},
"named": true,
"value": "directive"
Expand Down Expand Up @@ -383,8 +383,8 @@
{
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "@endsection"
"type": "PATTERN",
"value": "@(endsection|show)"
},
"named": true,
"value": "directive_end"
Expand Down
Loading

0 comments on commit 902310a

Please sign in to comment.