Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 80b8bfb

Browse files
committed
fix wrong regexp string concatination for grammar
misused coffeescript multiline string. So, grammar is broken because newline character was inserted in regexp. close #42
1 parent 9b51b18 commit 80b8bfb

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

grammars/angularjs.cson

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@
2323
'name': 'meta.tag.block.any.html'
2424
}
2525
{
26-
'begin': '''
27-
(</?)((?i:
28-
address|article|aside|applet|
29-
blockquote|center|
30-
dir|div|dl|dt|dd|
31-
fieldset|footer|form|frame|frameset|
32-
header|hr|h1|h2|h3|h4|h5|h6|
33-
iframe|
34-
menu|nav|noframes|
35-
object|ol|
36-
p|pre|
37-
section|ul
38-
)\\b)
39-
'''
26+
'begin': '(</?)((?i:' +
27+
'address|article|aside|applet|' +
28+
'blockquote|center|' +
29+
'dir|div|dl|dt|dd|' +
30+
'fieldset|footer|form|frame|frameset|' +
31+
'header|hr|h1|h2|h3|h4|h5|h6|' +
32+
'iframe|' +
33+
'menu|nav|noframes|' +
34+
'object|ol|' +
35+
'p|pre|' +
36+
'section|ul' +
37+
')\\b)'
4038
'beginCaptures':
4139
'1':
4240
'name': 'punctuation.definition.tag.begin.html'
@@ -53,26 +51,24 @@
5351
]
5452
}
5553
{
56-
'begin': '''
57-
(</?)((?i:
58-
a|abbr|acronym|area|
59-
b|base|basefont|bdo|big|body|br|button|
60-
caption|cite|code|col|colgroup|
61-
del|dfn|
62-
em|font|
63-
head|html|
64-
i|img|input|ins|isindex|
65-
kbd|
66-
label|legend|li|link|
67-
map|meta|
68-
noscript|
69-
optgroup|option|
70-
param|q|
71-
s|samp|script|select|small|span|strike|strong|style|sub|sup|
72-
table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|
73-
u|var
74-
)\\b)
75-
'''
54+
'begin': '(</?)((?i:'+
55+
'a|a|abbr|acronym|area|' +
56+
'b|base|basefont|bdo|big|body|br|button|' +
57+
'caption|cite|code|col|colgroup|' +
58+
'del|dfn|' +
59+
'em|font|' +
60+
'head|html|' +
61+
'i|img|input|ins|isindex|' +
62+
'kbd|' +
63+
'label|legend|li|link|' +
64+
'map|meta|' +
65+
'noscript|' +
66+
'optgroup|option|' +
67+
'param|q|' +
68+
's|samp|script|select|small|span|strike|strong|style|sub|sup|' +
69+
'table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|' +
70+
'u|var' +
71+
')\\b)'
7672
'beginCaptures':
7773
'1':
7874
'name': 'punctuation.definition.tag.begin.html'
@@ -106,28 +102,26 @@
106102
{ 'include': 'source.js' }
107103
]
108104
'angular-directive-attribute':
109-
'begin': '''
110-
\\b((?i:ng-(
111-
animate-children|app|
112-
bind|bind-html|bind-template|blur|
113-
change|checked|class|class-even|class-odd|click|cloak|controller|copy|csp|cut|
114-
dblclick|disabled|
115-
focus|form|
116-
hide|href|
117-
if|include|init|
118-
keydown|keypress|keyup|
119-
list|
120-
messages|message|model|model-options|mousedown|mouseenter|mouseleave|mousemove|mouseover|mouseup|
121-
non-bindable|
122-
open|options|
123-
paste|pluralize|
124-
readonly|repeat|repeat-start|repeat-end|
125-
selected|show|src|srcset|style|strict-di|submit|switch|switch-when|switch-default|
126-
transclude|
127-
value|
128-
swipe-left|swipe-right|view|
129-
)))\\b\\s*(=?)
130-
'''
105+
'begin': '\\b((?i:ng-(' +
106+
'animate-children|app|' +
107+
'bind|bind-html|bind-template|blur|' +
108+
'change|checked|class|class-even|class-odd|click|cloak|controller|copy|csp|cut|' +
109+
'dblclick|disabled|' +
110+
'focus|form|' +
111+
'hide|href|' +
112+
'if|include|init|' +
113+
'keydown|keypress|keyup|' +
114+
'list|' +
115+
'messages|message|model|model-options|mousedown|mouseenter|mouseleave|mousemove|mouseover|mouseup|' +
116+
'non-bindable|' +
117+
'open|options|' +
118+
'paste|pluralize|' +
119+
'readonly|repeat|repeat-start|repeat-end|' +
120+
'selected|show|src|srcset|style|strict-di|submit|switch|switch-when|switch-default|' +
121+
'transclude|' +
122+
'value|' +
123+
'swipe-left|swipe-right|view|' +
124+
')))\\b\\s*(=?)'
131125
'beginCaptures':
132126
'1':
133127
'name': 'entity.other.attribute-name.html.angular'

spec/grammar-spec.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ describe 'directive grammar', ->
5959

6060
expect(lines[0][3]).toEqual value: 'ng-options', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
6161

62+
it 'tokenizes ng- attributes for anchor tags', ->
63+
lines = grammar.tokenizeLines '''
64+
<a href="/url" ng-click='{{setImage(img)}}'>
65+
'''
66+
expect(lines[0][9]).toEqual value: 'ng-click', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']
67+
6268
describe 'directive element', ->
6369
it 'tokenizes ng-include element inside HTML', ->
6470
lines = grammar.tokenizeLines '''

0 commit comments

Comments
 (0)