Skip to content

Fix suggestion for #4253#4256

Merged
hediet merged 1 commit intomicrosoft:mainfrom
OfekShilon:FixTokenizerComments
Dec 14, 2023
Merged

Fix suggestion for #4253#4256
hediet merged 1 commit intomicrosoft:mainfrom
OfekShilon:FixTokenizerComments

Conversation

@OfekShilon
Copy link
Copy Markdown
Contributor

In the cpp tokenizer, angled brackets (<>) were separated from other brackets to hold an additional post-condition:

...
	[/[{}()\[\]]/, '@brackets'],
	[/[<>](?!@symbols)/, '@brackets'],    // <----

Not sure why, one guessed motivation is that a tokenizer needs to be extra careful with < since it might eventually resolve to the operator <<. However,

(1) this doesn't solve it, << is still not tokenized to an operator (it fails all tokenizer regexes),

(2) this extra-liberal exclusion causes bugs like #4253.

This suggested fix treats angled-brackets identically to other brackets. A true c++-conforming tokenizer might require @rematch and other heavy machinery, but this one is pretty certain to be at least some step forward.

@OfekShilon
Copy link
Copy Markdown
Contributor Author

Ping

@hediet hediet enabled auto-merge December 14, 2023 10:54
@vscodenpa vscodenpa added this to the December / January 2024 milestone Dec 14, 2023
@hediet
Copy link
Copy Markdown
Member

hediet commented Dec 14, 2023

Thanks for the PR!

@hediet hediet merged commit 72dcedb into microsoft:main Dec 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants