Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RubyVM::AbstractSyntaxTree #2292

Merged
merged 4 commits into from
Jul 14, 2020
Merged

Add RubyVM::AbstractSyntaxTree #2292

merged 4 commits into from
Jul 14, 2020

Conversation

pocke
Copy link
Member

@pocke pocke commented Jun 20, 2020

@pocke pocke marked this pull request as ready for review June 25, 2020 11:34
@pocke pocke changed the title WIP Add RubyVM::AbstractSyntaxTree Add RubyVM::AbstractSyntaxTree Jun 25, 2020
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。

#@samplecode
# => (SCOPE@1:0-1:50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

出力例しかないので、 IO などの例にあるように File.write と組み合わせた例にしておくと良さそうです。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何故かコードを貼り付けるのを忘れていたみたいです 💦
0dfb3db


@param proc Procもしくはメソッドオブジェクトを指定します。

#@samplecode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

irb で試すと Errno::ENOENT になるようなので、 @raise を追加したり、サンプルコードに注意書きを追加すると良さそうです。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDoc の方で書かれていないのに @raise を足すべきか微妙だなと思ったのと、サンプルコード特有の問題ではなくて一般に起こりうる問題なので、本文に説明を足してみました。

7411d4f


--- first_column -> Integer

ソースコード中で、self を表すテキストが最初に現れる列番号を返します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-origin でバイト単位という説明もあると良さそうです。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fisrt|last)_(column|line) に説明を足しました 🙆‍♂️

93073ae


--- first_lineno -> Integer

ソースコード中で、self を表すテキストが最初に現れる行番号を返します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-origin という説明もあると良さそうです。


--- last_column -> Integer

ソースコード中で、self を表すテキストが最後に現れる列番号を返します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらも 0-origin でバイト単位という説明があると良さそうです。


--- last_lineno -> Integer

ソースコード中で、self を表すテキストが最後に現れる行番号を返します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらも 1-origin という説明があると良さそうです。

@znz znz merged commit dfddfb5 into rurema:master Jul 14, 2020
@pocke pocke deleted the rubyvm-ast branch July 14, 2020 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants