summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/yarp/fuzzer_test.rb1
-rw-r--r--yarp/yarp.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb
index 6dfbf94f39..8d818897a6 100644
--- a/test/yarp/fuzzer_test.rb
+++ b/test/yarp/fuzzer_test.rb
@@ -16,6 +16,7 @@ class FuzzerTest < Test::Unit::TestCase
snippet "incomplete symbol", ":"
snippet "incomplete escaped string", '"\\'
snippet "trailing comment", "1\n#\n"
+ snippet "comment followed by whitespace at end of file", "1\n#\n "
snippet "trailing asterisk", "a *"
snippet "incomplete decimal number", "0d"
snippet "incomplete binary number", "0b"
diff --git a/yarp/yarp.c b/yarp/yarp.c
index 37d55cd467..2422fb4571 100644
--- a/yarp/yarp.c
+++ b/yarp/yarp.c
@@ -5921,7 +5921,7 @@ parser_lex(yp_parser_t *parser) {
// If this is not followed by a comment, then we can break out
// of this loop.
- if (*following != '#') break;
+ if (peek_at(parser, following) != '#') break;
// If there is a comment, then we need to find the end of the
// comment and continue searching from there.