facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.
http://facebook.github.io/jsx/
1.96k stars 133 forks source link

JSX "requires" special token parsing, should be documented? #3

Closed syranide closed 8 years ago

syranide commented 10 years ago

I haven't read it in detail yet (so forgive me if I missed it), but we may need to add some additional documentation detailing the need for a separate token table when parsing JSX (see facebook/esprima#39).

There are two options here as I see it:

  1. Disable conflicting JS tokens when parsing JSX.
  2. Use an entirely separate token table for JSX (just a handful).

The upside of 1 is that misplaced tokens emit familiar errors and the implementation is simpler, but also a bit more fragile. With option 1 <Comp == would yield an error for == instead of just =.

sebmarkbage commented 10 years ago

E4X does this. They also handle comments and whitespace differently because it doesn't follow the normal tokenization rules. This is annoying but required.

sebmarkbage commented 10 years ago

This is definitely a bug in both the spec and implementation.

ghost commented 9 years ago

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

syranide commented 8 years ago

I'm pretty sure this has been resolved already or is irrelevant in-terms of the spec?