summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y10
-rw-r--r--test/ruby/test_parse.rb2
-rw-r--r--version.h2
3 files changed, 8 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index f6cb9d1521..d58fa6e0b7 100644
--- a/parse.y
+++ b/parse.y
@@ -7286,9 +7286,9 @@ tokadd_utf8(struct parser_params *p, rb_encoding **encp,
* invalid unicode escapes are allowed in comments. The regexp parser
* does its own validation and will catch any issues.
*/
- int c = *p->lex.pcur;
- tokadd(p, c);
- for (c = *++p->lex.pcur; p->lex.pcur < p->lex.pend; c = *++p->lex.pcur) {
+ tokadd(p, open_brace);
+ while (++p->lex.pcur < p->lex.pend) {
+ int c = peekc(p);
if (c == close_brace) {
tokadd(p, c);
++p->lex.pcur;
@@ -7678,7 +7678,7 @@ tokadd_string(struct parser_params *p,
--*nest;
}
else if ((func & STR_FUNC_EXPAND) && c == '#' && p->lex.pcur < p->lex.pend) {
- int c2 = *p->lex.pcur;
+ unsigned char c2 = *p->lex.pcur;
if (c2 == '$' || c2 == '@' || c2 == '{') {
pushback(p, c);
break;
@@ -9313,7 +9313,7 @@ parse_qmark(struct parser_params *p, int space_seen)
enc = rb_utf8_encoding();
tokadd_utf8(p, &enc, -1, 0, 0);
}
- else if (!lex_eol_p(p) && !(c = *p->lex.pcur, ISASCII(c))) {
+ else if (!ISASCII(c = peekc(p))) {
nextc(p);
if (tokadd_mbchar(p, c) == -1) return 0;
}
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index a22f11aeae..f2691cfe0f 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -607,6 +607,8 @@ class TestParse < Test::Unit::TestCase
assert_syntax_error("?\\M-\x01", 'Invalid escape character syntax')
assert_syntax_error("?\\M-\\C-\x01", 'Invalid escape character syntax')
assert_syntax_error("?\\C-\\M-\x01", 'Invalid escape character syntax')
+
+ assert_equal("\xff", eval("# encoding: ascii-8bit\n""?\\\xFF"))
end
def test_percent
diff --git a/version.h b/version.h
index 9f9bb7d5bb..9067de78f3 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 2
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 128
+#define RUBY_PATCHLEVEL 129
#include "ruby/version.h"
#include "ruby/internal/abi.h"