Skip to content

Commit

Permalink
Support comments (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdezFOmar authored Jun 30, 2024
1 parent 629676f commit f2a3743
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = grammar({
$.location,
$.addition,
$.deletion,
$.context
$.context,
$.comment
),

block: ($) =>
Expand Down Expand Up @@ -102,6 +103,7 @@ module.exports = grammar({
),

context: ($) => token(prec(-1, ANYTHING)),
comment: ($) => iseq("#", optional(ANYTHING)),

linerange: ($) => /[-\+]\d+(,\d+)?/,
filename: ($) => repeat1(/\S+/),
Expand Down
22 changes: 22 additions & 0 deletions test/corpus/text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,25 @@ new mode 100755
(mode))
(file_change
(mode))))

================================================================================
Comments
================================================================================
# Some comment
# This is not a comment
# But this is
context
# Empty comment
#
more contex

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

(source
(comment)
(context)
(comment)
(context)
(comment)
(comment)
(context))

0 comments on commit f2a3743

Please sign in to comment.