summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-17 11:34:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-17 11:34:02 +0000
commitd3b780b1cf6793996c36c3345cb85f0764bbfc25 (patch)
tree7850b6d262599db8c1add8d1016f71088d6f1262
parent577fa4c6a88fe5a503c2c91d60f03652e10905cc (diff)
* parse.y (tokadd_string, parse_string, yylex): escaped terminator
is now interpreted as is. [ruby-talk:82206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--parse.y54
2 files changed, 16 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c25f3c2fc..c42ae387bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Sep 17 20:34:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (tokadd_string, parse_string, yylex): escaped terminator
+ is now interpreted as is. [ruby-talk:82206]
+
Wed Sep 17 18:52:36 2003 Minero Aoki <aamine@loveruby.net>
* test/fileutils/fileassertions.rb: new file.
@@ -20,7 +25,7 @@ Wed Sep 17 18:03:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/extconf.rb: add check for assert.h.
- * ext/openssl/ossl.c (ossl_buf2str): new function to convert
+ * ext/openssl/ossl.c (ossl_buf2str): new function to convert
C buffer to String and free buffer.
* ext/openssl/ossl.c (ossl_x509_ary2sk): new function to convert
@@ -73,7 +78,7 @@ Mon Sep 15 19:02:52 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/csv.rb: add extra pamameter to specify row(record) separater
character. To parse Mac's CR separated CSV, do like this.
- CSV.open("mac.csv", "r", ?,, ?\r) { |row| p row.to_a }
+ CSV.open("mac.csv", "r", ?,, ?\r) { |row| p row.to_a }
The 3rd parameter in this example ?, is for column separater and the
4th ?\r is for row separater. Row separater is nil by default. Nil
separater means "\r\n" or "\n".
@@ -868,7 +873,7 @@ Fri Aug 15 01:34:23 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* ext/openssl/ossl_pkey_{dh|dsa|rsa}.c: adapt to this cb
* ext/openssl/openssl_missing.[ch]: add (0.9.6x, x<j) missing BN funcs
-
+
* ext/openssl/ossl_bn.c: use supplied funcs from openssl_missing.c
Fri Aug 15 00:38:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
diff --git a/parse.y b/parse.y
index 259f211beb..9671ff97f4 100644
--- a/parse.y
+++ b/parse.y
@@ -108,10 +108,6 @@ static int in_single = 0;
static int in_def = 0;
static int compile_for_eval = 0;
static ID cur_mid = 0;
-static int quoted_term;
-#define quoted_term_char ((unsigned char)quoted_term)
-#define WHEN_QUOTED_TERM(x) ((quoted_term >= 0) && (x))
-#define QUOTED_TERM_P(c) WHEN_QUOTED_TERM((c) == quoted_term_char)
static NODE *cond();
static NODE *logop();
@@ -174,7 +170,6 @@ static void top_local_setup();
#define NODE_STRTERM NODE_ZARRAY /* nothing to gc */
#define NODE_HEREDOC NODE_ARRAY /* 1, 3 to gc */
-#define ESCAPED_TERM (1 << CHAR_BIT)
#define SIGN_EXTEND(x,n) (((1<<(n))-1-((x)&~(~0<<(n))))^~(~0<<(n)))
#define nd_func u1.id
#if SIZEOF_SHORT == 2
@@ -263,7 +258,7 @@ static void top_local_setup();
%type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node
%type <id> fitem variable sym symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg
-%type <num> f_norm_arg f_arg term_push
+%type <num> f_norm_arg f_arg
%token tUPLUS /* unary+ */
%token tUMINUS /* unary- */
%token tPOW /* ** */
@@ -2050,7 +2045,7 @@ string_content : tSTRING_CONTENT
lex_strterm = $<node>2;
$$ = NEW_EVSTR($3);
}
- | tSTRING_DBEG term_push
+ | tSTRING_DBEG
{
$<node>$ = lex_strterm;
lex_strterm = 0;
@@ -2058,11 +2053,10 @@ string_content : tSTRING_CONTENT
}
compstmt '}'
{
- quoted_term = $2;
- lex_strterm = $<node>3;
- if (($$ = $4) && nd_type($$) == NODE_NEWLINE) {
+ lex_strterm = $<node>2;
+ if (($$ = $3) && nd_type($$) == NODE_NEWLINE) {
$$ = $$->nd_next;
- rb_gc_force_recycle((VALUE)$4);
+ rb_gc_force_recycle((VALUE)$3);
}
$$ = new_evstr($$);
}
@@ -2074,16 +2068,6 @@ string_dvar : tGVAR {$$ = NEW_GVAR($1);}
| backref
;
-term_push : /* none */
- {
- if (($$ = quoted_term) == -1 &&
- nd_type(lex_strterm) == NODE_STRTERM &&
- !nd_paren(lex_strterm)) {
- quoted_term = nd_term(lex_strterm);
- }
- }
- ;
-
symbol : tSYMBEG sym
{
lex_state = EXPR_END;
@@ -2450,7 +2434,7 @@ static char *lex_pend;
static int
yyerror(msg)
- char *msg;
+ const char *msg;
{
char *p, *pe, *buf;
int len, i;
@@ -2535,7 +2519,6 @@ yycompile(f, line)
ruby_eval_tree = 0;
heredoc_end = 0;
lex_strterm = 0;
- quoted_term = -1;
ruby_current_node = 0;
ruby_sourcefile = rb_source_filename(f);
n = yyparse();
@@ -2993,10 +2976,6 @@ tokadd_string(func, term, paren, nest)
}
else if (c == '\\') {
c = nextc();
- if (QUOTED_TERM_P(c)) {
- pushback(c);
- return c;
- }
switch (c) {
case '\n':
if (func & STR_FUNC_QWORDS) break;
@@ -3068,9 +3047,7 @@ parse_string(quote)
do {c = nextc();} while (ISSPACE(c));
space = 1;
}
- if ((c == term && !quote->nd_nest) ||
- (c == '\\' && WHEN_QUOTED_TERM(peek(quoted_term_char)) &&
- (c = nextc()) == term)) {
+ if (c == term && !quote->nd_nest) {
if (func & STR_FUNC_QWORDS) {
quote->nd_func = -1;
return ' ';
@@ -4095,13 +4072,6 @@ yylex()
goto retry; /* skip \\n */
}
pushback(c);
- if (QUOTED_TERM_P(c)) {
- if (!(quoted_term & ESCAPED_TERM)) {
- rb_warn("escaped terminator '%c' inside string interpolation", c);
- quoted_term |= ESCAPED_TERM;
- }
- goto retry;
- }
return '\\';
case '%':
@@ -4111,14 +4081,6 @@ yylex()
c = nextc();
quotation:
- if (c == '\\' && WHEN_QUOTED_TERM(peek(quoted_term_char))) {
- c = nextc();
- if (!(quoted_term & ESCAPED_TERM)) {
- rb_warn("escaped terminator '%s%c' inside string interpolation",
- (c == '\'' ? "\\" : ""), c);
- quoted_term |= ESCAPED_TERM;
- }
- }
if (!ISALNUM(c)) {
term = c;
c = 'Q';
@@ -4856,7 +4818,7 @@ assignable(id, val)
return NEW_CVDECL(id, val);
}
else {
- rb_compile_error("identifier %s is not valid", rb_id2name(id));
+ rb_compile_error("identifier %s is not valid", rb_id2name(id));
}
return 0;
}