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

Why does JSTalk finds syntax errors in a correct javascript file? #6

Open
fpinzn opened this issue Feb 11, 2013 · 5 comments
Open

Why does JSTalk finds syntax errors in a correct javascript file? #6

fpinzn opened this issue Feb 11, 2013 · 5 comments

Comments

@fpinzn
Copy link

fpinzn commented Feb 11, 2013

I'm experimenting around with JsTalk and tried to use underscore.js from my script (I concatenated the files) and when I run it using jstalk it finds the following error:

Error line 503, SyntaxError: Expected an identifier but found '[' instead

When I execute the exact same code using node instead of jstalk it works just fine.

@ccgus
Copy link
Owner

ccgus commented Feb 11, 2013

It's probably a problem with the preprocessor. Can you paste the code somewhere?

@fpinzn
Copy link
Author

fpinzn commented Feb 11, 2013

It's just underscore js with a print after it. You can check it here: https://github.com/fpinzn/sketch-commands/blob/master/dist/HelloWorld.jstalk

@ccgus
Copy link
Owner

ccgus commented Feb 11, 2013

Looks like the preprocessor is turning:
result[list[i]] = values[i];
into:
resultlist.i = values[i];

If you're using the framework in an app, you can turn off the preprocessor which should fix this. You won't be able to use objc syntax though. Hopefully I'll get this fixed in a future update.

@ccgus ccgus closed this as completed Feb 11, 2013
@ccgus ccgus reopened this Feb 11, 2013
@fpinzn
Copy link
Author

fpinzn commented Feb 11, 2013

I'm developing a plugin for Sketch, is there a way (native to jsTalk) to bypass the preprocessor given a directive in the source or something like that, or its up to the application?

I don't really use the objc syntax, I'm actually using coffeescript.

@ccgus
Copy link
Owner

ccgus commented Feb 12, 2013

It's up to the app unfortunately.

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

No branches or pull requests

2 participants