-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move syntax grammars to TS definitions (#592)
* refactor: move syntax grammars to TS definitions This commit refactors remaining existing grammars to use TS definitions as started in #581. * fixup! refactor: move syntax grammars to TS definitions
- Loading branch information
Showing
7 changed files
with
100 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {GrammarDefinition} from './types'; | ||
|
||
export const InlineStyles: GrammarDefinition = { | ||
scopeName: 'inline-styles.ng', | ||
injectionSelector: 'L:source.ts#meta.decorator.ts -comment', | ||
patterns: [{include: '#inlineStyles'}], | ||
repository: { | ||
inlineStyles: { | ||
begin: /(styles)\s*(:)/, | ||
beginCaptures: { | ||
1: {name: 'meta.object-literal.key.ts'}, | ||
2: {name: 'meta.object-literal.key.ts punctuation.separator.key-value.ts'} | ||
}, | ||
end: /(?=,|})/, | ||
patterns: [{include: '#tsParenExpression'}, {include: '#tsBracketExpression'}] | ||
}, | ||
|
||
tsParenExpression: { | ||
begin: /\G\s*(\()/, | ||
beginCaptures: {1: {name: 'meta.brace.round.ts'}}, | ||
end: /\)/, | ||
endCaptures: {0: {name: 'meta.brace.round.ts'}}, | ||
patterns: [{include: '$self'}, {include: '#tsBracketExpression'}] | ||
}, | ||
|
||
'tsBracketExpression': { | ||
begin: /\G\s*(\[)/, | ||
beginCaptures: {1: {name: 'meta.array.literal.ts meta.brace.square.ts'}}, | ||
end: /\]/, | ||
endCaptures: {0: {name: 'meta.array.literal.ts meta.brace.square.ts'}}, | ||
patterns: [{include: '#style'}] | ||
}, | ||
|
||
style: { | ||
begin: /\s*([`|'|"])/, | ||
beginCaptures: {1: {name: 'string'}}, | ||
end: /\1/, | ||
endCaptures: {0: {name: 'string'}}, | ||
contentName: 'source.css', | ||
patterns: [{include: 'source.css'}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {GrammarDefinition} from './types'; | ||
|
||
export const InlineTemplate: GrammarDefinition = { | ||
scopeName: 'inline-template.ng', | ||
injectionSelector: 'L:meta.decorator.ts -comment', | ||
patterns: [{include: '#inlineTemplate'}], | ||
repository: { | ||
inlineTemplate: { | ||
begin: /(template)\s*(:)/, | ||
beginCaptures: { | ||
1: {name: 'meta.object-literal.key.ts'}, | ||
2: {name: 'meta.object-literal.key.ts punctuation.separator.key-value.ts'} | ||
}, | ||
end: /(?=,|})/, | ||
patterns: [{include: '#tsParenExpression'}, {include: '#ngTemplate'}] | ||
}, | ||
|
||
tsParenExpression: { | ||
begin: /\G\s*(\()/, | ||
beginCaptures: {1: {name: 'meta.brace.round.ts'}}, | ||
end: /\)/, | ||
endCaptures: {0: {name: 'meta.brace.round.ts'}}, | ||
patterns: [{include: '#tsParenExpression'}, {include: '#ngTemplate'}] | ||
}, | ||
|
||
ngTemplate: { | ||
begin: /\G\s*([`|'|"])/, | ||
beginCaptures: {1: {name: 'string'}}, | ||
end: /\1/, | ||
endCaptures: {0: {name: 'string'}}, | ||
contentName: 'text.html', | ||
patterns: [{include: 'text.html.derivative'}, {include: 'template.ng'}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters