10件ヒット
[1-10件を表示]
(0.061秒)
ライブラリ
-
ripper
/ lexer (10)
検索結果
先頭2件
-
Ripper
. lex(src , filename = & # 39;-& # 39; , lineno = 1 , raise _ errors: false) -> [[Integer , Integer] , Symbol , String , Ripper :: Lexer :: State] (227.0) -
Ruby プログラム str をトークンに分割し、そのリストを返します。 ただし Ripper.tokenize と違い、トークンの種類と位置情報も付属します。
...Ruby プログラム str をトークンに分割し、そのリストを返します。
ただし Ripper.tokenize と違い、トークンの種類と位置情報も付属します。
@param src Ruby プログラムを文字列か IO オブジェクトで指定します。
@param filename src......se_errors true を指定すると、src にエラーがある場合に例外(SyntaxError)を発生させます。省略すると false になります。
@raise SyntaxError raise_errors が true で、src に文法エラーがある場合に発生します。
//emlist[][ruby]{
require 'ripper'......です。
: 種類 (Symbol)
トークンの種類が「:on_XXX」の形式のシンボルで渡されます。
: トークン (String)
トークン文字列です。
: ステート (Ripper::Lexer::State)
トークンの状態を表す Ripper::Lexer::State のインスタンスです。... -
Ripper
. tokenize(src , filename = & # 39;-& # 39; , lineno = 1 , raise _ errors: false) -> [String] (221.0) -
Ruby プログラム str をトークンに分割し、そのリストを返します。
...ise_errors true を指定すると、src にエラーがある場合に例外(SyntaxError)を発生させます。省略すると false になります。
@raise SyntaxError raise_errors が true で、src に文法エラーがある場合に発生します。
//emlist[][ruby]{
require 'ripper'
p......("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 は空白やコメントも含め、
元の文字列にある文字は 1...