In Files
- ast.c
Namespace
Methods
Files
- grammar.en.rdoc
- test.ja.rdoc
- contributing.rdoc
- contributors.rdoc
- dtrace_probes.rdoc
- extension.ja.rdoc
- extension.rdoc
- globals.rdoc
- keywords.rdoc
- maintainers.rdoc
- marshal.rdoc
- regexp.rdoc
- security.rdoc
- signals.rdoc
- standard_library.rdoc
- syntax.rdoc
- assignment.rdoc
- calling_methods.rdoc
- control_expressions.rdoc
- exceptions.rdoc
- literals.rdoc
- methods.rdoc
- miscellaneous.rdoc
- modules_and_classes.rdoc
- precedence.rdoc
- refinements.rdoc
- README.ja.rdoc
- README.rdoc
Class/Module Index ![show/hide quicksearch [+]](../images/find.png)
- ARGF
- ArgumentError
- Array
- BasicObject
- Binding
- Class
- ClosedQueueError
- Comparable
- Complex
- ConditionVariable
- Continuation
- Data
- Dir
- ENV
- EOFError
- Encoding
- Encoding::CompatibilityError
- Encoding::Converter
- Encoding::ConverterNotFoundError
- Encoding::InvalidByteSequenceError
- Encoding::UndefinedConversionError
- EncodingError
- Enumerable
- Enumerator
- Enumerator::ArithmeticSequence
- Enumerator::Chain
- Enumerator::Generator
- Enumerator::Lazy
- Enumerator::Yielder
- Errno
- Exception
- FalseClass
- Fiber
- FiberError
- File
- File::Constants
- File::Stat
- FileTest
- Float
- FloatDomainError
- FrozenError
- GC
- GC::Profiler
- Hash
- IO
- IO::EAGAINWaitReadable
- IO::EAGAINWaitWritable
- IO::EINPROGRESSWaitReadable
- IO::EINPROGRESSWaitWritable
- IO::EWOULDBLOCKWaitReadable
- IO::EWOULDBLOCKWaitWritable
- IO::WaitReadable
- IO::WaitWritable
- IOError
- IndexError
- Integer
- Interrupt
- Kernel
- KeyError
- LoadError
- LocalJumpError
- Marshal
- MatchData
- Math
- Math::DomainError
- Method
- Module
- Mutex
- NameError
- NilClass
- NoMemoryError
- NoMethodError
- NotImplementedError
- Numeric
- Object
- ObjectSpace
- ObjectSpace::WeakMap
- Proc
- Process
- Process::GID
- Process::Status
- Process::Sys
- Process::UID
- Queue
- Random
- Random::Formatter
- Range
- RangeError
- Rational
- Regexp
- RegexpError
- RubyVM
- RubyVM::AbstractSyntaxTree
- RubyVM::AbstractSyntaxTree::Node
- RubyVM::InstructionSequence
- RubyVM::MJIT
- RuntimeError
- ScriptError
- SecurityError
- Signal
- SignalException
- SizedQueue
- StandardError
- StopIteration
- String
- Struct
- Symbol
- SyntaxError
- SystemCallError
- SystemExit
- SystemStackError
- Thread
- Thread::Backtrace::Location
- ThreadError
- ThreadGroup
- Time
- TracePoint
- TrueClass
- TypeError
- UnboundMethod
- UncaughtThrowError
- UnicodeNormalize
- Warning
- ZeroDivisionError
- fatal
- unknown
No matching classes.
RubyVM::AbstractSyntaxTree
AbstractSyntaxTree provides methods to parse Ruby code into abstract syntax trees. The nodes in the tree are instances of RubyVM::AbstractSyntaxTree::Node.
Public Class Methods
RubyVM::AbstractSyntaxTree.of(proc) → RubyVM::AbstractSyntaxTree::Node click to toggle source
RubyVM::AbstractSyntaxTree.of(method) → RubyVM::AbstractSyntaxTree::Node
Returns AST nodes of the given proc or method.
RubyVM::AbstractSyntaxTree.of(proc {1 + 2}) # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:35, 1:42): > def hello puts "hello, world" end RubyVM::AbstractSyntaxTree.of(method(:hello)) # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:0, 3:3): >
static VALUE rb_ast_s_of(VALUE module, VALUE body) { VALUE path, node, lines; int node_id; const rb_iseq_t *iseq = NULL; if (rb_obj_is_proc(body)) { iseq = vm_proc_iseq(body); if (!rb_obj_is_iseq((VALUE)iseq)) { iseq = NULL; } } else { iseq = rb_method_iseq(body); } if (!iseq) return Qnil; path = rb_iseq_path(iseq); node_id = iseq->body->location.node_id; if (!NIL_P(lines = script_lines(path))) { node = rb_ast_parse_array(lines); } else if (RSTRING_LEN(path) == 2 && memcmp(RSTRING_PTR(path), "-e", 2) == 0) { node = rb_ast_parse_str(rb_e_script); } else { node = rb_ast_parse_file(path); } return node_find(node, node_id); }
RubyVM::AbstractSyntaxTree.parse(string) → RubyVM::AbstractSyntaxTree::Node click to toggle source
Parses the given string into an abstract syntax tree, returning the root node of that tree.
SyntaxError is raised if the given string is invalid syntax.
RubyVM::AbstractSyntaxTree.parse("x = 1 + 2") # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:0, 1:9): >
static VALUE rb_ast_s_parse(VALUE module, VALUE str) { return rb_ast_parse_str(str); }
RubyVM::AbstractSyntaxTree.parse_file(pathname) → RubyVM::AbstractSyntaxTree::Node click to toggle source
Reads the file from pathname
, then parses it like ::parse, returning the root node of the abstract syntax tree.
SyntaxError is raised if pathname
's contents are not valid Ruby syntax.
RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb") # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:0, 31:3): >
static VALUE rb_ast_s_parse_file(VALUE module, VALUE path) { return rb_ast_parse_file(path); }
This page was generated for Ruby
Ruby-doc.org is a service of James Britt and Neurogami, purveyors of fine dance noise.
Generated with Ruby-doc Rdoc Generator 0.44.0.