-
Notifications
You must be signed in to change notification settings - Fork 9
Spec does not parse 1 + ^==x #13
Comments
I'm not very familiar with JS's syntax details, but I have to assume that the "correct" solution here is going to be to remove the |
In other words, the best way forward might be to replace all instances of the
I wonder if the decorator proposal could use a similar [contiguous] annotation for Anyways, my bandwidth is limited this week, but I’ll see about changing the proposal specification as soon as I can…probably after the upcoming meeting. |
That's fine, we don't need to fix everything up for the stage advancement so long as there's a plausible plan for fixing it in stage 3. Your approach sounds plausible to me, tho. I wonder if it's actually needed, tho? It makes sense, certainly, but is it a problem to have I'm def not opposed, tho; exposing weird parsing details to authors is usually bad, and excessive flexibility can make conflicts between proposals accidentally more likely. |
I’m a bit confused, what does %= syntax do in hack pipes? |
You can assign in a pipe body, since assignments are expression-level. So you can write The problem is that, since |
@ljharb: Yes, basically the big problem is that The specification tries to work around this by adding But @waldemarhorwat pointed out that this workaround does not work either with So in the end we might have to handle this syntactically rather than lexically: to remove |
@tabatkins: Yes, I don’t know if allowing (I think that the same is probably true for decorators after |
Note that currently the tokenizer's longest match is not always right: For example both Babel and V8 tokenizes I agree with @tabatkins that tokenizer precedence is not necessarily relevant to operator precedence, so it is reasonable to handle it in the syntactic level. |
In anticipation of changing `%=` to `%` [contiguous] `=`. See #13.
The spec has been patched, and this parsing issue should now be fixed. Replacing ecmarkup didn’t like [contiguous], though; looks like its annotations are hard-coded. I had to add [contiguous] manually back to the spec’s compiled HTML… |
There might be a better way to solve this than the new [contiguous] annotation (see tc39/ecmarkup#356 (comment)), but I’ll leave that change for later. |
The specification currently treats
%==
and%===
as single punctuators (in order to disambiguate with the%=
assignment operator in the longest-matching tokenizer; see #2). It essentially uses%==
and%===
as prefix expression operators. @waldemarhorwat has pointed out that this does not address expressions containing%==
or%===
with which the%
is inside a preceding expression.For example,
1 + %==x
should be(1 + %)==x
but the specification parses it as1 + (%==x)
.I’m not yet sure what is the best way to go about fixing this. (The Babel plugin will also need a test for
1 + (%==x)
.)CC @tabatkins, @nicolo-ribaudo, @JLHwung.
The text was updated successfully, but these errors were encountered: