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
jsxLoader: Less than operator assumed to be an open element #20
Comments
Hi Björgvin, Thanks for trying out the JSX Loader and opening this issue with a simple example. I will later look into improving how expressions are handled. Most likely I will work on this next week but it may take longer to fix. // Adding a space before the variable would allow code to be compiled correctly
1 < n;
// Additionally if a character other than a letter
// is after [<] then code compiles correctly as well.
n<1; The specific error message is to help with conditions like there where there are multiple opening elements but zero or fewer closing elements. // Error Example
function App() {
return <div>Hello World<div>
}
// Valid because of closing </div>
function App() {
return <div>Hello World</div>
} The actual issue is caused by the compiler checking for a letter after a https://github.com/dataformsjs/dataformsjs/blob/master/js/react/jsxLoader.js#L787
|
You're welcome, it looks like JSX Loader has a lot of potential. I guess an approach would be to consider any < as potential start of element, enter tokenizeElement and then backtrack or invalidate the token when mismatch happens (instead of throwing an error). |
Fixed with the latest release |
Perhaps it's best to skip this test altogether?
The text was updated successfully, but these errors were encountered: