summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2019-12-05parse.y: suppress "set but not used" warnings on ripper.yYusuke Endoh
2019-12-04Silence incorrect assigned but unused variable warnings in ripperJeremy Evans
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] Notes: Merged: https://github.com/ruby/ruby/pull/2719
2019-11-30Make single line pattern matching void expressionNobuyoshi Nakada
Instead of returning `nil`, raise a syntax error if its value is used. [Feature #16355]
2019-11-28Raise `NoMatchingPatternError` when expr `in` pat doesn't matchNobuyoshi Nakada
* `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-26[ripper] Fixed unique key check in pattern matchingNobuyoshi Nakada
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-26Hoisted out `push_pvtbl`/`pop_pvtbl`Nobuyoshi Nakada
2019-11-26Wrap `p_kw` in an array at `p_kwarg`Nobuyoshi Nakada
Not in `p_kw` itself, which makes key and variable/expr pair only now.
2019-11-25[ripper] Quoted label without expression must be a local variableNobuyoshi Nakada
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-20Revert "[ripper] Quoted label without expression must be a local variable"Nobuyoshi Nakada
This reverts commit 0b8c73aa65add5c57b46b0cfdf4e661508802172, which seems breaking RVALUE consistency check.
2019-11-19[ripper] Quoted label without expression must be a local variableNobuyoshi Nakada
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-14delete 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. Notes: Merged: https://github.com/ruby/ruby/pull/2677
2019-11-14`#@1` is no longer an embedded variableNobuyoshi Nakada
2019-11-12Revert "Method reference operator"Nobuyoshi Nakada
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b. [Feature #16275]
2019-11-12Warn on `...` at EOLNobuyoshi Nakada
2019-11-12Disable tOROP at EXPR_BEGNobuyoshi Nakada
Both cannot appear there anyway.
2019-11-12Clear current argument name at empty block argument [Bug #16343]Nobuyoshi Nakada
2019-11-11Revert "Warn EOF char in comment"NARUSE, Yui
This reverts commit 69ec3f70fab0c1c537c68fb135cc315181b1d750.
2019-11-11Revert "Elaborated EOF char message a little"NARUSE, Yui
This reverts commit 6eaac7cfac668d6669be694fd7b723c4982ed218.
2019-11-11Elaborated EOF char message a littleNobuyoshi Nakada
2019-11-11Warn EOF char in commentNobuyoshi Nakada
2019-11-11Fixed embedded document with EOF charNobuyoshi Nakada
2019-11-10Disallow omission of parentheses/brackets in single line pattern matching ↵Kazuki Tsujimoto
[Feature #16182]
2019-11-07Disallow duplicated pattern variableKazuki Tsujimoto
2019-11-07Add missing semicolonKazuki Tsujimoto
2019-11-06Numbered parameter is an ID_LOCAL now [Bug #16293]Nobuyoshi Nakada
2019-11-06Numbered parameter cannot appear outside block now [Bug #16293]Nobuyoshi Nakada
2019-11-05Fix a typo in WARN_EOLKazuhiro NISHIYAMA
2019-11-05Fixed conditional expressions with only one void sideNobuyoshi Nakada
2019-11-04Keep `lex.pcur` after `looking_at_eol_p`Nobuyoshi Nakada
2019-11-04Warn `if` and `elsif` at EOL [EXPERIMENTAL]Nobuyoshi Nakada
It is unnatural and probably a typo.
2019-11-04Revert "Warn `if` and `elsif` at EOL [EXPERIMENTAL]"Yusuke Endoh
This reverts commit ba35c14325ebbf1da8f200df83c45ee9937ff8a1. This is because ripper fails symbol lookup error.
2019-11-04Warn `if` and `elsif` at EOL [EXPERIMENTAL]Nobuyoshi Nakada
It is unnatural and probably a typo.
2019-10-29Restore `in_kwarg` flag properlyNobuyoshi Nakada
2019-10-25Define arguments forwarding as `ruby2_keywords` styleNobuyoshi Nakada
Get rid of these redundant and useless warnings. ``` $ ruby -e 'def bar(a) a; end; def foo(...) bar(...) end; foo({})' -e:1: warning: The last argument is used as the keyword parameter -e:1: warning: for `foo' defined here -e:1: warning: The keyword argument is passed as the last hash parameter -e:1: warning: for `bar' defined here ```
2019-10-25Arguments forwarding is not allowed in lambda [Feature #16253]Nobuyoshi Nakada
2019-10-22Arguments forwarding [Feature #16253]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2575
2019-10-19Fixed passing idNil as a SymbolNobuyoshi Nakada
2019-10-17Make circular argument reference a SyntaxError instead of a warningJeremy Evans
Fixes [Bug #10314] Notes: Merged: https://github.com/ruby/ruby/pull/2569
2019-10-10Fixed numbered parameter checkNobuyoshi Nakada
* parse.y (struct local_vars): moved numbered parameter NODEs for nesting check to separate per local variable scopes, as numbered parameters should belong to local variable scopes. [Bug #16248]
2019-10-10lhs of pattern matching expression of should have a valueNobuyoshi Nakada
2019-10-09Prefer st_is_member over st_lookup with 0Ben Woosley
The st_is_member DEFINE has simpler semantics, for more readable code. Notes: Merged: https://github.com/ruby/ruby/pull/1622
2019-10-08Packed delayed token elementsNobuyoshi Nakada
2019-10-05Fix potential memory leaks by `rb_imemo_tmpbuf_auto_free_pointer`Nobuyoshi Nakada
This function has been used wrongly always at first, "allocate a buffer then wrap it with tmpbuf". This order can cause a memory leak, as tmpbuf creation also can raise a NoMemoryError exception. The right order is "create a tmpbuf then allocate&wrap a buffer". So the argument of this function is rather harmful than just useless. TODO: * Rename this function to more proper name, as it is not used "temporary" (function local) purpose. * Allocate and wrap at once safely, like `ALLOCV`.
2019-10-04parse.y: use "struct rb_iseq_struct" instead of rb_iseq_tYusuke Endoh
typedef was not declared in parse.y. Sorry.
2019-10-04Make parser_params have parent_iseq instead of base_blockYusuke Endoh
The parser needs to determine whether a local varaiable is defined or not in outer scope. For the sake, "base_block" field has kept the outer block. However, the whole block was actually unneeded; the parser used only base_block->iseq. So, this change lets parser_params have the iseq directly, instead of the whole block. Notes: Merged: https://github.com/ruby/ruby/pull/2519
2019-10-04Refactor parser_params by removing "in_main" flagYusuke Endoh
The relation between parser_param#base_block and #in_main were very subtle. A main script (that is passed via a command line) was parsed under base_block = TOPLEVEL_BINDING and in_main = 1. A script loaded by Kernel#require was parsed under base_block = NULL and in_main = 0. If base_block is non-NULL and in_main == 0, it is parsed by Kernel#eval or family. However, we know that TOPLEVEL_BINDING has no local variables when a main script is parsed. So, we don't have to parse a main script under base_block = TOPLEVEL_BINDING. Instead, this change parses a main script under base_block = 0. If base_block is non-NULL, it is parsed by Kernel#eval or family. By this simplication, "in_main" is no longer needed. Notes: Merged: https://github.com/ruby/ruby/pull/2519
2019-09-26[EXPERIMENTAL] Expression with modifier `in`Nobuyoshi Nakada
[Feature #15865] Notes: Merged: https://github.com/ruby/ruby/pull/2485
2019-09-25Removed idNUMPARAM_0Nobuyoshi Nakada
2019-09-25Changed numbered parameters semanticsNobuyoshi Nakada
* `_1` (and no other numbered parameters) to work as `|x|`. * giving up `_0`. [ruby-core:95074] [Bug #16178]