Module lib_ruby_parser::nodes[][src]

Expand description

Module with all known node types

Structs

Alias

Represents alias to from statement.

And

Represents foo && bar (or foo and bar) statement.

AndAsgn

Represents a &&= 1 statement.

Arg

Represents a positional required block/method argument.

Args

Represents an arguments list

Array

Represents an array literal

ArrayPattern

Represents an array pattern used in pattern matching

ArrayPatternWithTail

Represents an array pattern with trailing comma used in pattern matching

BackRef

Represents special global variables: 1. $` 2. $& 3. $' 4. $+

Begin

Represents compound statement (i.e. a multi-statement)

Block

Represents a Ruby block that is passed to a method (proc { |foo| bar })

BlockPass

Represents a &blk argument of the method call (but not of the method definition, see BlockArg)

Blockarg

Represents a &blk argument in the method definition (but not in the method call, see BlockPass)

Break

Represents a break keyword (with optional argument)

CSend

Represents conditional method call using &. operator

Case

Represents a case statement (for pattern matching see CaseMatch node)

CaseMatch

Represents a case statement used for pattern matching (for regular case see Case node)

Casgn

Represents a constant assignment (i.e. A = 1)

Cbase

Represents leading :: part of the constant access/assignment that is used to get/set on a global namespace.

Class

Represents a class definition (using a class keyword, Class.new is just a method call)

Complex

Represents a Complex literal (that returns an Complex number)

Const

Represents constant access (i.e. Foo::Bar)

ConstPattern

Const pattern used in pattern matching (e.g. in A(1, 2))

Cvar

Represents access to class variable (i.e. @@var)

Cvasgn

Represents class variable assignment (i.e. @@var = 42)

Def

Represents method definition using def keyword (not on a singleton, see Defs node).

Defined

Represents a defined?(foo) expression

Defs

Represents a singleton method definition (i.e. def self.foo; end)

Dstr

Represents a string with interpolation (i.e. "#{foo}")

Dsym

Represents a symbol with interpolation (i.e. :"#{foo}")

EFlipFlop

Represents exclusive flip-flop (i.e. in if foo...bar; end)

EmptyElse

Represents a special empty else that is a part of the pattern matching.

Encoding

Represents a special __ENCODING__ keyword

Ensure

Represents a block of code with ensure (i.e. begin; ensure; end)

Erange

Represents range literal with excluded end (i.e. 1...3)

False

Represents a false literal

File

Represents a special __FILE__ literal

FindPattern

Represents a find pattern using in pattern matching (i.e. in [*x, 1 => a, *y])

Float

Represents a float literal (i.e. 42.5)

For

Represents a for loop

ForwardArg

Represents a special ... argument that forwards positional/keyword/block arguments.

ForwardedArgs

Represents a ... operator that contains forwarded argument (see ForwardArg)

Gvar

Represents access to global variable (i.e. $foo)

Gvasgn

Represents global variable assignment (i.e. $foo = 42)

Hash

Represents a hash literal (i.e. { foo: 42 })

HashPattern

Represents a hash pattern used in pattern matching (i.e. in { a: 1 })

Heredoc

Represents a here-document literal (both with and without interpolation)

IFlipFlop

Represents inclusive flip-flop (i.e. in if foo..bar; end)

If

Represents an if statement (i.e. if foo; bar; else; baz; end)

IfGuard

Represents an if guard used in pattern matching (i.e. case foo; in pattern if guard; end)

IfMod

Represents an if/unless modifier (i.e. stmt if cond)

IfTernary

Represents ternary if statement (i.e. cond ? if_true : if_false)

InPattern

Represents an in pattern branch of the pattern matching

Index

Represents indexing operation (i.e. foo[1,2,3])

IndexAsgn

Represents assignment using indexing operation (i.e. foo[1, 2, 3] = bar)

Int

Represents an integer literal (i.e. 42)

Irange

Represents inclusive range (i.e. 2..4)

Ivar

Represents access to instance variable (i.e. @foo)

Ivasgn

Represents instance variable assignment (i.e @foo = 42)

KwBegin

Represents an explicit begin; end block.

Kwarg

Represents required keyword argument (i.e. foo in def m(foo:); end)

Kwargs

Represents kwargs that are given to a method call, super or yield (i.e. foo(bar: 1))

Kwnilarg

Represents an special argument that rejects all keyword arguments (i.e. def m(**nil); end)

Kwoptarg

Represents an optional keyword argument (i.e. foo in def m(foo: 42); end)

Kwrestarg

Represents a keyword rest argument (i.e. foo in def m(**foo); end)

Kwsplat

Represents a keyword arguments splat (i.e. **bar in a call like foo(**bar))

Lambda

Represents a lambda call using -> (i.e. -> {})

Line

Represents a special __LINE__ literal

Lvar

Represents access to a local variable (i.e. foo)

Lvasgn

Represents local variable assignment (i.e. foo = 42)

Masgn

Represents mass-assignment (i.e. foo, bar = 1, 2)

MatchAlt

Represents pattern matching using one of the given patterns (i.e. foo in 1 | 2)

MatchAs

Represents matching with renaming into specified local variable (i.e. case 1; in Integer => a; end)

MatchCurrentLine

Represents implicit matching using if /regex/

MatchNilPattern

Represents empty hash pattern that is used in pattern matching (i.e. in **nil)

MatchPattern

Represents a one-line pattern matching that can throw an error (i.e. foo => pattern)

MatchPatternP

Represents a one-line pattern matching that never throws but returns true/false (i.e. foo in pattern)

MatchRest

Represents a wildcard pattern used in pattern matching (i.e. in *foo)

MatchVar

Represents matching with assignment into a local variable (i.e. pattern => var)

MatchWithLvasgn

Represents matching a regex that produces local variables (i.e. /(?<match>bar)/ =~ 'bar')

Mlhs

Represents left hand statement of the mass-assignment (i.e. foo, bar in foo, bar = 1, 2)

Module

Represents module declaration using module keyword

Next

Represents next keyword

Nil

Represents nil literal

NthRef

Represents numeric global variable (e.g. $1)

Numblock

Represents a block that takes numbered parameters (i.e. proc { _1 })

OpAsgn

Represents an operation with assignment (e.g. a += 1)

Optarg

Represents optional positional argument (i.e. foo in m(foo = 1))

Or

Represents foo || bar (or foo or bar) statement.

OrAsgn

Represents lhs ||= rhs assignment

Pair

Represents a key/value pair (e.g. a part of the Hash node)

Pin

Represents a pattern based on a “pinned” variable (e.g. ^foo)

Postexe

Represents END { .. } statement

Preexe

Represents BEGIN { ... } statement

Procarg0

Represents a sole block argument (e.g. |foo|)

Rational

Represents rational literal (e.g. 1r)

Redo

Represents redo keyword

RegOpt

Represents flags of the regex literal (i.e. mix for /foo/mix)

Regexp

Represents regex literal (e.g. /foo/)

Rescue

Represents a rescue block

RescueBody

Represents a single rescue handler (i.e. rescue E => e ...)

Restarg

Represents positional rest argument (i.e. *foo in def m(*foo); end)

Retry

Represents retry keyword

Return

Represents return keyword

SClass

Represents opening a singleton class (i.e. class << foo; ... end;)

Self_

Represents self keyword

Send

Represents a method call (e.g. foo.bar(42))

Shadowarg

Represents a special block argument that “shadows” outer variable (i.e. |;foo|)

Splat

Represents an arguments splat (i.e. *bar in a call like foo(*bar))

Str

Represents a plain non-interpolated string literal (e.g. "foo")

Super

Represents a super keyword

Sym

Represents a plain symbol literal (i.e. :foo)

True

Represents a true literal

Undef

Represents an undef keyword (e.g. undef foo, :bar)

UnlessGuard

Represents an unless guard used in pattern matching (i.e. in pattern unless guard)

Until

Represents until loop

UntilPost

Represents a post-until loop

When

Represents a branch of the case statement (i.e. when foo)

While

Represents while loop

WhilePost

Represents a post-while loop

XHeredoc

Represents a executable here-document literal (both with and without interpolation)

Xstr

Represents an executable string (i.e. `sh #{script_name}`)

Yield

Represents an yield keyword

ZSuper

Represents a super call without arguments and parentheses

Enums

Node

Generic combination of all known nodes.