るりまサーチ

最速Rubyリファレンスマニュアル検索!
300件ヒット [201-300件を表示] (0.006秒)
トップページ > クラス:Ripper[x]

ライブラリ

キーワード

検索結果

<< < 1 2 3 >>

Ripper.slice(src, pattern, n = 0) -> String | nil (1.0)

Ruby プログラム src のうち、 パターン pattern の n 番目の括弧にマッチする文字列を取り出します。

...目の括弧の中の文字列だけが必
要な時に指定します。省略すると 0 (pattern 全体)になります。

pattern は Ripper のイベント ID のリストを文字列で記述します。
また pattern には Ruby の正規表現と同じメタ文字も使えます...
...単位ではなくトークン単位で動作します。

使用例

require 'ripper'
p Ripper.slice(%(<<HERE\nstring\#{nil}\nHERE),
"heredoc_beg .*? nl $(.*?) heredoc_end", 1)
# => "string\#{nil}\n"

イベント ID は Ripper::SCANNER_EVENTS で確認できます。...

Ripper.token_match(src, pattern) -> Ripper::TokenPattern::MatchData | nil (1.0)

Ruby プログラム src に対してパターン pattern をマッチし、 マッチデータを返します。

Ruby プログラム src に対してパターン pattern をマッチし、
マッチデータを返します。

ライブラリ内部で使用します。

Ripper.tokenize(src, filename = &#39;-&#39;, lineno = 1) -> [String] (1.0)

Ruby プログラム str をトークンに分割し、そのリストを返します。

...号を指定します。省略すると 1 になります。


//emlist[][ruby]{
require 'ripper'

p Ripper.tokenize("def m(a) nil end")
# => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
//}

Ripper
.tokenize は空白やコメントも含め、
元の文字列にある文字は 1 バイ...

Ripper.tokenize(src, filename = &#39;-&#39;, lineno = 1, raise_errors: false) -> [String] (1.0)

Ruby プログラム str をトークンに分割し、そのリストを返します。

...//emlist[][ruby]{
require 'ripper'

p Ripper.tokenize("def m(a) nil end")
# => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]

Ripper
.tokenize("def req(true) end", raise_errors: true)
# => SyntaxError (syntax error, unexpected `true', expecting ')')
//}

Ripper
.tokenize は空白やコメ...

Ripper::EVENTS -> [Symbol] (1.0)

ripper の扱う全てのイベント ID (シンボル) のリストを返します。

...
ripper
の扱う全てのイベント ID (シンボル) のリストを返します。...

絞り込み条件を変える

Ripper::PARSER_EVENTS -> [Symbol] (1.0)

パーサイベントのイベント ID (シンボル) のリストを返します。

パーサイベントのイベント ID (シンボル) のリストを返します。

Ripper::PARSER_EVENT_TABLE -> {Symbol => Integer} (1.0)

パーサイベントのイベント ID (シンボル) と対応するハンドラの引数の個数の リストをハッシュで返します。

パーサイベントのイベント ID (シンボル) と対応するハンドラの引数の個数の
リストをハッシュで返します。

Ripper::SCANNER_EVENTS -> [Symbol] (1.0)

スキャナイベントのイベント ID (シンボル) のリストを返します。

スキャナイベントのイベント ID (シンボル) のリストを返します。

Ripper::SCANNER_EVENT_TABLE -> {Symbol => Integer} (1.0)

スキャナイベントのイベント ID (シンボル) と対応するハンドラの引数の個数 のリストをハッシュで返します。

スキャナイベントのイベント ID (シンボル) と対応するハンドラの引数の個数
のリストをハッシュで返します。

Ripper::Version -> String (1.0)

ripper のバージョンを文字列で返します。

...
ripper
のバージョンを文字列で返します。...

絞り込み条件を変える

<< < 1 2 3 >>