Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct property names and improve scope-names #54

Merged
merged 5 commits into from
Sep 15, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 32 additions & 26 deletions grammars/blade.cson
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
'patterns': [
{
'begin': '{{--'
'captures':
'beginCaptures':
'0':
'name': 'punctuation.definition.comment.blade'
'name': 'punctuation.definition.comment.begin.blade'
'end': '--}}'
'endCaptures':
'0':
'name': 'punctuation.definition.comment.end.blade'
'name': 'comment.block.meta.embedded.blade'
}
{
'begin': '(?<!@){{{'
'captures':
'beginCaptures':
'0':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave these kind captures in, this is a hack required for text editors for properly detect inner scope when the contents of the block is 0 width, like {{|}} where | is cursor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a way to trigger PHP-specific snippets and commands, I assume?

Why not move the source.php scope to the containing block's name property, then...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've restored the capturing groups, but you should perhaps consider adding a comment to elaborate on why they're necessary. Future contributors may also misinterpret those groups as a mistake.

'name': 'support.punctuation.blade'
'1':
'name': 'source.php'
'name': 'punctuation.section.begin.embedded.blade'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move .begin and .end after .embedded like you did with comment.

'contentName': 'source.php'
'end': '(})}}'
'end': '}}}'
'endCaptures':
'0':
'name': 'punctuation.section.end.embedded.blade'
'name': 'meta.embedded.echo.blade'
'patterns': [
{
Expand All @@ -35,13 +39,14 @@
}
{
'begin': '(?<![@{]){{'
'captures':
'beginCaptures':
'0':
'name': 'support.punctuation.blade'
'1':
'name': 'source.php'
'name': 'punctuation.section.begin.embedded.blade'
'contentName': 'source.php'
'end': '(})}'
'end': '}}'
'endCaptures':
'0':
'name': 'punctuation.section.end.embedded.blade'
'name': 'meta.embedded.echo.blade'
'patterns': [
{
Expand All @@ -51,13 +56,14 @@
}
{
'begin': '(?<!@){!!'
'captures':
'beginCaptures':
'0':
'name': 'support.punctuation.blade'
'1':
'name': 'source.php'
'name': 'punctuation.section.begin.embedded.blade'
'contentName': 'source.php'
'end': '(!)!}'
'end': '!!}'
'endCaptures':
'0':
'name': 'punctuation.section.end.embedded.blade'
'name': 'meta.embedded.echo.blade'
'patterns': [
{
Expand All @@ -66,10 +72,10 @@
]
}
{
'begin': '(?<![A-z0-9_@])@(break|c(hoice|ontinue)|each|hasSection|(else)?(if|can(not)?)|in(ject|clude(If)?)|extends|for(e(ach|lse))?|lang|p(hp|ush)|section|stack|un(less|set)|while|yield)\\s*(?=\\()'
'begin': '(?<![A-Za-z0-9_@])@(break|c(hoice|ontinue)|each|hasSection|(else)?(if|can(not)?)|in(ject|clude(If)?)|extends|for(e(ach|lse))?|lang|p(hp|ush)|section|stack|un(less|set)|while|yield)\\s*(?=\\()'
'beginCaptures':
'0':
'name': 'keyword.blade'
'name': 'keyword.control.blade'
'contentName': 'source.php'
'end': '(?<=\\))(?!.*\\))'
'name': 'meta.embedded.blade'
Expand All @@ -80,14 +86,14 @@
]
}
{
'match': '(?<![A-z0-9_@])@(append|break|continue|empty|else|end(can(not)?|for(each|else)?|i(f|nject)|p(hp|ush)|section|unless|verbatim|while)|overwrite|s(how|top)|verbatim)\\b|(?<!@)@parent'
'name': 'meta.embedded.keyword.blade'
'match': "(?<![A-Za-z0-9_@])@(?:append|break|continue|empty|else|end(?:can|cannot|for|foreach|forelse|if|inject|php|push|section|unless|verbatim|while)|overwrite|show|stop|verbatim)\\b|(?<!@)@parent"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quotes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, done.

'name': 'keyword.control.blade'
}
{
'begin': '(?<![A-z0-9_@])@\\w+\\s*(?=\\()'
'begin': '(?<![A-Za-z0-9_@])@\\w+\\s*(?=\\()'
'beginCaptures':
'0':
'name': 'entity.blade'
'name': 'entity.name.blade'
'contentName': 'source.php'
'end': '(?<=\\))(?!.*\\))'
'name': 'meta.embedded.blade'
Expand All @@ -98,8 +104,8 @@
]
}
{
'begin': '(?<![A-z0-9_@])@php'
'end': '(?<![A-z0-9_@])@endphp'
'begin': '(?<![A-Za-z0-9_@])@php'
'end': '(?<![A-Za-z0-9_@])@endphp'
'beginCaptures':
'0':
'name': 'meta.embedded.keyword.blade'
Expand All @@ -115,7 +121,7 @@
]
}
{
'match': '(?<![A-z0-9_@])@(?!(choice|each|(else)?(if|can(not)?)|extends|for(e(ach|lse))?|hasSection|in(clude(If)?|ject)|lang|p(hp|ush)|section|stack|un(less|set)|while|yield)\\b)\\w+\\b'
'match': '(?<![A-Za-z0-9_@])@(?!(choice|each|(else)?(if|can(not)?)|extends|for(e(ach|lse))?|hasSection|in(clude(If)?|ject)|lang|p(hp|ush)|section|stack|un(less|set)|while|yield)\\b)\\w+\\b'
'name': 'meta.embedded.entity.blade'
}
{
Expand Down