Skip to content

Add support for ending statements on a newline - #20

Draft
nilium wants to merge 1 commit into
masterfrom
eol-as-statement-end
Draft

Add support for ending statements on a newline#20
nilium wants to merge 1 commit into
masterfrom
eol-as-statement-end

Conversation

@nilium

@niliumnilium commented Feb 20, 2019

Copy link
Copy Markdown
Owner

This adds a bitflag to the parser to enable parsing newlines as
statement sentinels in place of semicolons. Semicolons continue to
work.

This still needs work to support a backslash before EOL as a means of
ending a statement, but since there's no lookahead on tokens right now,
that's a little tricky. Might be doable by checking if the last element
of the current statement is a '\' word.

Also, as-is, this requires that opening braces be on the same line as
the section they open. I don't see any reason to change this, so it'll
probably stick even if/when I add backslash line continuations.

@niliumnilium added the enhancement New feature or request label Feb 20, 2019
@niliumnilium self-assigned this Feb 20, 2019
@codecov

codecovBot commented Feb 20, 2019

Copy link
Copy Markdown

Codecov Report

Merging #20 into master will decrease coverage by 0.06%.
The diff coverage is 90%.

Impacted file tree graph

@@ Coverage Diff @@## master #20 +/- ##
==========================================
- Coverage 90.43% 90.36% -0.07% 
==========================================
Files 4 4 Lines 1254 1277 +23 ==========================================
+ Hits 1134 1154 +20 - Misses 106 108 +2 - Partials 14 15 +1
Impacted FilesCoverage Δ
parser.go91.7% <90%> (-0.51%)⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f209164...c8e65cd. Read the comment docs.

This adds a bitflag to the parser to enable parsing newlines as
statement sentinels in place of semicolons. Semicolons continue to
work.
This still needs work to support a backslash before EOL as a means of
ending a statement, but since there's no lookahead on tokens right now,
that's a little tricky. Might be doable by checking if the last element
of the current statement is a '\' word.
@nilium
niliumforce-pushed the eol-as-statement-end branch from cad5a0c to c8e65cdCompareFebruary 23, 2019 18:04
@nilium
nilium marked this pull request as draft October 26, 2022 23:12
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@nilium