summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2014-05-06parse.y: no duplicated namesnobu
* parse.y (new_bv_gen): no duplicated names, if already added in shadowing_lvar(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06parse.y: remove duplicated namesnobu
* parse.y (local_tbl_gen): remove local variables duplicated with arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06parse.y: unused return valuesnobu
* parse.y (arg_var_gen, local_var_gen): make void since the result values are not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02parse.y: fix wrong static symbolnobu
* parse.y (next_id): no reason to set ID_STATIC_SYM here, as ID returned by rb_intern3 can be a dynamic symbol and the static symbol flag is set otherwise. [Bug #9787] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02parse.y: hide anonymous idnobu
* parse.y (rb_id_attrset): should not reveal anonymous ID as an instance variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02parse.y: turn dynamically interned Symbol into an IDnobu
* parse.y (rb_id_attrset): turn dynamically interned Symbol into an ID, since rb_str_dynamic_intern returns a Symbol but not an ID. [ruby-core:62226] [Bug #9787] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01parse.y: abort at inappropriate symbolnobu
* parse.y (must_be_dynamic_symbol): abort if inappropriate symbol is given, which should never happen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01parse.y: show symbol namenobu
* parse.y (must_be_dynamic_symbol): show the name if it is a static symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30parse.y: show name as possiblenobu
* parse.y (rb_id_attrset): show the name of broken ID if it is still registered. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30parse.y: raise with numeric ID typenobu
* parse.y (rb_id_attrset): all valid ID types are handled properly, raise with numeric ID type which may be broken for GCed static symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30parse.y: use rb_id2strnobu
* parse.y (rb_id_attrset): use rb_id2str to get rid of method call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30parse.y: use rb_str_ellipsizenobu
* parse.y (next_id): use rb_str_ellipsize to preserve encoding and get rid of incomplete multibyte sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30parse.y: pin down dynamic symbol onlynobu
* parse.y (rb_id_attrset): pin down dynamic symbol only. it is possibe that attrset ID can be registered as a static symbol after the corresponding attrget ID has been registered as a dynamic, and then the latter may be collected. [ruby-core:62226] [Bug #9787] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-29* parse.y (symbols_i): like r45492, call rb_gc_resurrect().ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24parse.y: resurrect dynamic symbol and namenobu
* parse.y (lookup_id_str): resurrect the dynamic symbol before accessing its content, and its name before returning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24parse.y: check for symbolnobu
* parse.y (rb_sym2id, rb_sym2id_without_pindown): reject non-symbol values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24parse.y: check for symbolnobu
* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for non-symbol values, for the time being. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24parse.y: resurrect before pindownnobu
* parse.y (rb_pin_dynamic_symbol): resurrect the dynamic symbol which may be unmarked already and swept at next time, before pindown. * parse.y (dsym_node_gen): now rb_intern_str() resurrects dynamic symbols, via lookup_sym_id() and rb_pin_dynamic_symbol(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24parse.y: trivial optimizationnobu
* parse.y (rb_str_dynamic_intern): branch by same condition as rb_id2sym to reduce unnecessary branch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-23* parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19parse.y: allow parenthesed do-block in cmdargnobu
* parse.y (primary): flush cmdarg flags inside left-paren in a command argument, to allow parenthesed do-block as an argument without arguments parentheses. [ruby-core:61950] [Bug #9726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-18parse.y: shared substring of sourcenobu
* parse.y (lex_get_str): return shared sub-string of entire source string instead of a partial copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-01* parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbolktsj
is before sweeping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30* parse.y (rb_str_dynamic_intern): [DOC] move rdoc from rb_str_intern.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28parse.y: rb_id_attrgetnobu
* parse.y (rb_id_attrget): new function to convert setter ID to getter ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27parse.y: type-punning castnobu
* parse.y (rb_gc_free_dsymbol): use intermediate st_data_t and get rid of type-punning cast. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: set encodingnobu
* parse.y (rb_str_dynamic_intern): associate proper encoding with the result symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: fix rb_str_symname_type callnobu
* parse.y (rb_str_dynamic_intern): fix the second argument to rb_str_symname_type, which is a bit mask but not a boolean. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y (rb_str_dynamic_intern): fix commit miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: guard dup stringnobu
* parse.y (rb_str_dynamic_intern): prevent a string which may be duplicated, from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: dup iff needednobu
* parse.y (rb_str_dynamic_intern): dup the given string only if needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26parse.y: no dup US-ASCII stringnobu
* parse.y (rb_str_dynamic_intern): no needs to associate encoding if it is US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y: inline must be static (for mswin).usa
fixed build error introduced at r45426. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* internal.h (USE_SYMBOL_GC): enable Symbol GC by default (USE_SYMBOL_GC == 1).nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26cast to int to silence clang compile errornari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* parse.y: support Symbol GC. [ruby-trunk Feature #9634]nari
See this ticket about Symbol GC. * include/ruby/ruby.h: Declare few functions. * rb_sym2id: almost same as old SYM2ID but support dynamic symbols. * rb_id2sym: almost same as old ID2SYM but support dynamic symbols. * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not pin down a dynamic symbol. Declare a new struct. * struct RSymbol: represents a dynamic symbol as object in Ruby's heaps. Add few macros. * STATIC_SYM_P: check a static symbol. * DYNAMIC_SYM_P: check a dynamic symbol. * RSYMBOL: cast to RSymbol * gc.c: declare RSymbol. support T_SYMBOL. * internal.h: Declare few functions. * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this function at a sweep phase. * rb_str_dynamic_intern: convert a string to a dynamic symbol. * rb_check_id_without_pindown: not pinning function. * rb_sym2id_without_pindown: ditto. * rb_check_id_cstr_without_pindown: ditto. * string.c (Init_String): String#intern and String#to_sym use rb_str_dynamic_intern. * template/id.h.tmpl: use LSB of ID as a flag for determining a static symbol, so we shift left other ruby_id_types. * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to avoid pinning. * load.c: use xx_without_pindown function at creating temporary ID to avoid pinning. * object.c: ditto. * sprintf.c: ditto. * struct.c: ditto. * thread.c: ditto. * variable.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25parse.y: required kwarg without parenthesesnobu
* parse.y (parser_yylex): only a newline after label should be significant. [ruby-core:61658] [Bug #9669] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25parse.y: required kwarg without parenthesesnobu
* parse.y (lex_state_e, parser_params, f_arglist, parser_yylex): separate EXPR_LABELARG from EXPR_BEG and let newline significant, so that required keyword argument can place at the end of argument list without parentheses. [ruby-core:61658] [Bug #9669] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25parse.y: removing paddingnobu
* parse.y (parser_params): shrink struct size by removing padding on 64-bit platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24parse.y: freeze filenamenobu
* parse.y (ripper_initialize): filename can not be modified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-07* parse.y (ENC_SINGLE): Unused macro removed.nari
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-05parse.y: optional arguments in rhsnobu
* parse.y (f_arg_asgn): define optional arguments as argument variables in the rhs default expressions. [ruby-core:61299] [Bug #9593] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26parse.y: refine error messagenobu
* parse.y (rb_check_id): refine error message, expected a symbol or a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13parse.y: attrset from junk IDnobu
* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug. * parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also attrset ID. [ruby-core:60668] [Bug #8756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05pack.c: hide associated objectsnobu
* marshal.c (to_be_skipped_id): ignore anonymous attributes. * pack.c (Init_pack): use anonymous ID so that associated objects do not appear in the packed result. * parse.y (rb_make_internal_id): return an anonymous ID for internal use. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05parse.y: symbol names must be ascii-compatiblenobu
* parse.y (rb_enc_symname_type): encoding of symbol names must be ascii-compatible, reject ascii-incompatible encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-27parse.y: save cmdarg_stack in local scopenobu
* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to isolate command argument state from outer scope. [ruby-core:59342] [Bug #9308] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25compile.c: unnamed keyword rest checknobu
* compile.c (iseq_set_arguments): set arg_keyword_check from nd_cflag, which is set by parser. internal ID is used for unnamed keyword rest argument, which should be separated from no keyword check. * iseq.c (rb_iseq_parameters): if no keyword check, keyword rest is present. * parse.y (new_args_tail_gen): set keywords check to nd_cflag, which equals to that keyword rest is not present. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08hash.c: revert r43870 and add alternative parser patch for literal keystmm1
* hash.c (hash_aset_str): revert r43870 due to performance issue [Bug #9188] [ruby-core:58730] * parse.y (assoc): convert literal string hash keys to fstrings * test/ruby/test_hash.rb (class TestHash): expand test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08parse.y: use rb_fstring() for strings stored in the symbol tabletmm1
* parse.y (register_symid_str): use fstrings in symbol table [Bug #9171] [ruby-core:58656] * parse.y (rb_id2str): ditto * string.c (rb_fstring): create frozen_strings on first usage. this allows rb_fstring() calls from the parser (before cString is created) * string.c (fstring_set_class_i): set klass on fstrings generated before cString was defined * string.c (Init_String): convert frozen_strings table to String objects after boot * ext/-test-/symbol/type.c (bug_sym_id2str): expose rb_id2str() * test/-ext-/symbol/test_type.rb (module Test_Symbol): verify symbol table entries are fstrings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e