summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-25 06:39:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-25 06:39:12 +0000
commit1727010a3abf84fd06f0e44d44b1b8ef6cde588e (patch)
tree098dc615cb65069b1d3f714cd959d3d3927c2aeb /parse.y
parent3976feed73bf4ec27183824870ee077c2b5b00b1 (diff)
990225
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y23
1 files changed, 12 insertions, 11 deletions
diff --git a/parse.y b/parse.y
index 6f654dfb2b..2d5ecfb4c7 100644
--- a/parse.y
+++ b/parse.y
@@ -1530,7 +1530,7 @@ singleton : var_ref
$$ = $1;
}
}
- | tLPAREN expr opt_nl ')'
+ | '(' expr opt_nl ')'
{
switch (nd_type($2)) {
case NODE_STR:
@@ -1541,7 +1541,7 @@ singleton : var_ref
case NODE_LIT:
case NODE_ARRAY:
case NODE_ZARRAY:
- yyerror("Can't define single method for literals.");
+ yyerror("can't define single method for literals.");
default:
break;
}
@@ -1783,7 +1783,9 @@ nextc()
normalize_newline(v);
while (RSTRING(v)->len >= 2 &&
RSTRING(v)->ptr[RSTRING(v)->len-1] == '\n' &&
- RSTRING(v)->ptr[RSTRING(v)->len-2] == '\\') {
+ RSTRING(v)->ptr[RSTRING(v)->len-2] == '\\' &&
+ (RSTRING(v)->len == 2 ||
+ RSTRING(v)->ptr[RSTRING(v)->len-3] != '\\')) {
VALUE v2 = (*lex_gets)(lex_input);
if (!NIL_P(v2)) {
@@ -2386,8 +2388,7 @@ here_document(term, indent)
case 0:
goto error;
}
- if (lex_lastline != line) {
- line = lex_lastline;
+ if (lex_p != lex_pend) {
goto retry;
}
}
@@ -2460,10 +2461,6 @@ retry:
while ((c = nextc()) != '\n') {
if (c == -1)
return 0;
- if (c == '\\') { /* skip a char */
- c = nextc();
- if (c == '\n') ruby_sourceline++;
- }
if (ismbchar(c)) {
int i, len = mbclen(c)-1;
@@ -2475,8 +2472,12 @@ retry:
}
}
}
- else if (c >= 0x80) {
- if ((c = nextc()) != '\\') {
+ else if (c == ' ') {
+ if ((c = nextc()) == '\\') {
+ c = nextc();
+ if (c == '\n') ruby_sourceline++;
+ }
+ else {
pushback(c);
}
}