* parse.y [ripper]: remove Ripper#pos.

* parse.y [ripper]: Ripper#column should return the column of the current token.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2004-09-20 04:23:18 +00:00
Родитель f2d01d1478
Коммит 9f18c23572
2 изменённых файлов: 8 добавлений и 26 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Mon Sep 20 13:22:55 2004 Minero Aoki <aamine@loveruby.net>
* parse.y [ripper]: remove Ripper#pos.
* parse.y [ripper]: Ripper#column should return the column of the
current token.
Mon Sep 20 12:02:41 2004 Minero Aoki <aamine@loveruby.net>
* parse.y [ripper]: unify old_lex_p and token_head.

27
parse.y
Просмотреть файл

@ -146,7 +146,6 @@ struct parser_params {
VALUE parser_ruby_sourcefile;
VALUE delayed;
char *tokp;
long current_position;
#endif
};
@ -4227,7 +4226,6 @@ ripper_dispatch_scan_event(parser, t)
ripper_dispatch2(parser, ripper_id_scan, ID2SYM(event), rb_str_dup(str));
ripper_dispatch1(parser, event, str);
parser->current_position += RSTRING(str)->len;
ripper_flush(parser);
}
}
@ -8108,7 +8106,6 @@ parser_initialize(parser)
parser->parser_lex_pend = 0;
#ifdef RIPPER
parser->delayed = rb_ary_new();
parser->current_position = 0;
#endif
}
@ -8593,27 +8590,6 @@ ripper_parse(self)
return parser->result;
}
/*
* call-seq:
* ripper#pos -> Integer
*
* Return the byte index of the current lexer pointer in whole input.
* This number starts from 0.
*/
static VALUE
ripper_pos(self)
VALUE self;
{
struct parser_params *parser;
Data_Get_Struct(self, struct parser_params, parser);
if (!ripper_initialized_p(parser)) {
rb_raise(rb_eArgError, "method called for uninitialized object");
}
if (NIL_P(parser->parsing_thread)) return Qnil;
return LONG2NUM(parser->current_position);
}
/*
* call-seq:
* ripper#column -> Integer
@ -8633,7 +8609,7 @@ ripper_column(self)
rb_raise(rb_eArgError, "method called for uninitialized object");
}
if (NIL_P(parser->parsing_thread)) return Qnil;
col = parser->parser_lex_p - parser->parser_lex_pbeg;
col = parser->tokp - parser->parser_lex_pbeg;
return LONG2NUM(col);
}
@ -8690,7 +8666,6 @@ Init_ripper()
rb_define_alloc_func(Ripper, ripper_s_allocate);
rb_define_method(Ripper, "initialize", ripper_initialize, -1);
rb_define_method(Ripper, "parse", ripper_parse, 0);
rb_define_method(Ripper, "pos", ripper_pos, 0);
rb_define_method(Ripper, "column", ripper_column, 0);
rb_define_method(Ripper, "lineno", ripper_lineno, 0);
#ifdef RIPPER_DEBUG