2051 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
1997e10f6c
Made parentheses mandatory in endless method defition
Even for empty argument list, not to be confusing with a writer
method name.
2020-04-22 20:44:46 +09:00
Nobuyoshi Nakada
02ad393cd6
Revert "Allow simple R-assign in endless def"
This reverts commit 67bcac879a2e0ddfb4e7bbd7cb5e5401422de76a.
2020-04-22 18:56:06 +09:00
Nobuyoshi Nakada
478135f480
Disallow line-continuation before R-assign 2020-04-15 10:33:11 +09:00
Nobuyoshi Nakada
a520ee4763
Removed duplicate value_expr checks
`arg_rhs` has the same check and is always a non-void value
expression.
2020-04-14 19:47:17 +09:00
Nobuyoshi Nakada
67bcac879a Allow simple R-assign in endless def 2020-04-13 21:51:34 +09:00
Nobuyoshi Nakada
022c7bbea9
Relaxed of R-assign value to arg 2020-04-12 00:07:57 +09:00
Nobuyoshi Nakada
e8f53692ca
Endless method definition [Feature #16746] 2020-04-10 18:02:15 +09:00
Nobuyoshi Nakada
1b2d351b21
Rightward-assign by ASSOC
[Feature #15921]
2020-04-10 15:03:58 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada
2544bf9452
New macro NEW_RIPPER instead of NEW_CDECL 2020-04-03 01:16:57 +09:00
Nobuyoshi Nakada
f020d340f4
parse.y: hoisted out new_nil_at
new_nil_at: create NEW_NIL node with zero-width location.
2020-03-11 18:13:40 +09:00
Nobuyoshi Nakada
276859e03e
parse.y: unified kwrest and no-kwrest 2020-03-11 18:13:29 +09:00
Nobuyoshi Nakada
7d05f98a84
Renamed lex_flags as lex_context 2020-03-05 17:19:17 +09:00
Nobuyoshi Nakada
c8d0bf0156
Preserve kwarg flag and fix up f5c904c2a9 2020-03-03 16:19:49 +09:00
Nobuyoshi Nakada
85620ffaa6
Reduced parser stack usage by merging non-result actions 2020-03-02 16:45:46 +09:00
Nobuyoshi Nakada
20a2ab0825
Packed stacked bit flags into one struct 2020-03-02 16:34:33 +09:00
Nobuyoshi Nakada
f5c904c2a9
Allow newlines inside braced pattern 2020-03-02 15:49:03 +09:00
Kazuki Tsujimoto
d25a4f413d
Allow trailing comma in hash pattern 2020-03-01 14:35:48 +09:00
Nobuyoshi Nakada
403675e8dc
Named tLABEL token 2020-02-29 21:42:38 +09:00
Nobuyoshi Nakada
07f27383b7
Refined argument name 2020-02-28 20:10:46 +09:00
Nobuyoshi Nakada
6e6844320d Fixed duplicated warning
As `command_rhs` is always a "value expression", `command_asgn`
does not need the same check.
2020-02-10 14:00:40 +09:00
Nobuyoshi Nakada
9cdc964d07
Do not warn CR inside string literal 2020-02-04 14:41:52 +09:00
Kenta Murata
019a0ed0c7
Make RATIONAL_SET_{NUM,DEN} static inline functions 2020-01-17 10:04:19 +09:00
Nobuyoshi Nakada
c171ab23e3
Separate numbered parameter scope in eval
[Feature #16432]
2020-01-16 18:38:48 +09:00
Nobuyoshi Nakada
f38b3e8c70
Fixed the location of args node with numbered parameter 2020-01-16 18:34:31 +09:00
Yusuke Endoh
5b0c3754d8 parse.y: fix a wrong sizeof argument for ruby_sized_xfree 2020-01-05 11:39:35 +09:00
Jeremy Evans
0eeed5bcc5 Make eval(code, binding) use (eval) as __FILE__ and 1 as __LINE__
This removes the warning that was added in
3802fb92ff8c83eed3e867db20f72c53932f542d, and switches the behavior
so that the eval does not use the binding's __FILE__ and __LINE__
implicitly.

Fixes [Bug #4352]
2020-01-03 20:13:09 -08:00
卜部昌平
5e22f873ed decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
2019-12-26 20:45:12 +09:00
Nobuyoshi Nakada
56e002981f
Show the error line only when same as the current 2019-12-25 14:49:48 +09:00
Nobuyoshi Nakada
07e595fdbd
Added experimental warning category
[Feature #16420]
2019-12-20 23:48:15 +09:00
Nobuyoshi Nakada
dd7f0c87c9
Hoisted out new_case3 2019-12-20 23:43:38 +09:00
Nobuyoshi Nakada
7a94225e7d
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:58:51 +09:00
Nobuyoshi Nakada
a8bddb3a18
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:34:32 +09:00
Nobuyoshi Nakada
2898367b3a
Warn also numbered parameter like methods 2019-12-20 08:18:19 +09:00
Nobuyoshi Nakada
27ddb6e998
Warn also numbered parameter like parameters
[Feature #16433]
2019-12-20 01:25:34 +09:00
Yusuke Endoh
199bd851e4 parse.y: suppress "set but not used" warnings on ripper.y 2019-12-05 14:51:55 +09:00
Jeremy Evans
447d583536 Silence incorrect assigned but unused variable warnings in ripper
To only emit the warnings in correct cases would require tracking
local variable usage in ripper, which ripper currently does not do.

Fixes [Bug #15188]
2019-12-04 03:04:22 +02:00
Nobuyoshi Nakada
d1ef4fd08e
Make single line pattern matching void expression
Instead of returning `nil`, raise a syntax error if its value is
used.  [Feature #16355]
2019-11-30 00:15:29 +09:00
Nobuyoshi Nakada
8b4ee5d6ba
Raise NoMatchingPatternError when expr in pat doesn't match
* `expr in pattern` should raise `NoMatchingError` when unmatched
* `expr in pattern` should return `nil`. (this is unspecified, but
  this feature is experimental, at all)

[Feature #16355]
2019-11-28 13:47:14 +09:00
Nobuyoshi Nakada
9e01fcd0cb
[ripper] Fixed unique key check in pattern matching
Check keys
* by an internal table, instead of unstable dispatched results
* and by parsed key values, instead of escaped forms in the source
2019-11-26 22:54:35 +09:00
Nobuyoshi Nakada
22dfd14c17
Hoisted out push_pvtbl/pop_pvtbl 2019-11-26 21:57:00 +09:00
Nobuyoshi Nakada
497f13aea6
Wrap p_kw in an array at p_kwarg
Not in `p_kw` itself, which makes key and variable/expr pair only
now.
2019-11-26 21:57:00 +09:00
Nobuyoshi Nakada
26625bc33c
[ripper] Quoted label without expression must be a local variable
The difference from 0b8c73aa65add5c57b46b0cfdf4e661508802172 is to
add the result of `string_add` event to marking objects.

```C
			    RNODE($1)->nd_rval = add_mark_object(p, $$);
```
2019-11-25 17:42:59 +09:00
Nobuyoshi Nakada
61131edba7
Revert "[ripper] Quoted label without expression must be a local variable"
This reverts commit 0b8c73aa65add5c57b46b0cfdf4e661508802172, which
seems breaking RVALUE consistency check.
2019-11-20 00:56:04 +09:00
Nobuyoshi Nakada
0b8c73aa65
[ripper] Quoted label without expression must be a local variable 2019-11-19 17:18:27 +09:00
Jeremy Evans
c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
卜部昌平
c9ffe751d1 delete unused functions
Looking at the list of symbols inside of libruby-static.a, I found
hundreds of functions that are defined, but used from nowhere.

There can be reasons for each of them (e.g. some functions are
specific to some platform, some are useful when debugging, etc).
However it seems the functions deleted here exist for no reason.

This changeset reduces the size of ruby binary from 26,671,456
bytes to 26,592,864 bytes on my machine.
2019-11-14 20:35:48 +09:00
Nobuyoshi Nakada
4d615a0c8f
#@1 is no longer an embedded variable 2019-11-14 16:37:25 +09:00
Nobuyoshi Nakada
fb6a489af2
Revert "Method reference operator"
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
2019-11-12 17:24:48 +09:00
Nobuyoshi Nakada
a58b4eee25
Warn on ... at EOL 2019-11-12 17:14:14 +09:00