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

Error parsing when using 'new' in a ternary expression. #229

Closed
codeservice opened this issue Apr 14, 2015 · 5 comments
Closed

Error parsing when using 'new' in a ternary expression. #229

codeservice opened this issue Apr 14, 2015 · 5 comments

Comments

@codeservice
Copy link

Code example:

var qqq = a == b ? new c() : new b();

TIR: STB-9401
Cant recognize ":"

Environment:
IDEA 14.1.1
Haxe Plugin: 0.9.3
Java: 1.8.0
Platform: Windows 7

@EBatTiVo
Copy link
Contributor

Probably need to add ':' to the new_recovery rule in haxe.bnf. But maybe not, since it should have recovered at the right parenthesis. So, it might be the ternary expression rule needs tweaking.

@codeservice
Copy link
Author

I see declaration:

private ternaryExpressionWrapper ::= logicOrExpressionWrapper ternaryExpression?
left ternaryExpression ::= '?' expression ':' ternaryExpressionWrapper

Maybe the same as coma, need ":" -> private new_recovery ::= !(')' | '}' | ';' | '.' | ','|':')?

newExpression ::= 'new' type '(' (expression (',' expression)*)? ')'
{pin=2 recoverWhile="new_recovery" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
private new_recovery ::= !(')' | '}' | ';' | '.' | ',')

@EBatTiVo
Copy link
Contributor

Maybe the same as coma, need ":" -> private new_recovery ::= !(')' | '}' | ';' | '.' | ','|':')?

Yes, that's the first thing to try.

@EBatTiVo EBatTiVo changed the title Parser issue. Error parsing when using 'new' in a ternary expression. Apr 21, 2015
EBatTiVo added a commit that referenced this issue May 16, 2015
Fixes tivo/intellij-haxe #229
Added a unit test for the 'new' command.
@EBatTiVo
Copy link
Contributor

Fixed.

@codeservice
Copy link
Author

Thanks!

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

2 participants