summaryrefslogtreecommitdiff
path: root/ext/ripper
AgeCommit message (Collapse)Author
2019-10-21Look up event ID offsets by token as indexNobuyoshi Nakada
2019-10-20Also BDOT2 and BDOT3 are operatorsNobuyoshi Nakada
2019-10-19Extend Ripper DSL to set to pseudo variables other than `$$`Nobuyoshi Nakada
2019-09-24Changed numbered parameter prefixNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2431
2019-09-07[DOC] Update output of Ripper.sexp [ci skip]Kazuhiro NISHIYAMA
2019-08-29Revert "Add pipeline operator [Feature #15799]"Nobuyoshi Nakada
This reverts commits: * d365fd5a024254d7c105a62a015a7ea29ccf3e5d * d780c3662484d6072b3a6945b840049de72c2096 * aa7211836b769231a2a8ef6b6ec2fd0ec882ef29 * 043f010c28e82ea38978bf8ed885416f133b5b75 * bb4dd7c6af05c7821d572e2592ea3d0cc748d81f * 043f010c28e82ea38978bf8ed885416f133b5b75 * f169043d81524b5b529f2c1e9c35437ba5bc3a7a http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/94645
2019-08-07ext/ripper/lib/ripper/lexer.rb: Consistently use `Array#push`Yusuke Endoh
instead of <<. All the other callsites use `push`.
2019-08-07ext/ripper/lib/ripper/lexer.rb: fix a wrong delegationYusuke Endoh
The target method name is a typo.
2019-07-14Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada
2019-06-27Show the parser states in pretty_print tooNobuyoshi Nakada
2019-06-17Support Bison 3 in ripperNobuyoshi Nakada
2019-06-15Prefer `enum yytokentype` to intNobuyoshi Nakada
2019-06-13Add pipeline operator [Feature #15799]Nobuyoshi Nakada
2019-06-12Ripper::Lexer: fallback parse error token to the previous oneNobuyoshi Nakada
2019-05-30Include stack elements left after errorsNobuyoshi Nakada
2019-05-29ripper: Ripper::Lexer#scanNobuyoshi Nakada
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer#scan): parses the code and returns the result elements including errors. [EXPERIMENTAL]
2019-05-28Fix typos in Ripper::Lexer#inspect and Ripper::Lexer#pretty_printNobuyoshi Nakada
2019-05-27Added #inspect and #pretty_inspect to Ripper::Lexer::ElemNobuyoshi Nakada
2019-05-22Ripper: no documents of fallback methodsNobuyoshi Nakada
2019-04-17Introduce pattern matching [EXPERIMENTAL]ktsj
[ruby-core:87945] [Feature #14912] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-17Numbered parameters [Feature #4475]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-09Add ignored_sp eventnobu
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): add ignored_sp event which will be fired from Ripper::Lexer#on_heredoc_dedent method. [ruby-core:91727] [Bug #15648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-01Fixed build failure of Travis CI. We need to support `make srcs`.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-01Support YACC environment variable for ripper.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-08Removed moving toplevel header since r12501nobu
Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31Method reference operatornobu
Introduce the new operator for method reference, `.:`. [Feature #12125] [Feature #13581] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04Use delete_prefix instead of `sub(/\Afixed-pattern/, '')`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24UNREACHABLE_RETURNnobu
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end of non-void functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-15Remove flip-flop usages from build scriptsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13Fix FrozenError on `Ripper.slice`k0kubun
Currently `Ripper.slice` raises a FrozenError ```ruby require 'ripper' p Ripper.slice('foo', 'ident') ``` ``` /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `concat': can't modify frozen String (FrozenError) from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `block in compile' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `scan' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `compile' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:169:in `initialize' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `new' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `token_match' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:144:in `slice' from /tmp/tmp.kb4cnhvum2/test.rb:2:in `<main>' ``` This patch will fix the problem. [Fix GH-1837] From: Masataka Pocke Kuwabara <kuwabara@pocke.me> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-12ripper: fix escaped spacenobu
* parse.y: use tSP same as ripper instead of tSPACE. [ruby-core:86080] [Bug #14597] * ext/ripper/eventids2.c: tSP is defined in ripper.c now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20ext/ripper/tools/dsl.rb: Use String#sub instead of delete_suffixmame
It fails when baseruby is old. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20parse.y: Remove double meaning of new_qcall/new_command_qcallmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20ext/ripper/tools/dsl.rb: Serialize dispatch callsmame
To avoid the unspecified behavior (the evaluation order of arguments). In `$$ = foo(bar(), baz());`, it is unspecified which `bar` or `baz` is called earlier. This commit changes the code to `v1=bar(); v2=baz(); $$ = foo();`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20parse.y: Remove unneeded var_field_1 trickmame
I thought this trick was needed because the result of var_field was passed to different arguments, as follows: ``` $1 = var_field(p, $1); $$ = backref_assign_error(p, $1, $1, &@$); ``` Currently the DSL supports that one result is passed to one argument. However, after the refactoring, I found that `backref_assign_error` uses only one `$1`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20dsl.rb: pnobu
* ext/ripper/tools/dsl.rb (DSL#initialize): define `p` for `struct parser_params *p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20dsl.rb: ID constantsnobu
* ext/ripper/tools/dsl.rb (DSL#method_missing): expand ID constnats without parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20dsl.rb: const_missingnobu
* ext/ripper/tools/dsl.rb (DSL.const_missing): define to expand Qnil and Qundef as-is. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20dsl.rb: indentnobu
* ext/ripper/tools/dsl.rb (DSL#generate): indent after surrounding by braces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19parse.y: Remove double meaning of backref_assign_errormame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19parse.y: Remove unneeded type decls for Rippermame
I think that they are not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19parse.y: swap `foo!` and `foo` in Ripper DSLmame
`foo!(...)` means Ripper event, and `foo(...)` means C function/macro call. This is for fail-safe; if I forget `!` accidentally, it would fail to compile, instead of wrongly adding a new Ripper event. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19parse.y: Allows Ripper DSL to embed C function calls as `foo!`mame
Instead of `_foo`. This makes it useful to do word boundary search of the editor. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19ext/ripper/tools/preproc.rb: Remove `/*%c%` handlingmame
It was replaced with `/*% ripper[brace]: ... %*/` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19ext/ripper: Introduce a simple DSL for ripper.y code generationmame
Currently, parse.y actions are hard to read and write because the code has double meaning (for core parser and for ripper). I think that, if it is easy to write ripper's code shortly and simply, the double meaning trick is not needed. For the sake, this change adds a simple DSL for ripper's code. For example, in parse.y, we can write: /*% ripper: stmts_add(stmts_new, void_stmt) %*/ instead of: $$ = dispatch2(stmts_add, dispatch0(stmts_new), dispatch0(void_stmt)); git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-17ext/ripper/depend: Try to fix the path of id.hmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-17ripper.c: depends on preproc.rbnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13Ripper::Lexer bit predicatesnobu
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-05lexer.rb: Ripper::Lexer::Statenobu
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer::State): wrapper of lex_state values. * parse.y (rb_parser_lex_state_name): return shared strings. lex state combinations are very restricted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-19lexer.rb: no dedent strings in middlenobu
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): dedent only strings at the beginning, not strings in middle. [ruby-core:83343] [Bug #14027] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e