Class: MiniRuby::Parser
- Inherits:
-
Object
- Object
- MiniRuby::Parser
- Extended by:
- T::Sig
- Defined in:
- lib/miniruby/parser.rb
Overview
MiniRuby parser
Defined Under Namespace
Classes: Result
Class Method Summary collapse
-
.parse(source) ⇒ Object
: (String source) -> Result.
Instance Method Summary collapse
-
#initialize(source) ⇒ Parser
constructor
: (String source) -> void.
-
#parse ⇒ Object
: -> Result.
Constructor Details
#initialize(source) ⇒ Parser
: (String source) -> void
23 24 25 26 27 28 29 |
# File 'lib/miniruby/parser.rb', line 23 def initialize(source) # Lexer/Tokenizer that produces tokens @lexer = Lexer.new(source) #: Lexer # Next token used for predicting productions @lookahead = Token.new(Token::NONE, Span::ZERO) #: Token @errors = [] #: Array[String] end |
Class Method Details
.parse(source) ⇒ Object
: (String source) -> Result
15 16 17 |
# File 'lib/miniruby/parser.rb', line 15 def parse(source) new(source).parse end |