Skip to content

Commit

Permalink
Merge pull request #22 from NullVoxPopuli/fix-parser-issues
Browse files Browse the repository at this point in the history
fix(grammar): this.property is now [class][punc][property]
  • Loading branch information
NullVoxPopuli authored Apr 13, 2021
2 parents d52551f + 9492542 commit 645a58a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/glimmer.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function glimmer(hljs) {
className: {
1: "class",
2: "punctuation",
3: "variable"
3: "property"
},
match: [/this/, /\./, /[^\s}]+/]
};
Expand Down
2 changes: 1 addition & 1 deletion dist/glimmer.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/glimmer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<style type="text/css">
.hljs-punctuation { color: #a9c; }
.hljs-attribute { color: #d38fae; }
.hljs-property { color: #feb39f; }
.hljs-class { color: #88f; }
.hljs-operator { color: #959; }
.hljs-comment { color: #888; }
Expand Down
2 changes: 1 addition & 1 deletion src/glimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function glimmer(hljs) {
className: {
1: 'class',
2: 'punctuation',
3: 'variable',
3: 'property',
},
match: [/this/, /\./, /[^\s}]+/],
};
Expand Down
14 changes: 14 additions & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ describe('Component Invocation', () => {
);
});
});

describe('Expressions', () => {
describe('Mustache', () => {
test('this.property', () => {
let result = parse('{{this.property}}');

expect(result).toEqual(
stripIndent`
<span class="hljs-punctuation mustache">{{<span class="hljs-class">this</span><span class="hljs-punctuation">.</span><span class="hljs-property">property</span>}}</span>
`
);
});
});
});

0 comments on commit 645a58a

Please sign in to comment.