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

#655 feat: adds indentation instead of curly braces for and if blocks #746

Merged
merged 2 commits into from
Mar 6, 2020

Conversation

siowyisheng
Copy link
Contributor

@siowyisheng siowyisheng commented Mar 6, 2020

TESTED with the following cases

(1) simple case for

for n from 1 to 3
    echo n

(2) simple case if

if 5 more than 3
    echo 1
    echo 2
    if 5 more than 3
        echo 3
    echo 4

(3) dropping down two levels of indentation

if 5 more than 3
    echo 1
    echo 2
    if 5 more than 3
        echo 3

(4) test for backward compatibility (the output repeats the curly braces, which is ugly but the code still works)

for n from 1 to 3
{
    echo n
}

(5) test with python integration

py begin
for i in range(5):
    print(i)
py finish

for n from 1 to 3
    echo n

(6) test for inconsistent numbers of spaces - the code errors out with ERROR - use a consistent number of spaces for indentation

if 5 more than 3
    echo 1
    echo 2
    if 5 more than 3
        echo 3
      echo 4

Comment on lines 162 to 166
if (($previous_line_is_condition == true) and ($current_line_is_condition == true))
die("ERROR - for nested conditions, loops, popup, frame, set { and } explicitly\n".
"ERROR - add { before this line and add } accordingly - ".$padded_raw_flow_line);
if (($previous_line_is_condition == true) and (substr($padded_raw_flow_line,0,1)!="{"))
$padded_raw_flow .= "{\n".trim($padded_raw_flow_line)."\n}\n"; else $padded_raw_flow .= $padded_raw_flow_line;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this as the single line "if" is no longer used.

@siowyisheng siowyisheng force-pushed the indentation_for_loops_and_if branch from ab5459c to bd37db9 Compare March 6, 2020 06:53
@siowyisheng siowyisheng force-pushed the indentation_for_loops_and_if branch from 97fdb3e to ddbea1a Compare March 6, 2020 07:06
@kensoh kensoh merged commit b169547 into develop Mar 6, 2020
@kensoh kensoh deleted the indentation_for_loops_and_if branch March 6, 2020 07:29
@kensoh
Copy link
Member

kensoh commented Mar 6, 2020

Perfect!!

siowyisheng added a commit that referenced this pull request Mar 10, 2020
…#746)

* #655 feat: adds indentation instead of curly braces for and if blocks

* feat: provides backward compatibility for single line if statements
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

Successfully merging this pull request may close these issues.

2 participants