Граф коммитов

1465 Коммитов

Автор SHA1 Сообщение Дата
nobu c1c3d07332 parse.y: relop
* parse.y (relop): extract to simplify comparisons.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-18 13:08:53 +00:00
nobu 72c96011ea parse.y: token info with BOM
* parse.y (parser_prepare): set token_info_enabled flag first,
  before returning at BOM.  [ruby-dev:50288] [Bug #13998]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-11 05:34:24 +00:00
nobu 838a91633c parse.y: fix a typo
* parse.y (f_kw): fix typo.  needs the argument value, not the
  label twice.  [ruby-core:83174] [Bug #13987]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 06:00:57 +00:00
nobu 80855409ce parse.y: fix KWD2EID
* parse.y (KWD2EID): should respect the previous callback result
  for keywords.  [ruby-core:83106] [Bug #13971]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-05 01:53:22 +00:00
nobu 2afb729f57 parse.y: fix var_field
* parse.y (mlhs_node): dispatch var_field as well as lhs.

* parse.y (lhs, var_hs): dispatch var_field before assignable
  check so it is inside assign_error at a wrong assignment, as
  well as backref_assign_error.

* parse.y (var_field_gen): wrap var_field value with the variable
  ID.

* parse.y (assignable_gen, const_decl_gen): return the callback
  result on a syntax error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-04 06:47:29 +00:00
nobu 3be412834d parse.y: reserved words as <id>
* parse.y (reswords): declare reserved words as <id> to remove
  extra cast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-04 05:48:33 +00:00
nobu 8e03b79e06 parse.y: Revert r60102
* parse.y (op): do not set event ID here to dispatch on_op.
  [ruby-core:83089] [Bug #13967]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-04 04:43:00 +00:00
nobu 1ef2ca5a96 parse.y: extract callback results
* parse.y: stripping wrapping NODEs from ripper callback results,
  when storing in Array objects.  NODEs must not appear in Ruby
  level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-03 04:56:23 +00:00
nobu 75318f312d parse.y: set ripper event IDs to keyword variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-03 04:47:13 +00:00
nobu e8e5a45020 parse.y: set ripper event ID symbols to operators
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-03 01:38:52 +00:00
nobu 1852b4a866 ext: check if null byte is contained
[ruby-dev:50267] [Bug #13953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-30 08:35:23 +00:00
nobu fbb9e6c1eb parse.y: moved duplicate conditions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-26 13:40:14 +00:00
nobu 80aa804a33 parse.y: token type by identifer ID type
* parse.y (parse_ident): leave identifier type decision (local or
  const) to rb_enc_symname_type, and set the token type by ID
  type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-23 06:49:35 +00:00
nobu 5983fd75f2 parse.y: missing semicolon
* parse.y (stmt_or_begin): fix missing semicolon.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-23 06:49:34 +00:00
nobu 5da2f77b93 parse.y: literal term lex_state
* parse.y (parser_string_term, parser_parse_string): move setting
  lex_state operations from parser_yylex per each token types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20 08:38:52 +00:00
nobu 50f7d64f41 parse.y: lex by lvar
* parse.y (parse_ident): disable tLPAREN_ARG state by local
  variable.  [ruby-list:50578]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19 00:22:56 +00:00
nobu d1e63172c6 parse.y: ripper_lex_state_name
* parse.y (ripper_lex_state_name): represent lex_state as OR-ed
  form.

* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer::Elem#to_a):
  lex_state for inspection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18 00:08:19 +00:00
nobu f22345427a parse.y: use SET_LEX_STATE
* parse.y (f_arglist, parser_yylex): set lex_state via
  SET_LEX_STATE macro for yydebug messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15 08:47:46 +00:00
nobu 7df1e45bb6 ripper: add states of scanner
* parse.y (ripper_state): add states of scanner to tokens from
  Ripper.lex and Ripper::Filter#on_*.  based on the patch by
  aycabta (Code Ahss) at [ruby-core:81789].  [Feature #13686]

* ext/ripper/tools/preproc.rb (prelude, usercode): generate EXPR_*
  constants from enums.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 10:53:47 +00:00
nobu a61ae940c6 parse.y: [DOC] fix call-seq [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 10:49:29 +00:00
mame 3c8c17d30d Introduce NODE_UNLESS for branch coverage
`unless` statement was a syntactic sugar for `if` statement,
which made the result of branch coverage hard to understand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 05:27:02 +00:00
mame 3155da024c Fix the lineno of case statement that has no expression
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 04:42:23 +00:00
mame cd6df5fb3c Refactor the internal data format for coverage measurement
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
2017-09-03 14:26:06 +00:00
nobu e7606de949 parse.y: primary should not be 0
* 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
2017-08-22 13:21:18 +00:00
nobu e169fa9419 parse.y: unexpected tINTEGER message
* 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
2017-08-17 12:33:41 +00:00
nobu aa0f1dcbda parse.y: removed useless check
* 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
2017-08-15 13:53:38 +00:00
nobu 29b114a1ea parse.y: set used flag in gettable
* 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
2017-08-13 13:34:26 +00:00
nobu 03a2862b98 separate hash literal and keyword arguments
* 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
2017-08-11 01:27:24 +00:00
nobu 4eafec5ea6 parse.y: simplify parse_ident
* 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
2017-08-01 08:32:18 +00:00
nobu 7d6965f88d parse.y: brace after array literal arg
* 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
2017-07-26 00:56:44 +00:00
nobu f29e5013ad parse.y: limit codepoint length
* 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
2017-07-25 08:30:11 +00:00
rhe c4dfd0ccfb ripper: add kwrest_param parser event
* 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
2017-07-21 04:29:46 +00:00
nobu 19e687ff03 parse.y: empty hash in defined
* 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
2017-07-20 05:48:26 +00:00
nobu 28695a8fff parse.y: refine literal error messages
* 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
2017-07-17 00:11:38 +00:00
nobu b17efb6874 parse.y: refine invalid Unicode escape message
* 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
2017-07-16 23:45:48 +00:00
nobu 360f85eb8b parse.y (numeric_literal_flush): fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-16 14:32:41 +00:00
nobu 80d502b881 parse.y: utf-8 codepoints
* 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
2017-07-16 13:39:18 +00:00
nobu 70af8d3c9c parse.y: refine error messages
* 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
2017-07-15 08:29:03 +00:00
nobu 52e8254b54 parse.y: flush debug output
* 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
2017-07-13 07:00:16 +00:00
nobu f2d1848441 parse.y: f_margs parser events
* 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
2017-07-01 02:01:05 +00:00
nobu 844ca35a92 parse.y: mlhs_add_post
* 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
2017-07-01 01:51:17 +00:00
nobu f78d92c5ca parse.y: fix token
* 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
2017-06-28 06:13:00 +00:00
nobu 7c7d74365d parse.y: add ellipsis
* 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
2017-06-28 05:38:27 +00:00
nobu e42a16190c parse.y: flush numeric token
* 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
2017-06-28 04:08:51 +00:00
nobu ff36c25f47 parse.y: fix parser_yyerror
* 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
2017-06-28 02:02:38 +00:00
nobu c28f8b0394 parse.y: prefer enum yytokentype instead to int
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 01:49:44 +00:00
nobu a0c1006e89 parse.y: line number of bin op
* 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
2017-06-26 10:31:34 +00:00
nobu fa480488f4 parse.y: mark error token
* 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
2017-06-26 09:40:39 +00:00
nobu af4ba5c12a parse.y: should not warn op method call
* 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
2017-06-23 11:56:48 +00:00
nobu d391697331 parse.y: check multibyte char
* 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
2017-06-23 11:20:29 +00:00