aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* * parse.y (ENC_SINGLE): Unused macro removed.nari2014-03-071-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: optional arguments in rhsnobu2014-03-051-6/+10
| | | | | | | | * 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
* parse.y: refine error messagenobu2014-02-261-1/+1
| | | | | | | * 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
* parse.y: attrset from junk IDnobu2014-02-131-2/+3
| | | | | | | | * 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
* pack.c: hide associated objectsnobu2014-02-051-2/+18
| | | | | | | | | | | * 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
* parse.y: symbol names must be ascii-compatiblenobu2014-02-051-0/+1
| | | | | | | * 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
* parse.y: save cmdarg_stack in local scopenobu2013-12-271-0/+4
| | | | | | | | * 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
* compile.c: unnamed keyword rest checknobu2013-12-251-1/+6
| | | | | | | | | | | | | * 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
* hash.c: revert r43870 and add alternative parser patch for literal keystmm12013-12-081-0/+4
| | | | | | | | | * 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
* parse.y: use rb_fstring() for strings stored in the symbol tabletmm12013-12-081-0/+3
| | | | | | | | | | | | | | | | | * 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
* * parse.y (rb_gc_mark_symbols): set global_symbols.minor_marked onlyko12013-11-201-1/+2
| | | | | | | | | | when full_mark is 0. rb_gc_mark_symbols() (with full_mark == 1) can be called by other than GC (such as rb_objspace_reachable_objects_from_root()). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: remove "f" suffix [ruby-core:57966] [Feature #9042]nobu2013-11-101-95/+8
| | | | | | | | | | | | | | | | | | | | | | revert r42847 "test_string.rb: add test string encoding" revert r42846 "parse.y: freeze in advance to reduce objects" revert r42843 "parse.y: deduplicate frozen string literals" revert r42780 "test_string.rb: yet another test" revert r42779 "parse.y: valid suffix word only" revert r42778 "test_string.rb: remove duplicated code" revert r42775 "parse.y: force_encoding" This reverts commit 93ea04ecec7639ca8d0e58948e78461434782ecc. revert r42773 "Add frozen string literals" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko12013-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: Remove +(binary) and -(binary) special cases [Feature #9048]marcandre2013-10-241-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h, parse.y: use `full_mark' instead of `full_marking'.ko12013-10-111-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, parse.y: support generational Symbol relatetd marking.ko12013-10-111-4/+11
| | | | | | | | | | | | | | | | | Each symbols has String objects respectively to represent Symbols. These objects are marked only when: * full marking * new symbols are added This hack reduce symbols (related strings) marking time. For example, on my Linux environment, the following code "20_000_000.times{''}" with 40k symbols (similar symbol number on Rails 3.2.14 app, @jugyo tells me) boosts, from 7.3sec to 4.2sec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: allow junk attrsetnobu2013-09-291-2/+2
| | | | | | | * parse.y (rb_id_attrset, intern_str): allow junk attrset ID for Struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix inconsistency with literalsnobu2013-09-291-4/+10
| | | | | | | | * parse.y (rb_id_attrset): fix inconsistency with literals, allow ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET. and raise a NameError instead of rb_bug() for invalid argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: junk sigil only namesnobu2013-09-201-1/+8
| | | | | | | | * parse.y (intern_str): sigil only names are junk, at least one identifier character is needed. [ruby-dev:47723] [Bug #8928] * parse.y (rb_enc_symname_type): fix out of bound access. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: adjust position of lambdanobu2013-09-191-2/+6
| | | | | | * parse.y (lambda): adjust position to the beginning of the block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: duplicate codenobu2013-09-191-4/+0
| | | | | | * parse.y (f_larglist): remove duplicate code in ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: reduce objects in rb_fstringnobu2013-09-051-0/+1
| | | | | | | | | * string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE. * string.c (rb_fstring): get rid of duplicating already frozen object. * parse.y (str_suffix_gen): freeze in advance to reduce objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: add RSTRING_FSTR flagcharliesome2013-09-051-1/+1
| | | | | | | | | | | | * internal.h: add rb_fstring() prototype * parse.y (str_suffix_gen): deduplicate frozen string literals * string.c (rb_fstring): deduplicate frozen string literals * string.c (rb_str_free): delete fstrings from frozen_strings table when they are GC'd * string.c (Init_String): initialize frozen_strings table * test/ruby/test_string.rb: test frozen strings are deduplicated git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: valid suffix word onlynobu2013-09-021-10/+3
| | | | | | | * parse.y (parser_str_options): use valid suffix word only, as well as numeric literal, for the backward comatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: force_encodingnobu2013-09-021-3/+5
| | | | | | | * parse.y (str_suffix_gen): String#b creates new string object, use force_encoding instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * NEWS: Add note about frozen string literalscharliesome2013-09-021-8/+99
| | | | | | | | | | | | | | | | | * compile.c (case_when_optimizable_literal): optimize NODE_LIT strings in when clauses of case statements * ext/ripper/eventids2.c: add tSTRING_SUFFIX * parse.y: add 'f' suffix on string literals for frozen strings * test/ripper/test_scanner_events.rb: add scanner tests * test/ruby/test_string.rb: add frozen string tests [Feature #8579] [ruby-core:55699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typo of r42691eregon2013-08-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: warn CRnobu2013-08-261-3/+12
| | | | | | | * parse.y (parser_nextc): warn carriage return in middle of line. [ruby-core:56240] [Feature #8699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typoskazu2013-08-161-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: simplifynobu2013-08-151-12/+16
| | | | | | | | * parse.y (f_label): extract from f_kw and f_block_kw. * parse.y (f_opt, f_block_opt): use f_norm_arg to simlify actions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: CR in middlenobu2013-08-121-1/+5
| | | | | | | * parse.y (parser_whole_match_p): treat CR in middle of a line as a mere whitespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: non-local/const attrsetnobu2013-08-111-13/+16
| | | | | | | * parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE, ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: non-local/const attrsetnobu2013-08-101-21/+31
| | | | | | | | * parse.y (rb_id_attrset): allow other than ID_ATTRSET. * parse.y (intern_str): ditto. try stem ID for ID_INSTANCE, ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: check for attrnobu2013-08-101-0/+22
| | | | | | | * parse.y (rb_id_attrset): check if the argument is valid type as an attribute. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: no reduction with 1nobu2013-08-031-1/+1
| | | | | | | * parse.y (parser_set_integer_literal): use rb_rational_raw1() for integral rational because no reduction is needed with 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (value_expr_gen): now NODE_DEFN and NODE_DEFS are not voidusa2013-08-021-5/+0
| | | | | | | | value expressions. get rid of wrong warning with -w, and make to pass tests with chkbuild. ref. [Feature #3753] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: calculate powers of tennobu2013-08-021-3/+1
| | | | | | | * parse.y (parser_yylex): calculate denominator directly as powers of ten, not parsing string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: ripper for new literalsnobu2013-08-021-1/+3
| | | | | | | * parse.y (ripper_validate_object): ripper support for new literals, tRATIONAL and tIMAGINARY. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: parse preciselynobu2013-08-021-58/+80
| | | | | | | | | | | | * parse.y (parser_number_literal_suffix): return bit set of found suffixes. * parse.y (parser_set_number_literal, parser_set_integer_literal): split from parser_number_literal_suffix to set yyvlal. * parse.y (parser_yylex): parse rational number literal with decimal point precisely. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: simplify numericsnobu2013-08-021-58/+10
| | | | | | | | * parse.y (simple_numeric): integrate numeric literals and simplify numeric rules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (negate_lit): add T_RATIONAL and T_COMPLEX to the switchcharliesome2013-08-021-0/+3
| | | | | | | | | statement, and call rb_bug() if an unknown type is passed to negate_lit(). [ruby-core:56316] [Bug #8717] * bootstraptest/test_literal_suffix.rb (assert_equal): add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (rb_flt_rationalize_with_prec): new public C functionmrkn2013-08-011-31/+120
| | | | | | | | | | | | | | | | | | | to rationalize a Float instance with a precision. * rational.c (rb_flt_rationalize): new public C function to rationalize a Float instance. A precision is calculated from the given float number. * include/ruby/intern.h: Add rb_flt_rationalize_with_prec and rb_flt_rationalize. * parse.y: implement number literal suffixes, 'r' and 'i'. [ruby-core:55096] [Feature #8430] * bootstraptest/test_literal_suffix.rb: add tests for parser to scan number literals with the above tsuffixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: fix build error with bison-3.0.kazu2013-07-311-3/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y, vm_eval.c: file encoding in evalnobu2013-07-291-27/+30
| | | | | | | | | | | | | | * parse.y (yycompile): store file name as String to keep the encoding. * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path): new functions to pass file name as a String. * parse.y (gettable_gen): return a copy of the original file name, not a copy in filesystem encoding. * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: separate numeric literalnobu2013-07-261-5/+9
| | | | | | | | * parse.y (parser_yylex): separate numeric literal from succeeding token, and treat 'e' as floating point number only if followed by exponent part. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (make_name_for_block): use PRIsVALUE in format stringcharliesome2013-06-241-4/+3
| | | | | | | | | | | | | | | | instead of %s and RSTRING_PTR to protect objects from being garbage collected too soon * encoding.c (str_to_encindex): ditto * hash.c (rb_hash_fetch_m): ditto * io.c (rb_io_reopen): ditto * parse.y (reg_fragment_check_gen): ditto * parse.y (reg_compile_gen): ditto * parse.y (ripper_assert_Qundef): ditto * re.c (rb_reg_raise): ditto * ruby.c (set_option_encoding_once): ditto * vm_eval.c (rb_throw_obj): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: clear lex_strtermnobu2013-06-181-1/+1
| | | | | | | | * parse.y (parser_heredoc_restore): clear lex_strterm always to get rid of marking recycled node. this bug is revealed by r41372 with GC.stress=true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: non-shady ruby_debug_linesnobu2013-06-121-3/+3
| | | | | | | * parse.y (parser_set_encode): get rid of making ruby_debug_lines non-shady. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (numberof): Gathered from various files.akr2013-06-071-2/+0
| | | | | | | | | | * array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fill rdocsnobu2013-06-021-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e