aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
...
* * parse.y (parser_yylex): should clear parser->tokp as well.matz2007-11-191-31/+25
| | | | | | | | | | | | | | [ruby-dev:32250] * parse.y: remove NEED_ASSOC that break test_parser_events. * parse.y (parser_yylex): should not decrement line numbers at the end of file. * file.c (rb_find_file_ext): search .rb files first through in the loadpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_read_escape): disallow control and meta modifiersnobu2007-11-181-2/+2
| | | | | | | for non-ASCII characters. [ruby-core:13685] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce 2 macros:ko12007-11-131-2/+2
| | | | | | | | | | | | | | | RFLOAT_VALUE(v), DOUBLE2NUM(dbl). Rename RFloat#value -> RFloat#double_value. Do not touch RFloat#double_value directly. * bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c, pack.c, parse.y, process.c, random.c, sprintf.c, string.c, time.c: apply above changes. * ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk (parse.c), ext/ripper/depend (ripper.c): process afternobu2007-11-131-32/+41
| | | | | | | | | | | | | | | | | | | | | bison with sed. [ruby-dev:32204] * ruby.c (proc_options): use yydebug in cmdline_options. * ruby.c (process_options): set yydebug flag of parser. * parse.y (yydebug): moved into struct parser_params. * parse.y (rb_parser_get_yydebug, rb_parser_set_yydebug): parser generic methods. * */Makefile.sub (parse.c): moved to common.mk. * tool/ytab.sed: comment out yydebug definition, and substitute yyerror with parser_yyerror. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: use ASCII encoding for string literals that aredavidflanagan2007-11-101-0/+14
| | | | | | | | 7-bit clean, fixing regression from my previous patch git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_nextc): added single line read forward buffer.nobu2007-11-091-15/+20
| | | | | | | * parse.y (parser_yylex): adjust line number for fluent interface. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: fix segfault with \x escapes in regexpsdavidflanagan2007-11-081-58/+0
| | | | | | | delete unused #if 0 code regions from previous patch git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_read_escape): remove C99/gcc-ism.usa2007-11-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: patch, based on Nobu's, work to support \u escapesdavidflanagan2007-11-071-81/+331
| | | | | | | | | | also modifications for better coderange detection * test/ruby/test_unicode_escapes.rb: test cases * test/ruby/test_mixed_unicode_escapes.rb: mixed encoding test cases git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_intern3): commented out broken code that preventeddavidflanagan2007-11-071-0/+16
| | | | | | | | | correct interning of multi-byte symbols. Without this patch :x==:x is false when x is a multi-byte character. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (call_args): remove "parenthesize argument(s) for futurematz2007-11-041-1/+0
| | | | | | | | version" warning. when I added this warning, I had a plan to reimplement the parser that is simpler than the current one. since we abandoned the plan, warning no longer required. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (bvar): block-local variable can shadow outer variable.nobu2007-10-291-3/+10
| | | | | | | [ruby-core:13036] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * misc/ruby-style.el (ruby-style-{case,label}-indent): adjust fornobu2007-10-261-9/+9
| | | | | | | labels inside switch block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yylex): dot at the head of the line denote linematz2007-10-251-0/+19
| | | | | | | | | continuation from previous one to support fluent interface. [experimental] * misc/ruby-mode.el (ruby-calculate-indent): support fluent dot. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokspace): increment tokidxdavidflanagan2007-10-251-4/+4
| | | | | | | fixes test failure at [test/ruby/test_stringchar.rb:72] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_tokspace): make space in token buffer.nobu2007-10-241-7/+23
| | | | | | | * parse.y (parser_yylex): fix encoding of single character literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (call_args2): nd_head of NODE_BLOCK_PASS should be a list.nobu2007-10-231-1/+1
| | | | | | | [ruby-core:12850] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_regx_options, reg_compile_gen): relaxened encodingnobu2007-10-191-13/+27
| | | | | | | | | | | | | | matching rule. * re.c (rb_reg_initialize): always set encoding of Regexp. * re.c (rb_reg_initialize_str): fix enconding for non 7bit-clean strings. * re.c (rb_reg_initialize_m): use ascii encoding for 'n' option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_primary_encoding): added Encoding.primary_encoding.nobu2007-10-161-0/+16
| | | | | | | | | | | | | | | | | * parse.y (rb_parser_encoding): added. * ruby.c (proc_options): added -E and --encoding options. * ruby.c (process_options): set primary encoding from command line option if set, or source encoding. * include/ruby/encoding.h (rb_enc_from_encoding, rb_get_primary_encoding, rb_set_primary_encoding): prototypes. * include/ruby/node.h (rb_parser_encoding): prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_regx_options): check if regexp encoding optionnobu2007-10-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | matches to current encoding. * re.c (char_to_option, rb_char_to_option_kcode): 'n' is not kcode option now. * re.c (rb_reg_to_s, rb_reg_error_desc): copy encoding rather than append as an option. * re.c (make_regexp, rb_reg_prepare_re): use encoding of Regexp and String instead of kcode. * re.c (rb_reg_initialize): set fixed option if none is set. * re.c (rb_reg_regcomp): ditto. * re.c (rb_reg_equal): check if encodings are equal. * re.c (rb_reg_initialize_m): encoding option is obsolete. * re.c (rb_kcode, rb_get_kcode, rb_set_kcode): removed. * re.c (Init_Regexp): removed Regexp#kcode method. * ruby.c (proc_options): allow long encoding name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (set_file_encoding): case-insensitive search, a patch fromnobu2007-10-131-6/+6
| | | | | | | David Flanagan <david AT davidflanagan.com> [ruby-core:12629] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: encoding specifier should work if the line matchesmatz2007-10-121-7/+1
| | | | | | | /coding[:=] ?/, a la Python PEP-263, so that VIM comments like "# vim: set fileencoding=<encoding name>" should be recognized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * trunk/parse.y (magic_comments): add "encoding" as same as "coding".nobu2007-10-121-18/+71
| | | | | | | | | * trunk/parse.y (set_file_encoding): special file encoding handling. * trunk/parse.y (parser_yylex): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_read_escape, parser_tokadd_escape): check code range.usa2007-10-091-29/+28
| | | | | | | [ruby-dev:31980] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (STR_NEW3): check for if single byte sequence.nobu2007-10-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (reg_compile_gen): copy encoding from source string ifnobu2007-10-041-1/+1
| | | | | | | non-empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (reg_compile_gen): copy encoding from source string.nobu2007-10-041-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_str_new, parser_yylex, rb_intern3): set code-rangenobu2007-10-031-19/+63
| | | | | | | | | | | | | bits. * parse.y (parser_tokadd_string): check code-range. * parse.y (parser_parse_string, parser_here_document): ditto. * parse.y (parser_set_encode): check if valid encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_fdopen): create IO object from fd.nobu2007-09-281-4/+1
| | | | | | | | | * parse.y (yycompile): use encoding of the source as default. * ruby.c (proc_options, load_file): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (strings, xstring, regexp, dsym): empty strings havenobu2007-09-271-6/+7
| | | | | | | US-ASCII encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_associate_index): deal with ASCII compatiblenobu2007-09-261-1/+8
| | | | | | | | | | | | | | | | | | | | flags. * encoding.c (rb_enc_check): allow ASCII compatible strings. * parse.y (rb_intern_str): use ASCII encoding for ASCII string. * string.c (rb_enc_str_coderange): check for code-range. * string.c (rb_str_modify): clear code-range flags. * string.c (rb_str_hash, rb_str_eql): ASCII compatible strings are comparable. * include/ruby/encoding.h: added code-range flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_check): check for ASCII-compatibilities.nobu2007-09-261-40/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y (parser_tokadd_string, parser_parse_string, parser_here_document, parser_yylex): set encoding to US-ASCII. * parse.y (rb_enc_symname_p): check if valid with encoding. * parse.y (rb_intern3): let symbols have encoding. * string.c (rb_str_hash): add encoding index. * string.c (rb_str_comparable, rb_str_equal, rb_str_eql): check if compatible encoding. * string.c (sym_inspect): made encoding aware. * insns.def (opt_eq): compare with encoding. * include/ruby/encoding.h (rb_enc_asciicompat): check if ASCII compatible. * include/ruby/encoding.h (rb_enc_get_index): added prototype. * include/ruby/intern.h (rb_str_comparable, rb_str_equal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_yyerror): limit error message length.nobu2007-09-251-2/+16
| | | | | | | [ruby-dev:31848] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_method.ci (rb_attr): should not use alloca for unknowen sizenobu2007-09-221-1/+3
| | | | | | | | | input. [ruby-dev:31816] * parse.y (rb_intern_str): prevent str from optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (ripper): rename event: arglist_* -> args_*.aamine2007-09-171-65/+71
| | | | | | | | | | | | | * parse.y (ripper): rename event: restparam -> rest_param. * parse.y (ripper): rename event: constpath_* -> const_path_*. * parse.y (ripper): rename event: topconst_* -> top_const_*. * parse.y (ripper): rename event: iter_block -> method_add_block. * parse.y (ripper): support block local parameter declaration. * parse.y (ripper): introduce new macro params_new. * ext/ripper/lib/ripper/sexp.rb: should not dispose event arguments whose name ends with "_new" but arity != 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (struct parser_params): common members in the parser andnobu2007-09-151-2/+1
| | | | | | | ripper must be placed at each same location. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_initialize): set default encoding. [ruby-dev:31787]nobu2007-09-151-1/+1
| | | | | | | | * ruby.c (load_file): make new parse instance after processing shebang line options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (brace_block): should use compstmt. patch submitted bynobu2007-09-131-1/+1
| | | | | | | Kirill A. Shutemov <k.shutemov AT gmail.com> [ruby-core:12154]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_id2str): fixed typo.nobu2007-09-131-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_sysopen): should not use alloca for unknowen sizenobu2007-09-121-12/+8
| | | | | | | | | | | input. [ruby-dev:31775] * parse.y (rb_id2str): ditto. * marshal.c (w_float): use snprintf instead of sprintf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_cycle): typo in rdoc. a patch from Yuguimatz2007-09-061-13/+16
| | | | | | <yugui@yugui.sakura.ne.jp>. [ruby-dev:31748] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (f_norm_arg, f_arg_item): not croak already erred names.nobu2007-08-301-2/+2
| | | | | | | [ruby-dev:31687] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (assignable_gen): ignore already erred names.nobu2007-08-301-2/+4
| | | | | | | | * parse.y (shadowing_lvar_gen): always make new block local variable when shadowing outer local variable. [ruby-dev:31507] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (aref_args): args may not be a list. [ruby-dev:31592]nobu2007-08-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_prepare): set parser encode too when BOM exists.nobu2007-08-281-3/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y, re.c: re-applied revision 13092.nobu2007-08-251-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-90/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c, insns.def, parse.y: fix massign order. This changeko12007-08-231-1/+1
| | | | | | | | | | | | | causes performance problem. Try vm1_swap benchmark. [ruby-dev:31522] * insns.def, insnhelper.ci: move process body of expandarray insn to vm_expandarray(). * bootstraptest/test_knownbug.rb, bootstraptest/test_massign.rb: move a solved test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (f_norm_arg): ripper has no shadowing check.nobu2007-08-231-1/+4
| | | | | | | * parse.y (f_block_arg): dispatch blkarg_mark. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (f_norm_arg): check also nested arguments. [ruby-dev:31502]nobu2007-08-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e