Skip to content

Commit

Permalink
fix: immediate hash in string is considered content instead of comment (
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Nov 14, 2020
1 parent e1aa4dd commit 4993307
Show file tree
Hide file tree
Showing 4 changed files with 671 additions and 692 deletions.
19 changes: 19 additions & 0 deletions corpus/issues.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
================================================================================
VALID - issue #17 - immediate hash in string is considered content instead of comment
================================================================================

# This is a full-line comment
key = "value" # This is a comment at the end of a line
another = "# This is not a comment"

--------------------------------------------------------------------------------

(document
(comment)
(pair
(bare_key)
(string)
(comment))
(pair
(bare_key)
(string)))
5 changes: 4 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ module.exports = grammar({
),

comment: $ =>
token(seq("#", repeat(getInverseRegex(control_chars.subtract("\t"))))),
token(prec(-1, seq(
"#",
repeat(getInverseRegex(control_chars.subtract("\t"))),
))),

table: $ =>
seq(
Expand Down
30 changes: 17 additions & 13 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4993307

Please sign in to comment.