summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2016-04-20error.c: SyntaxError#initializenobu
* error.c (syntax_error_initialize): move the default message, "compile error", from parse.y. the default parameter should belong to the class definition. * parse.y (yycompile0): use the default parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20refactor syntax errornobu
* compile.c (append_compile_error): use rb_syntax_error_append. * error.c (rb_syntax_error_append): append messages into a SyntaxError exception instance. * parse.y (yycompile0): make new SyntaxError instance in main mode, otherwize error_buffer should be a SyntaxError if error has occurred. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19refactor parser errornobu
* error.c (err_vcatf): rename, and separate appending message from creating a string buffer. * error.c (rb_syntax_error_append): merge rb_error_vsprintf and rb_compile_err_append. * parse.y (parser_compile_error): use rb_syntax_error_append. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13parse.y: massign in condnobu
* parse.y (assign_in_cond): allow multiple assignment in conditional expression. [Feature #10617] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-30parse.y: get rid of ISASCII on IDnobu
* parse.y (ripper_id2sym): do not call ISASCII() on ID, rb_isascii is restricted to int now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-28remove rb_thread_t::parse_in_evalnobu
* 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
2016-03-23remove SIGN_EXTEND_CHAR macronobu
* 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
2016-03-22parse.y: lambda indentation checknobu
* 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
2016-03-19SyntaxError message at iseq compilenobu
* 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
2016-03-18parse.y: mark debug_buffernobu
* parse.y (parser_mark): mark debug_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18parse.y: Fix for nth_ref_maxnobu
* 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
2016-03-16parse.y: symbol literals for alias/undefnobu
* 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
2016-03-14optimize named capture assignmentnobu
* 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
2016-03-13parse.y: adjust indentnobu
* 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
2016-03-10iseq.h: coverage_enabled flagnobu
* 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
2016-03-05parse.y: optimize negate_litnobu
* 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
2016-03-03parse.y: split nextcnobu
* 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
2016-03-03parse.y: cr_seen flagnobu
* 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
2016-02-24parse without $.nobu
* 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
2016-02-24parse.y: hide compile_optionnobu
* 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
2016-02-17id.def: $~ and $_nobu
* 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
2016-02-15parse.y: short circuit by resultnobu
* 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
2016-02-15parse.y: kwarg to method with same name variablenobu
* 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
2016-02-15parse.y: simplify local ID conditionnobu
* 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
2016-02-02* re.c: Introduce RREGEXP_PTR.naruse
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
2016-01-18parse.y: show operations on BITSTACKnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-18parse.y: escaped newline in dedenting heredocnobu
* 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
2016-01-16parse.y: should not deent concatenated stringnobu
* 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
2016-01-15parse.y: should not deent concatenated stringnobu
* 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
2016-01-04Revert r53431 "temporally revert r53411 to debug"naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04temporally revert r53411 to debugnaruse
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
2016-01-02parse.y: use nd_tagnobu
* 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
2016-01-02Revert r53409 "parse.y: yylval.num should be u3"naruse
It introduces SEGV git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02parse.y: yylval.num should be u3nobu
* 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
2015-12-31parse.y: single-quote indented heredocnobu
* 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
2015-12-27parse.y: show_bitstacknobu
* 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
2015-12-24fix typoskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24deprecate exposed internal functionsnobu
* 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
2015-12-24preserve source file name encodingnobu
* 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
2015-12-20parse.y: labeled heredocnobu
* 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
2015-12-16parse.y: fix block_call&.callnobu
* 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
2015-12-14ytab.sed: for bison 2nobu
* 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
2015-12-14parse.y: suppress warningsnobu
* 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
2015-12-13ytab.sed: replace argumentnobu
* 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
2015-12-13ytab.sed: work aroundnobu
* 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
2015-12-13parse.y: reset buffernobu
* 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
2015-12-13parse.y: lex_state trace by yydebugnobu
* 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
2015-12-13parse.y: lex_state bitsnobu
* 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
2015-12-13* parse.y (parse_percent): Allow %-literals in labeled arg asyugui
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
2015-12-13* parse.y (lex_state_name): Make it return the correct names.yugui
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