This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
Fix improper tokenization of script
tags
#90
Closed
Closed
Conversation
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
expect(tokens[0][6]).toEqual value: 'id', scopes: ['text.html.basic', 'meta.attribute-with-value.id.html', 'string.quoted.double.html', 'meta.toc-list.id.html'] | ||
expect(tokens[0][7]).toEqual value: '"', scopes: ['text.html.basic', 'meta.attribute-with-value.id.html', 'string.quoted.double.html', 'punctuation.definition.string.end.html'] | ||
expect(tokens[0][9]).toEqual value: 'type', scopes: ['text.html.basic', 'entity.other.attribute-name.html'] | ||
expect(tokens[0][10]).toEqual value: '=', scopes: ['text.html.basic'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems suspicious, but it should be a simple fix in a different PR 😄.
Closed
Blocked on #140, atom/language-javascript#438. |
I don't want too many specs to be broken at the same time so I'll wait until 1.13 reaches stable to merge this. |
3 tasks
I recently wrote a package called [atom-grammar-test](https://www.npmjs.com/package/atom-grammar-test) that allows writing grammar tests inline in your example files. Inspired by [ST3's Syntax Test](https://www.sublimetext.com/docs/3/syntax.html#Testing), it greatly helps writing complex cases since you're just annotating inline in your code examples. I included two examples for HTML to showcase usability, a base case as well as one for template fragments that was the most recent improvement to support angular templates. It's much easier to write a regression in this grammar test format compared to either writing jasmine style expects or relying on visual inspection.
Fixes parsing files with CRLF line endings
https://developers.whatwg.org/tabular-data.html#the-col-element This element has no end tag.
The remaining one exposes a bug in language-javascript which I have a fix for as well
b2f4ea3
to
206b904
Compare
Whoops. Will close and reopen. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main part of this fix is instead of trying to capture the ending
>
of<script>
in thepatterns
block, we now explicitly capture it inbeginCaptures
. To keep the tag tokenization (of things likeid
) from breaking, I moved all the'include': '#tag-stuff'
parts intobeginCaptures
as well. Same thing goes forendCaptures
and the</
of</script>
. In general all that's left inpatterns
is the embedded language.Also, I didn't see what
(?:\\s*\\n)?
had to do with anything, so I removed it.Fixes #82
/cc @benogle, @mnquintana