aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* * include/ruby/util.h: removed extra semicolon in definition oftadf2012-11-211-1/+1
| | | | | | | | | | | | macro. * compile.c: ditto. * cont.c: ditto. * math.c: ditto. * node.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * probes.d: add DTrace probe declarations. [ruby-core:27448]tenderlove2012-11-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * array.c (empty_ary_alloc, ary_new): added array create DTrace probe. * compile.c (rb_insns_name): allowing DTrace probes to access instruction sequence name. * Makefile.in: translate probes.d file to appropriate header file. * common.mk: declare dependencies on the DTrace header. * configure.in: add a test for existence of DTrace. * eval.c (setup_exception): add a probe for when an exception is raised. * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. * internal.h: function declaration for compile.c change. * load.c (rb_f_load): add probes for `load` entry and exit, require entry and exit, and wrapping search_required for load path search. * object.c (rb_obj_alloc): added a probe for general object creation. * parse.y (yycompile0): added a probe around parse and compile phase. * string.c (empty_str_alloc, str_new): DTrace probes for string allocation. * test/dtrace/*: tests for DTrace probes. * vm.c (vm_invoke_proc): add probes for function return on exception raise, hash create, and instruction sequence execution. * vm_core.h: add probe declarations for function entry and exit. * vm_dump.c: add probes header file. * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org> * configure.in (isinf, isnan): isinf() and isnan() are macros on DragonFly which cannot be found by AC_REPLACE_FUNCS(). This workaround enforces the fact that they exist on DragonFly. 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org> * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo), vm_insnhelper.c (vm_search_method): revert r37616 because it's too slow. [ruby-dev:46477] * test/ruby/test_refinement.rb (test_inline_method_cache): skip the test until the bug is fixed efficiently. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (warn_balanced): use bit-wise operation.nobu2012-11-091-3/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby.c (load_file_internal): set default source encoding asnaruse2012-11-061-1/+1
| | | | | | | | | UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679] * parse.y (parser_initialize): set default parser encoding as UTF-8 instead of US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: warn static content assign in condnobu2012-10-271-15/+25
| | | | | | | | * parse.y (assign_in_cond): warn for static content object asignments in conditional statements. [ruby-dev:43083] [Feature #4299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (rb_iseq_compile_with_option): Instead of testingshyouhei2012-10-271-4/+2
| | | | | | | | | | | respond_to, just check if the argument is actually a file, because by calling user-defined gets something weired can happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861] * parse.y (ripper_initialize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: bit field lex_statenobu2012-10-271-102/+72
| | | | | | | | | * parse.y (enum lex_state_e): [EXPERIMENTAL] lex_state as bit field / IS_lex_state() macro. based on the patch by Dave B in [ruby-core:23503]. [Feature #1493] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: concatenated literalsnobu2012-10-261-1/+21
| | | | | | | | * parse.y (literal_concat_gen): merge fixed strings across concatenated literals, after an interpolation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r37316naruse2012-10-251-1/+0
| | | | | | | | | | | | | | The commit introduces too many failures and disturbs release engineering. Re-commit it with fixed tests. Thu Oct 25 13:09:01 2012 NAKAMURA Usaku <usa@ruby-lang.org> * parse.y: show a warning for concatenating string literals because it will be deprecated in the future. patched by mame (Yusuke Endoh) at [ruby-core:44207]. [ruby-core:44156] [Feature #6265] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: show a warning for concatenating string literals becauseusa2012-10-251-0/+1
| | | | | | | | | it will be deprecated in the future. patched by mame (Yusuke Endoh) at [ruby-core:44207]. [ruby-core:44156] [Feature #6265] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fail if yyerrornobu2012-10-181-7/+8
| | | | | | | | * parse.y (assignable_gen): fail if yyerror occurred. fix a bug in r36973. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: suppress warningsnobu2012-09-161-1/+1
| | | | | | * parse.y (id_type): suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: new_attr_op_assignnobu2012-09-151-78/+33
| | | | | | * parse.y (new_attr_op_assign): extract. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: new_op_assignnobu2012-09-151-72/+50
| | | | | | * parse.y (new_op_assign): extract. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: switchnobu2012-09-151-46/+39
| | | | | | | * parse.y (gettable_gen, assignable_gen): rewrite sequential if-else as switch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: static tablenobu2012-09-151-14/+8
| | | | | | * parse.y (lex_state_name): use static table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_warn4S): renamed from rb_warn4(), because the case inusa2012-09-051-7/+3
| | | | | | | | | | | r36911 takes a string. * parse.y (rb_warn4S): use ripper_warnS() for ripper. * parse.y (ripper_warnS): now it is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_warn4): added as a rb_warn variant to warn with explicitnaruse2012-09-051-1/+3
| | | | | | | | source file name and line in parse.y. * parse.y (warn_unused_var): use rb_warn4 to suppress warning on ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* id.h: independent from parse.hnobu2012-08-311-21/+21
| | | | | | | * template/id.h.tmpl, tool/id2token.rb: make id.h independent from parse.h, and make parse.c dependent on it instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: extract functionnobu2012-08-251-20/+28
| | | | | | * parse.y (new_args_tail_gen): extract from dsym rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce flonum technique forko12012-08-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 64bit CPU environment (sizeof(double) == sizeof(VALUE)). flonum technique enables to avoid double object creation if the double value d is in range about between 1.72723e-77 < |d| <= 1.15792e+77 or 0.0. flonum Float value is immediate and their lowest two bits are b10. If flonum is activated, then USE_FLONUM macro is 1. I'll write detailed in this technique on https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech * benchmark/bmx_temp.rb: add an benchmark for simple Float calculation. * gc.c (id2ref, rb_obj_id): add flonum Float support. * include/ruby/intern.h: move decl of rb_float_new(double) to include/ruby/ruby.h. * insns.def, vm.c, vm_insnhelper.c: add flonum optimization and simplify source code. * vm_insnhelper.h (FLONUM_2_P): added. * marshal.c: support flonum output. * numeric.c (rb_float_new_in_heap): added. * parse.y: support flonum. * random.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: token namenobu2012-08-201-27/+33
| | | | | | * parse.y: more descriptive token names in syntax error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* id.h.tmpl: preserved idsnobu2012-08-171-16/+1
| | | | | | * template/id.h.tmpl (preserved_ids): move from parse.y. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_trace.c, vm_core.h: simplify tracing mechanism.ko12012-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) add rb_hook_list_t data structure which includes hooks, events (flag) and `need_clean' flag. If the last flag is true, then clean the hooks list. In other words, deleted hooks are contained by `hooks'. Cleanup process should run before traversing the list. (2) Change check mechanism See EXEC_EVENT_HOOK() in vm_core.h. (3) Add `raw' hooks APIs Normal hooks are guarded from exception by rb_protect(). However, this protection is overhead for too simple functions which never cause exceptions. `raw' hooks are executed without protection and faster. Now, we only provide registration APIs. All `raw' hooks are kicked under protection (same as normal hooks). * include/ruby/ruby.h: remove internal data definition and macros. * internal.h (ruby_suppress_tracing), vm_trace.c: rename ruby_suppress_tracing() to rb_suppress_tracing() and remove unused function parameter. * parse.y: fix to use renamed rb_suppress_tracing(). * thread.c (thread_create_core): no need to set RUBY_VM_VM. * vm.c (mark_event_hooks): move definition to vm_trace.c. * vm.c (ruby_vm_event_flags): add a global variable. This global variable represents all of Threads and VM's event masks (T1#events | T2#events | ... | VM#events). You can check the possibility kick trace func or not with ruby_vm_event_flags. ruby_vm_event_flags is maintained by vm_trace.c. * cont.c (fiber_switch, rb_cont_call): restore tracing status. [Feature #4347] * test/ruby/test_continuation.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: added symbols and qsymbols productions for %i and %Itenderlove2012-07-241-2/+96
| | | | | | | | | | | | | | | | support. %i{ .. } returns a list of symbols without interpolation, %I{ .. } returns a list of symbols with interpolation. Thanks to Josh Susser for inspiration of this feature. [Feature #4985] * ext/ripper/eventids2.c: added ripper events for %i and %I. * test/ripper/test_parser_events.rb: ripper tests * test/ripper/test_scanner_events.rb: ditto * test/ruby/test_array.rb: test for %i and %I behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove garbage spacesnobu2012-07-201-3/+4
| | | | | | | * insns.def, parse.y: remove garbage spaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (primary): allow an empty grouped expression as theshugo2012-07-181-1/+8
| | | | | | | | | | | | operand of the not operator (e.g., not ()). [ruby-core:45976] [Bug #6674] * parse.y (parser_yylex): show no warning for a grouped expression as the operand of the not operator (e.g., not (a)) or as an argument of a method call without parentheses (e.g., foo (a)). [ruby-core:39050] [Bug #5214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [Feature #6693]nobu2012-07-071-2/+13
| | | | | | | * parse.y (shadowing_lvar_gen, warn_unused_var): no warnings for variables starting with _. [ruby-core:46160][Feature #6693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix GC problem of keyword rest argumentnobu2012-06-211-1/+4
| | | | | | | | | | * parse.y (new_args_tail_gen): fix GC problem of keyword rest argument. the wrapped struct should be bound to the wrapping node before assignment of child nodes, to get rid of the case the children are referred by only the struct pointer which is not a subject of GC. [ruby-core:45744] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Bug #6403: reset states after empty argsnobu2012-05-141-0/+2
| | | | | | | | | * parse.y (f_arglist): should reset lexical states after empty argument list with no parenthesis as well as parenthesized list, so that reserved name method definition work. [ruby-dev:45626] [Bug #6403] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Bug #6419: fix cmdarg beginnobu2012-05-111-0/+3
| | | | | | | | * parse.y (primary): begin/end block should be isolated from outside. [ruby-dev:45631][Bug #6419] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: debugging stuffnobu2012-05-101-0/+32
| | | | | | | | * parse.y (lex_state_name): returns name for lex_state_e, for debug use. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yylex): allow spaces between lambda arrow andnobu2012-05-021-1/+1
| | | | | | | parenthesis. [ruby-dev:45605][Feature #6390] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (assoc, parser_yylex): add syntax to splat keyword hash.nobu2012-04-281-2/+30
| | | | | | | | | | [ruby-core:44591][Feature #6353] * compile.c (compile_array_): generate keyword splat insns. * vm.c (m_core_hash_merge_kwd): merge keyword hash into intermediate hash. leftward argument is prior currently. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yylex): EXPR_BEG by keywords is a start point ofnobu2012-04-241-1/+8
| | | | | | | | | | commands. [ruby-dev:45563][Bug #6347] * parse.y (superclass): ditto for superclass. * parse.y (parser_parse_string, parser_here_document): ditto for string interpolation. * parse.y (parser_yylex): ditto for singleton class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (primary): remove wrong "fixpos" that caused incorrectmame2012-04-231-2/+0
| | | | | | | | source_location of blocks. [ruby-core:42232] [Bug #5930] * test/ruby/test_proc.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (compile_array, compile_array_):ko12012-04-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Divide big array (or hash) literals into several blocks and concatetene them. There was a problem that a big array (hash) literal causes SystemStackError exception (stack overflow) because VM push all contents of the literal onto VM stack to make an array (or hash). To solve this issue, we make several arrays (hashes) and concatenate them to make a big array (hash) object. ?? * compile.c (iseq_compile_each, setup_args): use modified compile_array. * vm.c (m_core_hash_from_ary, m_core_hash_merge_ary, m_core_hash_merge_ptr): added for above change. * id.c (Init_id), parse.y: add core method ids. * bootstraptest/test_literal.rb: add simple tests. * bootstraptest/test_eval.rb: remove rescue clause to catch SystemStackError exception. * test/ruby/test_literal.rb: add tests to check no stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_check_id_cstr): new function to check if ID isnobu2012-04-111-0/+28
| | | | | | | registered with NUL-terminated C string. * sprintf.c (rb_str_format): avoid inadvertent symbol creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (string_content, parser_yylex): count brace nesting tonobu2012-04-091-5/+17
| | | | | | dispatch embexpr_end. [ruby-core:43775][Bug #6211] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix unreachable warning line numbernobu2012-03-161-1/+1
| | | | | | | * parse.y (block_append_gen): fix unreachable warning line number. should warn at the code, not jump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yylex): fix warning line number.nobu2012-03-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (sym_check_asciionly): check ascii compatibility beforenobu2012-03-151-18/+17
| | | | | | | | | scanning for code range. * parse.y (intern_str): set to us-ascii if ascii only. [ruby-dev:45363][Bug #6146] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix rippernobu2012-03-131-13/+16
| | | | | | * parse.y (new_args_gen, new_args_tail_gen): fix ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_set_arguments): keyword rest arg without keyword args.nobu2012-03-131-630/+140
| | | | | | | | | | * node.c (dump_node): dump kw_rest_arg too. * parse.y (block_param, f_arg): more kwrest patterns. [ruby-core:42455][Bug #5989] * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (block_param, f_args): add rules for the case argumentsnobu2012-03-131-0/+16
| | | | | | begin with kwrest. [ruby-core:42455][Bug #5989] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h (NEW_YIELD), parse.y (new_yield_gen): array-values flagsnobu2012-03-121-13/+4
| | | | | | | has been already obsolete. patch by Thomas Enebo. [ruby-core:41929][Bug #5847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokadd_string): escape simple regexp metanobu2012-03-061-1/+13
| | | | | | character termninators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (block_call): rules for block_call after block_call.nobu2012-03-051-0/+24
| | | | | | | based on a patch by pasberth https://github.com/ruby/ruby/pull/102 [ruby-dev:45308][Bug #6115] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (block_command, block_call): simplified rules.nobu2012-03-051-22/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokadd_string): regexp engine doesn't neednobu2012-03-041-0/+4
| | | | | | terminators to be escaped. [ruby-core:40364][Bug #5484] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e