Skip to content

Commit

Permalink
Merge pull request #14 from maxfierke/mf-fix_parsing_inline_comments_…
Browse files Browse the repository at this point in the history
…on_attributes

Fix parsing comments inline on attributes
  • Loading branch information
maxfierke authored May 9, 2024
2 parents 95ac6cb + 18cee9b commit 67b18f3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ on:
jobs:
build:
runs-on: ubuntu-latest

container:
image: crystallang/crystal

permissions:
contents: write
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: crystal-lang/install-crystal@v1
- name: Install dependencies
run: shards install
- name: Generate docs
run: crystal docs
- name: Deploy docs
uses: peaceiris/[email protected]
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/master'
with:
emptyCommits: false
allow_empty_commit: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
2 changes: 1 addition & 1 deletion spec/hcl/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ describe HCL::Parser do
ami = "ami-12345"
count = 2
source_dest_check = false
another_boolean = "true"
another_boolean = "true" # this is a string because... reasons
something_i_want_default = null
connection {
Expand Down
2 changes: 1 addition & 1 deletion src/hcl/grammar.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module HCL

comment_char = range(' ', 0x10FFFF_u32)
comment = (
char('#') >> (~newline >> comment_char).repeat >> newline
char('#') >> (~newline >> comment_char).repeat
).named(:comment, false)
multi_comment_char = ~str("*/") >> (comment_char | newline)
multi_comment = (
Expand Down
2 changes: 2 additions & 0 deletions src/hcl_parse_test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ variable "list_of_things" {
block {
cond = "%{ if true ~} hello %{~ endif }"
for_expr = "%{ for i, v in [true, 1, "hello"] }${i}: ${v}\n%{ endfor }"
some_property = [] # i am commenting about it
another_prop = true
}

HEREDOC
Expand Down

0 comments on commit 67b18f3

Please sign in to comment.