-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix <<command()>> and <<command("parameters")>> crashing bondage.js #37
Conversation
This stops commands with js-esque syntax from crashing bondage.js It also adds additional tests bondage.js to test for them being used. The parameters in () dont get passed yet - as it would require some refactoring of nodes.js which was requested to be done in another pull.
booleans should not start with a capital letter
Hey thanks! This is looking really good. One thing that I think is worth considering is allowing weirder syntax such as |
@jhayley I wonder if we can just add |
Making it completely flexible might interfere with some of the other features though, such as conditional statements. Not sure if I want the text to be returned if its a condition setting. It could be useful for debugging/logging - but it will make it more complicated to filter out commands if they get mixed with these statements - when bondage.js is used in a game. Narrowing it down to some extend is a good thing imo :) |
Hopefully we could treat the conditionals as keywords and allow anything else to be passed as strings to the handler. This behaviour is handled in lexer/states.js, specifically the command and commandOrExpression nodes. It treats Identifiers differently than text (an identifier is basically what amounts to a valid variable name). Now that I think about it, I'm not sure why this behaviour is there? I dont think yarn functions are valid in the case of them being called like An interesting side effect that demonstrates this is while Dropping that special identifier behaviour might be the answer |
Very interesting. @jhayley I will try to approach the problem from that angle then :) |
@jhayley
I wonder if I am missing something That functionality is very important to me, so I don't want to break it, nor return any conditional statements as commands. Right now the two are kind of mixed up in the same syntax pattern Do you think it would be safer if we only return a command if a key word is used? Perhaps we can use a shorter key word like "call"?
An alternative approach would be to use something different to encapsulate commands |
The lexer should already account for those keywords. It first checks to see if the first word is a defined operator, otherwise it continues on to treat it like regular text. I'd rather not add special syntax since that would diverge too much from how yarnspinner operates. But the lexer behaviour should prevent this from becoming an issue |
@jhayley I am sorry - I am having trouble understanding how exactly the lexer works. Can you help with this change please |
Hi! What are you having trouble with? Feel free to email me at [email protected] since I imagine that'd be easier than github comments! |
thank you for the patience @jhayley :) |
gave this another shot here: closing this one |
This pull prevents commands with js-esque syntax from crashing bondage.js
It addresses bug reported here:
#35
It also adds additional parser tests to make sure the syntax is not crashing it.
The parameters in () dont get passed yet - as it would require some refactoring of nodes.js which was requested by @jhayley to be done in a separate pull.