summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-19 07:10:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-19 07:10:09 +0000
commit7a978073c9160e6ed1c706aaf034b2c4c4d104e1 (patch)
treef1ad61761e4b28b18e939dd1667981810cc49d4b /parse.y
parent03c4e447fab16864abed71b174a0636d9524b5b9 (diff)
* parse.y (parser_yylex): should clear parser->tokp as well.
[ruby-dev:32250] * parse.y: remove NEED_ASSOC that break test_parser_events. * parse.y (parser_yylex): should not decrement line numbers at the end of file. * file.c (rb_find_file_ext): search .rb files first through in the loadpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y56
1 files changed, 25 insertions, 31 deletions
diff --git a/parse.y b/parse.y
index 907f0c2de2..ea68d1f999 100644
--- a/parse.y
+++ b/parse.y
@@ -565,15 +565,6 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
# define PARSER_ARG ruby_sourcefile, ruby_sourceline,
#endif
-#ifdef RIPPER
-#define NEED_ASSOC(cons, car, cdr) do { \
- if ((cons) == (car) || (cons) == (cdr) || \
- TYPE(cons) != T_ARRAY || RARRAY_LEN(cons) != 2) { \
- (cons) = rb_assoc_new((car), (cdr)); \
- } \
- } while (0)
-#endif
-
/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,
for instance). This is too low for Ruby to parse some files, such as
date/format.rb, therefore bump the value up to at least Bison's default. */
@@ -4413,7 +4404,6 @@ assoc : arg_value tASSOC arg_value
$$ = list_append(NEW_LIST($1), $3);
/*%
$$ = dispatch2(assoc_new, $1, $3);
- NEED_ASSOC($$, $1, $3);
%*/
}
| tLABEL arg_value
@@ -4422,7 +4412,6 @@ assoc : arg_value tASSOC arg_value
$$ = list_append(NEW_LIST(NEW_LIT(ID2SYM($1))), $2);
/*%
$$ = dispatch2(assoc_new, $1, $2);
- NEED_ASSOC($$, $1, $2);
%*/
}
;
@@ -6003,21 +5992,6 @@ parser_yylex(struct parser_params *parser)
cmd_state = command_start;
command_start = Qfalse;
retry:
-#ifdef RIPPER
- while ((c = nextc())) {
- switch (c) {
- case ' ': case '\t': case '\f': case '\r':
- case '\13': /* '\v' */
- space_seen++;
- break;
- default:
- goto outofloop;
- }
- }
- outofloop:
- pushback(c);
- ripper_dispatch_scan_event(parser, tSP);
-#endif
switch (c = nextc()) {
case '\0': /* NUL */
case '\004': /* ^D */
@@ -6029,6 +6003,20 @@ parser_yylex(struct parser_params *parser)
case ' ': case '\t': case '\f': case '\r':
case '\13': /* '\v' */
space_seen++;
+#ifdef RIPPER
+ while ((c = nextc())) {
+ switch (c) {
+ case ' ': case '\t': case '\f': case '\r':
+ case '\13': /* '\v' */
+ break;
+ default:
+ goto outofloop;
+ }
+ }
+ outofloop:
+ pushback(c);
+ ripper_dispatch_scan_event(parser, tSP);
+#endif
goto retry;
case '#': /* it's a comment */
@@ -6070,16 +6058,22 @@ parser_yylex(struct parser_params *parser)
space_seen++;
break;
case '.': {
- if ((c = nextc()) != '.') {
- pushback(c);
- pushback('.');
+ if ((c = nextc()) != '.') {
+ pushback(c);
+ pushback('.');
goto retry;
- }
+ }
}
default:
+ --ruby_sourceline;
+ case -1: /* EOF no decrement*/
lex_nextline = lex_lastline;
lex_p = lex_pend;
- --ruby_sourceline;
+#ifdef RIPPER
+ if (c != -1) {
+ parser->tokp = lex_p;
+ }
+#endif
goto normal_newline;
}
}