Class: RubyJsonParser::Parser
- Inherits:
-
Object
- Object
- RubyJsonParser::Parser
- Extended by:
- T::Sig
- Defined in:
- lib/ruby_json_parser/parser.rb
Overview
JSON parser
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(source) ⇒ Parser
Returns a new instance of Parser.
21 22 23 24 25 26 27 |
# File 'lib/ruby_json_parser/parser.rb', line 21 def initialize(source) # Lexer/Tokenizer that produces tokens @lexer = T.let(Lexer.new(source), Lexer) # Next token used for predicting productions @lookahead = T.let(Token.new(Token::NONE), Token) @errors = T.let([], T::Array[String]) end |
Class Method Details
.parse(source) ⇒ Object
13 14 15 |
# File 'lib/ruby_json_parser/parser.rb', line 13 def parse(source) new(source).parse end |