diff options
author | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-20 03:25:36 +0000 |
---|---|---|
committer | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-20 03:25:36 +0000 |
commit | b8b503d657731fc0982c584f8b82f4976ea1283f (patch) | |
tree | dab4867619c714893e7b6a2018d430faf13ff620 /thread_pthread.c | |
parent | 91557d0c52de3287a319e241215803989159adcc (diff) | |
download | ruby-b8b503d657731fc0982c584f8b82f4976ea1283f.tar.gz |
Add symbol to the result of `RubyVM::AbstractSyntaxTree#children`.
Add symbol to the result to make pattern match easily.
For example:
(1) NODE_MASGN * NODE_SPECIAL_NO_NAME_REST
```
$ ./miniruby -e 'p RubyVM::AbstractSyntaxTree.parse("a, * = b").children[-1].children'
[#<RubyVM::AbstractSyntaxTree::Node:VCALL@1:7-1:8>, #<RubyVM::AbstractSyntaxTree::Node:ARRAY@1:0-1:1>, :NODE_SPECIAL_NO_NAME_REST]
```
(2) NODE_POSTARG * NODE_SPECIAL_NO_NAME_REST
```
$ ./miniruby -e 'p RubyVM::AbstractSyntaxTree.parse("a, *, _ = b").children[-1].children[-1].children'
[:NODE_SPECIAL_NO_NAME_REST, #<RubyVM::AbstractSyntaxTree::Node:ARRAY@1:6-1:7>]
```
(3) NODE_LASGN * NODE_SPECIAL_REQUIRED_KEYWORD
```
$ ./miniruby -e 'p RubyVM::AbstractSyntaxTree.parse("def a(k:) end").children[-1].children[-1].children[1].children[7].children[0].children'
[:k, :NODE_SPECIAL_REQUIRED_KEYWORD]
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
0 files changed, 0 insertions, 0 deletions