Skip to content

Commit

Permalink
feat: 馃幐 add support for laravel-permission directives
Browse files Browse the repository at this point in the history
  • Loading branch information
shufo committed Oct 9, 2021
1 parent e12ad83 commit 672c3f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export const indentStartTokens = [
'@canany',
'@cannot',
'@can',
'@role',
'@hasrole',
'@hasanyrole',
'@hasallroles',
'@unlessrole',
'@hasexactroles',
'@component',
'@empty',
'@env',
Expand Down Expand Up @@ -38,6 +44,12 @@ export const indentEndTokens = [
'@endcanany',
'@endcannot',
'@endcan',
'@endrole',
'@endhasrole',
'@endhasanyrole',
'@endhasallroles',
'@endunlessrole',
'@endhasexactroles',
'@endcomponent',
'@endempty',
'@endenv',
Expand Down
6 changes: 3 additions & 3 deletions syntaxes/blade.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
]
},
{
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n auth\n |break\n |canany\n |can\n |cannot\n |case\n |choice\n |component\n |continue\n |each\n |elsecanany\n |elsecan\n |elsecannot\n |elseif\n |empty\n |extends\n |for\n |foreach\n |forelse\n |guest\n |hassection\n |if\n |include\n |includefirst\n |includeif\n |includewhen\n |inject\n |isset\n |json\n |lang\n |prepend\n |push\n |section\n |slot\n |stack\n |switch\n |unless\n |unset\n |while\n |yield\n |servers\n |task\n |story\n |slack\n |method\n |dump\n |php\n |production\n |sectionmissing \n|prepend \n|once \n|error \n)\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n auth\n |break\n |canany\n |can\n |cannot\n |case\n |choice\n |component\n |continue\n |each\n |elsecanany\n |elsecan\n |elsecannot\n |elseif\n |empty\n |extends\n |for\n |foreach\n |forelse\n |guest\n |hassection\n |if\n |include\n |includefirst\n |includeif\n |includewhen\n |inject\n |isset\n |json\n |lang\n |prepend\n |push\n |section\n |slot\n |stack\n |switch\n |unless\n |unset\n |while\n |yield\n |servers\n |task\n |story\n |slack\n |method\n |dump\n |php\n |production\n |sectionmissing \n|prepend \n|once \n|error \n|role \n|hasrole \n|hasanyrole \n|hasallroles \n|unlessrole \n|hasexactroles \n)\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"beginCaptures": {
"1": {
"name": "keyword.blade"
Expand All @@ -265,7 +265,7 @@
]
},
{
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n append\n |default\n |else\n |permissions\n |permission\n |endauth\n |endcanany\n |endcan\n |endcannot\n |endcomponent\n |endempty\n |endfor\n |endforeach\n |endforelse\n |endguest\n |endif\n |endisset\n |endlang\n |endprepend\n |endpush\n |endsection\n |endslot\n |endswitch\n |endunless\n |endwhile\n |overwrite\n |parent\n |show\n |stop\n |endtask\n |endstory\n |finished\n |endfinished\n |csrf\n |endproduction\n |endprepend \n|endonce \n|enderror \n)\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n append\n |default\n |else\n |permissions\n |permission\n |endauth\n |endcanany\n |endcan\n |endcannot\n |endcomponent\n |endempty\n |endfor\n |endforeach\n |endforelse\n |endguest\n |endif\n |endisset\n |endlang\n |endprepend\n |endpush\n |endsection\n |endslot\n |endswitch\n |endunless\n |endwhile\n |overwrite\n |parent\n |show\n |stop\n |endtask\n |endstory\n |finished\n |endfinished\n |csrf\n |endproduction\n |endprepend \n|endonce \n|enderror \n|endrole \n|endhasrole \n|endhasanyrole \n|endhasallroles \n|endunlessrole \n|endhasexactroles \n)\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"beginCaptures": {
"1": {
"name": "keyword.blade"
Expand All @@ -289,7 +289,7 @@
]
},
{
"match": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n@\n(?: # Ordering not important as we everything will be matched up to word boundary\n (?i)append\n|(?i)auth\n|(?i)break\n|(?i)continue\n|(?i)default\n|(?i)else\n|(?i)permissions\n|(?i)permission\n|(?i)empty\n|(?i)endauth\n|(?i)endcanany\n|(?i)endcan\n|(?i)endcannot\n|(?i)endcomponent\n|(?i)endempty\n|(?i)endfor\n|(?i)endforeach\n|(?i)endforelse\n|(?i)endguest\n|(?i)endif\n|(?i)endisset\n|(?i)endlang\n|(?i)endprepend\n|(?i)endpush\n|(?i)endsection\n|(?i)endslot\n|(?i)endswitch\n|(?i)endunless\n|endverbatim\n|(?i)endwhile\n|(?i)guest\n|(?i)lang\n|(?i)overwrite\n|(?i)parent\n|(?i)show\n|(?i)stop\n|(?i)endtask\n|(?i)endstory\n|(?i)finished\n|(?i)endfinished\n|verbatim\n|csrf\n|(?i)production\n|(?i)endproduction\n|(?i)sectionmissing\n|(?i)prepend\n|(?i)endprepend\n|(?i)once\n|(?i)endonce\n|(?i)error\n|(?i)enderror\n)\n\\b",
"match": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n@\n(?: # Ordering not important as we everything will be matched up to word boundary\n (?i)append\n|(?i)auth\n|(?i)break\n|(?i)continue\n|(?i)default\n|(?i)else\n|(?i)permissions\n|(?i)permission\n|(?i)empty\n|(?i)endauth\n|(?i)endcanany\n|(?i)endcan\n|(?i)endcannot\n|(?i)endcomponent\n|(?i)endempty\n|(?i)endfor\n|(?i)endforeach\n|(?i)endforelse\n|(?i)endguest\n|(?i)endif\n|(?i)endisset\n|(?i)endlang\n|(?i)endprepend\n|(?i)endpush\n|(?i)endsection\n|(?i)endslot\n|(?i)endswitch\n|(?i)endunless\n|endverbatim\n|(?i)endwhile\n|(?i)guest\n|(?i)lang\n|(?i)overwrite\n|(?i)parent\n|(?i)show\n|(?i)stop\n|(?i)endtask\n|(?i)endstory\n|(?i)finished\n|(?i)endfinished\n|verbatim\n|csrf\n|(?i)production\n|(?i)endproduction\n|(?i)sectionmissing\n|(?i)prepend\n|(?i)endprepend\n|(?i)once\n|(?i)endonce\n|(?i)error\n|(?i)enderror\n|(?i)endrole\n|(?i)endhasrole\n|(?i)endhasanyrole\n|(?i)endhasallroles\n|(?i)endunlessrole\n|(?i)endhasexactroles\n)\n\\b",
"name": "keyword.blade"
},
{
Expand Down

0 comments on commit 672c3f1

Please sign in to comment.