hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

hclsyntax: Allow single-line comments at EOF without newline #104

Closed apparentlymart closed 5 years ago

apparentlymart commented 5 years ago

Previously we were using the EndOfLine as a mandatory marker to end the comment, but that meant that if a comment appeared immediately before EOF without a newline on the end it would fail to match.

Now we use the :>> operator, similarly to how we previously fixed greediness in the multi-line comment case: it tells Ragel to end the Comment production if the following pattern matches (if EndOfLine is found) but we can also allow the point before EndOfLine to be a final state in case EOF shows up there.

codecov-io commented 5 years ago

Codecov Report

Merging #104 into master will increase coverage by 0.01%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   68.68%   68.69%   +0.01%     
==========================================
  Files          98       98              
  Lines       10298    10299       +1     
==========================================
+ Hits         7073     7075       +2     
  Misses       2897     2897              
+ Partials      328      327       -1
Impacted Files Coverage Δ
hcl/hclsyntax/scan_tokens.go 97.14% <ø> (+0.24%) :arrow_up:

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 6a61d80...f21f747. Read the comment docs.