Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cjsx-Support #608

Closed
mpseidel opened this issue Oct 16, 2015 · 3 comments
Closed

cjsx-Support #608

mpseidel opened this issue Oct 16, 2015 · 3 comments

Comments

@mpseidel
Copy link

As jsx and coffee are already supported, I hope cjsx is possible without too much work:

https://github.com/jsdf/coffee-react

Would be awesome! Thanks for your great work.

@prettydiff
Copy link
Collaborator

It is more challenging than you think. The syntax of JSX expects the following:

JavaScript that contains XML syntax where the XML syntax may have one of the following JavaScript syntaxes embedded directly:

  • block comment
  • line comment
  • JavaScript logic wrapped in curly braces

Those three items are logically represented in the XML as tag attributes where the embedded JavaScript logic may or may not be associated with a proper attribute name. Then this logic might be JavaScript that contains further XML, such as JSX embedded directly in a JSX tag attribute.

These things sound confusing, but its not so bad as long you have a JavaScript parser that can correctly identify when to switch to an XML parser and for that XML parser to know that it is receiving JSX syntax which may require switching back to the prior JavaScript parser at the appropriate points. Having the appropriate parsers talking together in the appropriate ways extensively is the hard part. You could probably use the same markup parser that is used for JSX here, but you would need to extend a coffeescript parser to push to the markup parser correctly.

@mpseidel
Copy link
Author

@prettydiff thanks for the explanation - I see now how it is more compilcated than I thought. Unfortunately I have 0 experience in writing/extending parsers - but the issue is not that pressing anyways. Thanks again.

@prettydiff prettydiff mentioned this issue Nov 4, 2015
@prettydiff
Copy link
Collaborator

The CJSX project is deprecated in favor of using CoffeeScript2. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants