aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the internal data format for coverage measurementmame2017-09-031-3/+6
| | | | | | | | | | | To prepare new measuring targets: branch and method coverages. So far, iseq->coverage was an array of counts executed for line coverage. Now, it is a three-element array for each measuring target, whose first element is an array for line coverage. The second element is planned for branch coverage, and the third will be for method coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: primary should not be 0nobu2017-08-221-1/+1
| | | | | | | * parse.y (primary): should not be 0, since it can be a receiver. [ruby-core:82447] [Bug #13836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: unexpected tINTEGER messagenobu2017-08-171-3/+3
| | | | | | | * parse.y (parser_number_literal_suffix): keep token after numeric suffix to show the value in an error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: removed useless checknobu2017-08-151-0/+1
| | | | | | | * parse.y (singleton): literal nodes are always value expressions, no check is necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: set used flag in gettablenobu2017-08-131-16/+20
| | | | | | | | | | | * parse.y (dvar_defined_ref, dvar_defined): rename macros. only gettable uses the former. assignable should not set LVAR_USED flag. * parse.y (gettable_gen): set used flag on local/dynamic variables instead of setting in lexer. [ruby-core:82368] [Bug #13809] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* separate hash literal and keyword argumentsnobu2017-08-111-0/+1
| | | | | | | | | * compile.c (compile_array_keyword_arg): separate keyword splat inside hash literal from argument list. * parse.y (rparen): flag hash literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: simplify parse_identnobu2017-08-011-25/+8
| | | | | | | * parse.y (parse_ident): simplified selecting identifier types by the suffix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: brace after array literal argnobu2017-07-261-1/+1
| | | | | | | | | * parse.y (parser_yylex): array is another literal. set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: limit codepoint lengthnobu2017-07-251-9/+8
| | | | | | | | * parse.y (parser_tokadd_codepoint): limit Unicode codepoint length. too long codepoint has been split unexpectedly since r57050. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ripper: add kwrest_param parser eventrhe2017-07-211-0/+8
| | | | | | | | | | | | | | | * parse.y (f_kwrest): Dispatch kwrest_param event. This is especially useful for unnamed kwrest parameter for which we expose the internal ID currently. [ruby-core:75528] [Feature #12387] * test/ripper/dummyparser.rb (on_kwrest_param): Add handler for kwrest_param parser event. * test/ripper/test_parser_events.rb (test_params): Adapt to the change in DummyParser. (test_kwrest_param): Test that kwrest_param event handler is called. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: empty hash in definednobu2017-07-201-1/+1
| | | | | | | | * parse.y (command): NODE_ARRAY with NULL is invalid. traversal in defined_expr0 is simplified than iseq_compile_each0. [ruby-core:82113] [Bug #13756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: refine literal error messagesnobu2017-07-171-14/+22
| | | | | | | | | | | | | * parse.y (parser_yyerror): strip newline in error source which will not be printed, when lex_p has passed it. * parse.y (parser_tokadd_utf8): unterminated Unicode escape even after invalid Unicode escape. * parse.y (parser_parse_string): show the error source line when unterminated literal at end of file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: refine invalid Unicode escape messagenobu2017-07-161-10/+9
| | | | | | | | | | * parse.y (literal_flush): rename from numeric_literal_flush, as it is not just for numerics now. * parse.y (parser_tokadd_codepoint): show invalid character position, but not the start of Unicode escape. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (numeric_literal_flush): fix typonobu2017-07-161-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: utf-8 codepointsnobu2017-07-161-23/+38
| | | | | | | | * parse.y (parser_tokadd_utf8): skip spaces in the current line, without advancing the line, to get rid of dangling pointer. [ruby-core:82029] [Bug #13742] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: refine error messagesnobu2017-07-151-2/+5
| | | | | | | * parse.y (parser_read_escape, parser_tok_hex): refine error messages. point from the backslash up to the invalid char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: flush debug outputnobu2017-07-131-0/+1
| | | | | | | * parse.y (parser_compile_error): flush debug output before compile error message, to keep the order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: f_margs parser eventsnobu2017-07-011-6/+6
| | | | | | | * parse.y (f_margs): implemented parser events for massign formal arguments. [ruby-core:81848] [Bug #13701] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: mlhs_add_postnobu2017-07-011-6/+5
| | | | | | | * parse.y (mlhs_add_post): new parser event corresponding to POSTARG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix tokennobu2017-06-281-5/+7
| | | | | | | * parse.y (parser_parse_string): return proper token tREGEXP_END at unterminated regexp. [Bug #13363] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: add ellipsisnobu2017-06-281-21/+17
| | | | | | | * parse.y (parser_yyerror): add ellipsis properly when error line is truncated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: flush numeric tokennobu2017-06-281-0/+6
| | | | | | | * parse.y (parser_number_literal_suffix, parse_numeric): flush numeric token so following unexpected token part is marked. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix parser_yyerrornobu2017-06-281-8/+10
| | | | | | | * parse.y (parser_yyerror): fix buffer overflow at truncation of error line. [ruby-core:81790] [Bug #13687] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: prefer enum yytokentype instead to intnobu2017-06-281-23/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: line number of bin opnobu2017-06-261-1/+4
| | | | | | | * parse.y (call_bin_op_gen): adjust line number to the receiver, instead of the rhs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: mark error tokennobu2017-06-261-14/+21
| | | | | | | | | | | | | | | | | | | * parse.y (parser_yyerror): mark the whole last token which caused the error, not only the end. before: ``` if end ^ ``` after: ``` if end ^~~ ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: should not warn op method callnobu2017-06-231-3/+3
| | | | | | | * parse.y (void_expr_gen): should warn operator expression style calls only, but not method style calls. [Fix GH-1660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: check multibyte charnobu2017-06-231-7/+15
| | | | | | | | * parse.y (parser_precise_mbclen): check invalid multibyte char at skipping strings following `?x` literal string, not to stuck in a infinite loop. [ruby-core:81746] [Bug #13672] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: brace after literal argnobu2017-05-091-4/+6
| | | | | | | | | | * parse.y (symbol, dsym, parser_set_number_literal, parser_yylex): set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: do after cmdarg in parennobu2017-05-091-1/+1
| | | | | | | | | * parse.y (parser_yylex): set state to ENDARG after a string literal, so that `do` after a literal should be `do_block` and bound to the outer method, as well as a numeric/symbol literal. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: export rb_parser_fatal for rippernobu2017-05-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: make shared string modifiablenobu2017-05-041-1/+5
| | | | | | | | * parse.y (dedent_string): ensure that the string is modifiable, not to set the length of shared string. [ruby-core:80987] [Bug #13540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: set_line_body is not used in rippernobu2017-04-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix line in rescuenobu2017-04-281-3/+17
| | | | | | | * parse.y (set_line_body, primary): fix line number of bodystmt as the beginning of the block. [ruby-core:79388] [Bug #13181] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: args tail at errornobu2017-04-241-0/+1
| | | | | | | | * parse.y (new_args_tail_gen): abandon parsing arguments after error. reported by ilsani Martino Sani (ilsani) at https://hackerone.com/reports/221201 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: rb_parser_fatalnobu2017-04-241-90/+158
| | | | | | | | | * parse.y (rb_parser_fatal): abort compilation on internal parser error. rb_bug() is generic use but not useful for debugging the parser. this function dumps internal states, and continues with enabling yydebug output to stderr for the parser stack dump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Get rid of unnecessary GCC extensionnobu2017-04-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix compile_error formatnobu2017-04-221-3/+3
| | | | | | | | | * parse.y (ripper_compile_error, parser_compile_error): declare as PRINTF_ARGS attribute. * parse.y (id_is_var_gen): fix format specifier for string value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix for empty `__VA_ARGS__`nobu2017-04-171-2/+2
| | | | | | | | * parse.y (WARN_CALL, WARNING_CALL): need `##` between a comman and `__VA_ARGS__` in the case it is empty, not to end arguments with a comma. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.h: check argc to rb_funcallnobu2017-04-151-0/+8
| | | | | | | * include/ruby/ruby.h (rb_funcall): check if argc matches the number of variadic arguments, and replace with rb_funcallv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: ID for logopnobu2017-04-051-7/+7
| | | | | | * parse.y (logop): use ID instead of token values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: use idGE for tGEQnobu2017-04-041-1/+1
| | | | | | | * parse.y (arg): use ID directly for '>=' operator, without TOKEN2ID macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: share with rippernobu2017-04-041-9/+12
| | | | | | | * parse.y (rb_parser_trace_lex_state, rb_parser_show_bitstack): share with ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: flush debug buffernobu2017-04-041-7/+24
| | | | | | | * parse.y (rb_parser_trace_lex_state, rb_parser_show_bitstack): flush debug buffer before traces of lex_state and bitstack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: dot_or_colonnobu2017-03-291-10/+2
| | | | | | | * parse.y (dot_or_colon): use the default action without type casts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: unterminated content tokennobu2017-03-261-7/+6
| | | | | | | | * parse.y (parser_parse_string): defer the end token to next reading, to yield tSTRING_CONTENT with the unterminated content. [Bug #13363] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* keep line number after unterminated string literalnobu2017-03-251-1/+0
| | | | | | | | * parse.y (parser_parse_string): keep line number even after an unterminated string literal. it does not matter in the parser, ripper needs this value after this error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: relax `&' warningnobu2017-03-131-1/+6
| | | | | | | | * parse.y (parser_yylex): disable "`&' interpreted as argument prefix" warning when just followed by a symbol literal. [ruby-core:79926] [Misc #13283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: remove tracenobu2017-03-071-1/+1
| | | | | | | | * parse.y (reg_named_capture_assign_iter): do not insert trace instructions before local variable assinments. putobject is expected at first. [ruby-core:79940] [Bug #13287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* kwrest arg namenobu2017-02-271-2/+2
| | | | | | | | | | * compile.c (iseq_set_arguments_keywords): make keyword rest argument name nd_vid consistently, regardless of whether other keyword arguments are present. [Fix GH-1529] * parse.y (new_args_tail_gen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e