Skip to content

Lexical classification for template strings #1744

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 7 commits into from

Conversation

DanielRosenwasser
Copy link
Member

This PR adds lexical classification support for template strings in the absence of a syntactic classifier.

It will break in the presence of

  • Nested template strings that span multiple lines.
  • Nested expressions composed of curly braces, where the closing curly falls on the next line.

But otherwise it is a fairly good approximation.

var offset = 0;
var token = SyntaxKind.Unknown;
var lastNonTriviaToken = SyntaxKind.Unknown;
var templateStack: SyntaxKind[];
Copy link
Contributor

Choose a reason for hiding this comment

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

just initialie this to []

Copy link
Contributor

Choose a reason for hiding this comment

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

i think one stack is sufficient. just make sure to clear it every call.

@DanielRosenwasser
Copy link
Member Author

@mhegazy @CyrusNajmabadi what are we thinking about this?

@DanielRosenwasser
Copy link
Member Author

It may be too late in our schedule to accept this change for 1.4.2.

@CyrusNajmabadi CyrusNajmabadi deleted the lexicalTemplateStrings branch June 4, 2015 00:16
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants