Граф коммитов

1313 Коммитов

Автор SHA1 Сообщение Дата
nobu 04eb614251 parse.y: mark debug_buffer
* parse.y (parser_mark): mark debug_buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 18:09:52 +00:00
nobu 7a3cc69779 parse.y: Fix for nth_ref_max
* parse.y (parse_numvar): NTH_REF must be less than a half of
  INT_MAX, as it is left-shifted to be ORed with back-ref flag.
  [ruby-core:74444] [Bug#12192] [Fix GH-1296]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 07:22:26 +00:00
nobu cb65717b45 parse.y: symbol literals for alias/undef
* defs/keywords (alias, undef): symbol literals are allowed.
* parse.y (parse_percent): should parse symbol literals for alias
  and undef.  [ruby-dev:47681] [Bug #8851]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 14:10:27 +00:00
nobu ea5e885a95 optimize named capture assignment
* compile.c (compile_named_capture_assign): optimize named capture
  assignments, by replacing repeating global variable accesses
  with `dup`, and by returning the matched result instead of
  re-getting it from the MatchData.

* parse.y (reg_named_capture_assign_gen): build just assignment
  nodes for the optimization.

ex. `/(?<x>.)/ =~ "bar"`

- old
  ```
  0000 putstring        "bar"
  0002 opt_regexpmatch1 /(?<x>.)/
  0004 pop
  0005 getglobal        $~
  0007 branchunless     25
  0009 getglobal        $~
  0011 putobject        :x
  0013 opt_aref         <callinfo!mid:[], argc:1, ARGS_SIMPLE>
  0016 setlocal_OP__WC__0 2
  0018 getglobal        $~
  0020 putobject_OP_INT2FIX_O_0_C_
  0021 opt_send_without_block <callinfo!mid:begin, argc:1, ARGS_SIMPLE>
  0024 leave
  0025 putobject        nil
  0027 setlocal_OP__WC__0 2
  0029 putobject        nil
  0031 leave
  ```

- new
  ```
  0000 putstring        "bar"
  0002 opt_regexpmatch1 /(?<x>.)/
  0004 getglobal        $~
  0006 dup
  0007 branchunless     14
  0009 putobject        :x
  0011 opt_aref         <callinfo!mid:[], argc:1, ARGS_SIMPLE>
  0014 setlocal_OP__WC__0 2
  0016 leave
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14 07:53:39 +00:00
nobu 3392b6c9e2 parse.y: adjust indent
* parse.y: adjust indent and tabify spaces after tabs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-13 16:26:04 +00:00
nobu cf09c0c351 iseq.h: coverage_enabled flag
* iseq.c (prepare_iseq_build): enable coverage by coverage_enabled
  option, not by parse_in_eval flag in the thread context.
* iseq.h (rb_compile_option_struct): add coverage_enabled flag.
* parse.y (yycompile0): set coverage_enabled flag if coverage
  array is made.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-10 08:34:18 +00:00
nobu 53fbaeab29 parse.y: optimize negate_lit
* parse.y (negate_lit): optimize bignum, rational, and complex
  negation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-05 01:33:04 +00:00
nobu e87d9a4346 parse.y: split nextc
* parse.y (parser_nextline, parser_cr): split less frequent paths
  from parser_nextc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-03 08:31:12 +00:00
nobu f6347e38e3 parse.y: cr_seen flag
* parse.y (parser_params): turn last_cr_line into cr_seen flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-03 07:42:32 +00:00
nobu d4819da611 parse without $.
* io.c (rb_io_gets_internal): read one line from an IO without
  setting ARGF.lineno.

* parse.y (lex_io_gets): use rb_io_gets_internal not to affect
  $. global variable.

* ruby.c (load_file): no longer reset $.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24 08:21:04 +00:00
nobu 43f7eacdac parse.y: hide compile_option
* parse.y (parser_set_compile_option_flag): hide compile_option
  hash from ObjectSpace.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24 02:42:40 +00:00
nobu 0201900d76 id.def: $~ and $_
* defs/id.def (predefined): add idLASTLINE and idBACKREF for $~
  and $_ respectively.
* parse.y: use idLASTLINE and idBACKREF instead of rb_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 12:42:00 +00:00
nobu 8b019eed78 parse.y: short circuit by result
* parse.y (parse_ident): short circuit by result, as only
  tIDENTIFIER can be a local variable, but tFID and tCONSTANT not.
  fix up r53834.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15 17:41:46 +00:00
nobu fbb51ff44c parse.y: kwarg to method with same name variable
* parse.y (parse_ident): allow keyword arguments just after a
  method where the same name local variable is defined.
  [ruby-core:73816] [Bug#12073]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15 06:44:36 +00:00
nobu 5e59be3edd parse.y: simplify local ID condition
* parse.y (tokenize_ident, parse_ident): ident in tokenize_ident()
  can be a local id only when called from parse_ident(), but never
  from parse_gvar() and parse_atmark().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15 06:06:31 +00:00
naruse 21daa56b2a * re.c: Introduce RREGEXP_PTR.
patch by dbussink.
  partially merge https://github.com/ruby/ruby/pull/497

* include/ruby/ruby.h: ditto.

* gc.c: ditto.

* ext/strscan/strscan.c: ditto.

* parse.y: ditto.

* string.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02 04:39:44 +00:00
nobu ed34d855bb parse.y: show operations on BITSTACK
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-18 11:50:06 +00:00
nobu 45acdf4df4 parse.y: escaped newline in dedenting heredoc
* parse.y (parser_here_document): an escaped newline is not an
  actual newline, and the rest part should not be dedented.
  [ruby-core:72855] [Bug #11989]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-18 05:37:48 +00:00
nobu c8348d0cfa parse.y: should not deent concatenated string
* parse.y (xstring): reset heredoc indent after dedenting,
  so that following string literal would not be dedented.
  [ruby-core:72857] [Bug #11990]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 12:16:59 +00:00
nobu 0d75b7f99e parse.y: should not deent concatenated string
* parse.y (string1): reset heredoc indent fore each string leteral
  so that concatenated string would not be dedented.
  [ruby-core:72857] [Bug #11990]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-15 07:12:46 +00:00
naruse 812c5798e2 Revert r53431 "temporally revert r53411 to debug"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04 07:59:55 +00:00
naruse 853cd40224 temporally revert r53411 to debug
http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20151225T162507Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04 07:23:25 +00:00
nobu 123313e205 parse.y: use nd_tag
* parse.y (regexp): set_yylval_num sets u1, should use nd_tag
  instead of nd_state.  [ruby-core:72638] [Bug #11932]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02 05:44:41 +00:00
naruse 9c54107903 Revert r53409 "parse.y: yylval.num should be u3"
It introduces SEGV

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02 04:39:56 +00:00
nobu 10c2251add parse.y: yylval.num should be u3
* parse.y (set_yylval_num): should be used as nd_state, set to u3.
  [ruby-core:72638] [Bug #11932]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02 02:11:09 +00:00
nobu b1796737cf parse.y: single-quote indented heredoc
* parse.y (parser_here_document): update indent for each line in
  indented here document with single-quotes.
  [ruby-core:72479] [Bug #11871]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31 20:06:22 +00:00
nobu aaf99a7607 parse.y: show_bitstack
* parse.y (show_bitstack): trace stack_type value if yydebug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 02:03:36 +00:00
kazu 2fd34fa328 fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 14:30:13 +00:00
nobu 94090b0502 deprecate exposed internal functions
* error.c (rb_compile_error_with_enc, rb_compile_error),
  (rb_compile_bug): deprecate internal functions.
* parse.y (parser_yyerror): construct exception message with
  source code and carret.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 09:43:22 +00:00
nobu 26984290eb preserve source file name encoding
* compile.c (append_compile_error), parse.y (compile_error):
  preserve encoding of source file name in exceptions.
* error.c (rb_compile_error_str, rb_compile_bug_str): add.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 08:25:44 +00:00
nobu 9d5abbff97 parse.y: labeled heredoc
* parse.y (parser_yylex): allow here documents in labeled
  argument.  [ruby-core:72396] [Bug #11849]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20 02:43:34 +00:00
nobu bfd34365b6 parse.y: fix block_call&.call
* parse.y (block_command, block_call): fix `&.` calls after
  block_call.  [Feature #11537]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 01:49:42 +00:00
nobu fcb4ab8d1c ytab.sed: for bison 2
* tool/ytab.sed: substitute `fprintf`s used directory in
  yy_reduce_print by bison 2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 06:36:50 +00:00
nobu 430082c013 parse.y: suppress warnings
* parse.y (SET_LEX_STATE): explicit cast to suppress sign-compare
  warnings in the case restoring from saved num in the parser
  stack and getting from kwtable state.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 04:47:37 +00:00
nobu d2e19fdc42 ytab.sed: replace argument
* tool/ytab.sed: substitute the first argument of YYFPRINTF, instead
  of substitution by preprocessor, not to redefine stderr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 16:54:43 +00:00
nobu a7b67cc82e ytab.sed: work around
* tool/ytab.sed: work around for platforms where vairadic macro is
  not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 15:50:44 +00:00
nobu 9d34ea9e35 parse.y: reset buffer
* parse.y (rb_parser_printf): reset debug_buffer after print out.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 15:20:20 +00:00
nobu 0f076affb6 parse.y: lex_state trace by yydebug
* parse.y (trace_lex_state): trace lex_state changes if yydebug is
  set, and send the messages to rb_stdout.
* parse.y (rb_parser_printf): store YYPRINTF messages per lines
  so that lex_state traces do not mix.
* tool/ytab.sed: add parser argument to yy_stack_print too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 14:46:09 +00:00
nobu ada76728f6 parse.y: lex_state bits
* parse.y (build_lex_state_name, trace_lex_state): lex_state is
  now bit flags and can be set 2 bits or more.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 11:41:14 +00:00
yugui 99ac392284 * parse.y (parse_percent): Allow %-literals in labeled arg as
r51624 did for parentheses.
  Fixes [ruby-core:72084] [Bug #11812].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 11:17:18 +00:00
yugui af64b09514 * parse.y (lex_state_name): Make it return the correct names.
Add new names to follow r51617; Indices ffs(2) returns are 1-origin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 10:37:52 +00:00
yugui 4e4a76e8f4 * parse.y: debug output of lex_state transition if PARSER_DEBUG
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 10:37:25 +00:00
ko1 2f5b8f0529 * *.c (*_memsize): do not check ptr.
NULL checking is finished Before call of memsize functions.
  See r52979.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 00:38:32 +00:00
nobu 9a28a29b87 parse.y: indented hereoc
* parse.y: add heredoc <<~ syntax.  [Feature #9098]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-07 14:39:52 +00:00
nobu a73f0f2cae parse.y: TAB_WIDTH
* parse.y (TAB_WIDTH, token_info_get_column): add constant for
  column calcuation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 01:25:13 +00:00
nobu 794fb41099 parse.y: dispatch heredoc end
* parse.y (ripper_dispatch_heredoc_end): at the end of here
  document, the terminator always should present.  has_scan_event
  is true.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 08:11:17 +00:00
nobu 448d1d147d parse.y: last content of heredoc
* parse.y (parser_here_document): store dispatched result of
  on_tstring_content at the last fragment of a here document.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-28 10:33:58 +00:00
nobu 6c0cf1848e parse.y: reduce ifdefs
* parse.y (dispatch_ignored_scan_event, has_delayed_token): more
  macros to reduce ifdefs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-27 02:22:57 +00:00
nobu b0fb3ff1b2 parse.y: ripper for warnings
* parse.y (parser_yylex): deal with magic comment warnings also in
  ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 07:12:56 +00:00
nobu 70d2b335f2 parse.y: fix dispatch_scan_event
* parse.y (dispatch_scan_event): fix wrong macro at r52547.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 07:12:43 +00:00