aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* remove rb_thread_t::parse_in_evalnobu2016-03-281-12/+15
| | | | | | | | | | | | * parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove SIGN_EXTEND_CHAR macronobu2016-03-231-12/+0
| | | | | | | | * marshal.c (r_long): cast to `signed char`, which is used already, instead of SIGN_EXTEND_CHAR. * parse.y: SIGN_EXTEND_CHAR is no longer used. [Fix GH-1302] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: lambda indentation checknobu2016-03-221-9/+9
| | | | | | | * parse.y (lambda_body, parser_yylex): warn mismatched indentation of lambda block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* SyntaxError message at iseq compilenobu2016-03-191-4/+37
| | | | | | | | | | | | * iseq.c (rb_iseq_compile_with_option): make the parser in mild error. * load.c (rb_load_internal0): ditto. * parse.y (yycompile0): return the error message within the error to be raised. [Feature #11951] * parse.y (parser_compile_error): accumulate error messages in the error_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: mark debug_buffernobu2016-03-181-0/+1
| | | | | | * parse.y (parser_mark): mark debug_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Fix for nth_ref_maxnobu2016-03-181-1/+1
| | | | | | | | * 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
* parse.y: symbol literals for alias/undefnobu2016-03-161-5/+7
| | | | | | | | * 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
* optimize named capture assignmentnobu2016-03-141-44/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* parse.y: adjust indentnobu2016-03-131-21/+21
| | | | | | * 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
* iseq.h: coverage_enabled flagnobu2016-03-101-1/+6
| | | | | | | | | | * 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
* parse.y: optimize negate_litnobu2016-03-051-1/+7
| | | | | | | * 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
* parse.y: split nextcnobu2016-03-031-52/+64
| | | | | | | * 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
* parse.y: cr_seen flagnobu2016-03-031-5/+5
| | | | | | * 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
* parse without $.nobu2016-02-241-1/+3
| | | | | | | | | | | | * 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
* parse.y: hide compile_optionnobu2016-02-241-1/+1
| | | | | | | * 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
* id.def: $~ and $_nobu2016-02-171-7/+7
| | | | | | | | * 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
* parse.y: short circuit by resultnobu2016-02-151-0/+1
| | | | | | | | * 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
* parse.y: kwarg to method with same name variablenobu2016-02-151-1/+1
| | | | | | | | * 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
* parse.y: simplify local ID conditionnobu2016-02-151-6/+9
| | | | | | | | * 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
* * re.c: Introduce RREGEXP_PTR.naruse2016-02-021-1/+1
| | | | | | | | | | | | | | | | | 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
* parse.y: show operations on BITSTACKnobu2016-01-181-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: escaped newline in dedenting heredocnobu2016-01-181-58/+32
| | | | | | | | * 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
* parse.y: should not deent concatenated stringnobu2016-01-161-0/+1
| | | | | | | | * 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
* parse.y: should not deent concatenated stringnobu2016-01-151-1/+1
| | | | | | | | * 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
* Revert r53431 "temporally revert r53411 to debug"naruse2016-01-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* temporally revert r53411 to debugnaruse2016-01-041-1/+1
| | | | | | 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
* parse.y: use nd_tagnobu2016-01-021-1/+1
| | | | | | | * 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
* Revert r53409 "parse.y: yylval.num should be u3"naruse2016-01-021-1/+1
| | | | | | It introduces SEGV git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: yylval.num should be u3nobu2016-01-021-1/+1
| | | | | | | * 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
* parse.y: single-quote indented heredocnobu2015-12-311-18/+35
| | | | | | | | * 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
* parse.y: show_bitstacknobu2015-12-271-18/+39
| | | | | | * 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
* fix typoskazu2015-12-241-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* deprecate exposed internal functionsnobu2015-12-241-15/+17
| | | | | | | | | * 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
* preserve source file name encodingnobu2015-12-241-5/+5
| | | | | | | | * 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
* parse.y: labeled heredocnobu2015-12-201-1/+1
| | | | | | | * 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
* parse.y: fix block_call&.callnobu2015-12-161-4/+4
| | | | | | | * 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
* ytab.sed: for bison 2nobu2015-12-141-0/+6
| | | | | | | * 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
* parse.y: suppress warningsnobu2015-12-141-4/+2
| | | | | | | | * 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
* ytab.sed: replace argumentnobu2015-12-131-7/+1
| | | | | | | * 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
* ytab.sed: work aroundnobu2015-12-131-0/+1
| | | | | | | * 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
* parse.y: reset buffernobu2015-12-131-0/+1
| | | | | | * 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
* parse.y: lex_state trace by yydebugnobu2015-12-131-25/+40
| | | | | | | | | | * 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
* parse.y: lex_state bitsnobu2015-12-131-21/+47
| | | | | | | * 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
* * parse.y (parse_percent): Allow %-literals in labeled arg asyugui2015-12-131-1/+1
| | | | | | | 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
* * parse.y (lex_state_name): Make it return the correct names.yugui2015-12-131-1/+3
| | | | | | 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
* * parse.y: debug output of lex_state transition if PARSER_DEBUGyugui2015-12-131-92/+99
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * *.c (*_memsize): do not check ptr.ko12015-12-091-1/+0
| | | | | | | | | | 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
* parse.y: indented hereocnobu2015-12-071-5/+182
| | | | | | * parse.y: add heredoc <<~ syntax. [Feature #9098] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: TAB_WIDTHnobu2015-12-011-1/+3
| | | | | | | * 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
* parse.y: dispatch heredoc endnobu2015-11-301-10/+4
| | | | | | | | * 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