You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Catastrophic backtracking in JSDoc param types #495
FYI, the entire reason for these performance issues - and the ridiculously-contrived expressions causing them - is that nobody's bothered to structure these grammars properly.
The size of the JSDoc patterns alone suggests it's worth assigning its own grammar.
Yeah. The JSDoc section definitely needs to be restructured and yanked out to become its own grammar (it's just been pretty low priority, because, well, it worked). It's fairly impossible to see where the backtracking is occurring unlike the last one.
(Also, commas will trigger the catastrophic backtracking as well)
I'll do it to make up for the unsuccessful SassLess->CSS integration... which, BTW, will have to be limited to some unexciting pattern inclusions. I was hoping of having them share CSS's pattern-matching, but having to accommodate subtraction arithmetic between words has killed it.
This took too long because I wanted to do too much. :c
A good first step to take is to make the capture on L2240 possessive. That gets rid of the catastrophic bactrack error on Regex101 (back to ~1-3ms), but there's some other pattern still backtracking in Atom.
Think I'll just rewrite the whole damn JSDoc grammar myself. How's that for possessive? 💚
Shouldn't take me more than an hour. The "language" has such an absurdly-simple composition, it's embarrassing that it could snowball into what it has... :(
@50Wliu JSYK, I've tweaked the scope-names for the /* … */ blocks; they're technically not entirely accurate going by @infininight's guidelines for punctuation-type scopes (which are the closest thing we have to an authority on the topic).
If you see similar changes in future pull-requests, my recent discovery of that gist will be the reason why.
@50Wliu Can I ditch other.meta.jsdoc in favour of something, erh, specific? Or do you foresee changes to these scopes breaking any documentation-related Atom packages or anything?
Well... to be honest, many of these scopes are weird. I'm keeping them for theming compatibility, but any scope that contains other starts looking like deleteme very rapidly.
I'll torch it. Not gonna keep cargo-culted material.
Okay, ignore that, because I'm spending more time reading about JSDoc features I didn't know existed than I am writing stuff (so far). I'm combing through the official specification alphabetically, writing the grammar as I go along (I'm also aware of Google Closure Compiler syntax and TypoScript flavours too, so I'l tackle those too).
Activity
Alhadis commentedon Feb 28, 2017
Sigh... I'll get this one (again).
Alhadis commentedon Feb 28, 2017
FYI, the entire reason for these performance issues - and the ridiculously-contrived expressions causing them - is that nobody's bothered to structure these grammars properly.
The size of the JSDoc patterns alone suggests it's worth assigning its own grammar.
winstliu commentedon Feb 28, 2017
Yeah. The JSDoc section definitely needs to be restructured and yanked out to become its own grammar (it's just been pretty low priority, because, well, it worked). It's fairly impossible to see where the backtracking is occurring unlike the last one.
(Also, commas will trigger the catastrophic backtracking as well)
Alhadis commentedon Feb 28, 2017
If I do a full rewrite, will it be worth it though?
I mean, the whole
tree-sitterthing and all...winstliu commentedon Feb 28, 2017
That's up to you.
Alhadis commentedon Feb 28, 2017
I'll do it to make up for the unsuccessful SassLess->CSS integration... which, BTW, will have to be limited to some unexciting pattern inclusions. I was hoping of having them share CSS's pattern-matching, but having to accommodate subtraction arithmetic between words has killed it.
This took too long because I wanted to do too much. :c
winstliu commentedon Feb 28, 2017
A good first step to take is to make the capture on L2240 possessive. That gets rid of the catastrophic bactrack error on Regex101 (back to ~1-3ms), but there's some other pattern still backtracking in Atom.
Alhadis commentedon Feb 28, 2017
Think I'll just rewrite the whole damn JSDoc grammar myself. How's that for possessive? 💚
Shouldn't take me more than an hour. The "language" has such an absurdly-simple composition, it's embarrassing that it could snowball into what it has... :(
Alhadis commentedon Feb 28, 2017
I'll start once I've finished fixing file-icons/atom#550...Forget it, attacking now.Alhadis commentedon Feb 28, 2017
@50Wliu JSYK, I've tweaked the scope-names for the
/* … */blocks; they're technically not entirely accurate going by @infininight's guidelines forpunctuation-type scopes (which are the closest thing we have to an authority on the topic).If you see similar changes in future pull-requests, my recent discovery of that gist will be the reason why.
Alhadis commentedon Feb 28, 2017
@50Wliu Can I ditch
other.meta.jsdocin favour of something, erh, specific? Or do you foresee changes to these scopes breaking any documentation-related Atom packages or anything?winstliu commentedon Feb 28, 2017
Can't tell you without seeing the PR first, but that does sound like a weird scope.
Alhadis commentedon Feb 28, 2017
Well... to be honest, many of these scopes are weird. I'm keeping them for theming compatibility, but any scope that contains
otherstarts looking likedeletemevery rapidly.I'll torch it. Not gonna keep cargo-culted material.
Alhadis commentedon Feb 28, 2017
Okay, ignore that, because I'm spending more time reading about JSDoc features I didn't know existed than I am writing stuff (so far). I'm combing through the official specification alphabetically, writing the grammar as I go along (I'm also aware of Google Closure Compiler syntax and TypoScript flavours too, so I'l tackle those too).
You can track my progress here.
Alhadis commentedon Mar 3, 2017
... just letting you know I'm done, but I'm damned if I know how long it'll take to repair these specs. Heh.
Shouldn't take an hour...