Closed karollewandowski closed 7 years ago
Bracket property access is specified both in the grammar and in the more detailed expression examples: https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md#112-expressions
The ternary operator specifies whitespaces around branches and these are defined as either space, tab, carriage return or new line in the grammar. The following expression works (second line as a tab and three spaces:
${true ? "true"
: "false"}
Thanks for your answer, but it's still unclear.
Could you please point me where exactly it is? I mean grammar, not examples in documentation. I'm developing IntelliJ plugin for HTL and want to be consistent with grammar from official specification, that's why it's important to me.
Hmm, in grammar I can only see:
/* Note required space characters around ':' */
exprNode = binaryOp , '?' , binaryOp , ws , ' : ' , ws , binaryOp
| binaryOp ;
Token ' : '
has spaces around colon (as comment states). Whitespaces are around full ' : '
token. Maybe it works for current implementation, but grammar does not allow tabs/new lines just before colon. Again - it's important from HTL plugins developers point of view.
Edit: I missed that you pasted <tab><3 spaces>
. The question is why can't we put tab/new line just before colon? Is there any reason?
Yes, I think there things that need improvement, thanks for bringing it up!
@karollewandowski, I've updated the EBNF in b9168a5. Hope this makes it clearer.
@raducotescu, thank you for update. It's correct and clear now.
I analysed HTL grammar and it seems to me, that there are two issues:
properties['key']
) - where is it? Maybe it's implicitly included, but I tried to find it without success.:
, but I think that it's nothing uncommon to format HTML files with tabs and have something like:Branches separator can't be properly parsed in such code and it can be confusing for developers ("why the hell it doesn't work?"). In my opinion all white spaces should be allowed.