[suggestion] Allow bracketless version of if/while/for/foreach
See original GitHub issueInstead of mandatory ()
around an expression in listed keywords an option would exist to parse them without brackets.
Now:
if (expr) {
}
With suggestion option toggled on:
if expr {
}
Since EE already supports lightweighted syntactic constructs (myVar = 0;
instead of [type] myVar = 0;
), this would a nice addition for Python like scripting.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
PHP - If/else, for, foreach, while - without curly braces?
The curly brace is not required however, for readability and maintenance, many developers would consider it bad style not to include them.
Read more >Foreach-loop with break/return vs. while-loop with explicit ...
If the loop's contents cannot fit on your screen and has several returns in the loop, there is an argument to be made...
Read more >Code Inspection: For-loop can be converted into foreach-loop
When you iterate through a collection without modifying it or accessing the iteration variable, it is possible to use foreach instead of the ......
Read more >Repeat escaped foreach until count is met
I'm trying to repeat a foreach loop from a files field until the count meets at least 10 images. The foreach needs to...
Read more >Is it bad practice to use foreach instead of while? : r/PHP
Always use FOREACH when iterating over a whole array, or at least from the top of an array to a BREAK condition. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some small breaking changes are linked to this issue. So I think the next version of EE that will come with all of these scripts customization stuff will be a 1.5.x.x major version.
Also, the possibility to set arrays for block keywords syntax options seem harder than I thought especially for all brackets stuff that support nesting (imbrication) and for what we need to now which end bracket close which start bracket.
OK I am currently working on this. And your solution is good but I can not implement it in this strict manner. Here a few reasons :
((something) - (otherThing))
and a separator not so the parsing process is different.Also take note that this is include in a refactoring of the script evaluation part of EE to be more flexible. I also try to add the following features :
;
or something else like end of line.So here is what I came up with so far :
(I try to be language agnostic but also to prevent syntax evaluation conflicts or errors so it’s a little bit different of your proposition)
It should already allow a few different syntaxes :
C# like syntax
Python like syntax
Pascal like syntax
Some exotic syntax