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

Add support for ending statements on a newline #20

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nilium
Copy link
Owner

@nilium nilium commented Feb 20, 2019

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.

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

codecov bot commented Feb 20, 2019

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 Files Coverage Δ
parser.go 91.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 nilium force-pushed the eol-as-statement-end branch from cad5a0c to c8e65cd Compare February 23, 2019 18:04
@nilium nilium marked this pull request as draft October 26, 2022 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant