Parse list and list spread in JSX
fixes #1467
<>...[]</> doesn't parse without space in-between
<>...foo</> desugaring to [@JSX] foo might be fine; no other case where anything else possibly desugars to this right? Because I'm gonna assume on the PPX side that [@JSX] foo is the fragment + children spread.
To try to invalidate the above, I can do <> ...(<> ...[] </>) </>; but that gives me ([@JSX] [@JSX] []), which is still fine. Though really, it should be ([@JSX]([@JSX] []))
Am I making sense? Essentially, it should always be the case that whichever spread you use with whichever fragment syntax, and whichever composition of those, can always be distinguished when the PPX goes through the AST. We shouldn't accidentally lose info from our syntax-level eager removal of <>...foo</> into the resulting AST.
I rebased and fixed quite a few things in https://github.com/facebook/reason/compare/master...Drup:jsxlist
In particular, inline lists and normal elements can now be interleaved: <Foo> i [1,2] i [3] </Foo>.
To allow that, I had to disallow array accesses as JSX children. One must writes <> (a[2]) </>. I think it's reasonable.
While I was down there, I factorized the JSX parser quite a lot. It''s shorter with the additions than it was before.
The printer is still completely incorrect, I haven't fixed it yet (and my motivation is wearing a bit thin :p).
Even in the current release, refmt is wrong with lists in JSX:
% echo "<Foo> ([1,2]) i </Foo>" | refmt
<Foo> 1 i 2 </Foo>;