Class: Omnium::Parser::Core
- Inherits:
-
Object
- Object
- Omnium::Parser::Core
- Includes:
- Common, AST, ParseErrorHandler
- Defined in:
- lib/omnium/parser/core.rb
Overview
The parser will verify the format of a list of tokens (syntax analysis) by ‘recursive-descent’.
Constant Summary
Constants included from Common
Common::NIL_VALUE_TOKENS, Common::PARAMETERISED_TOKENS, Common::RESERVED_KEYWORDS, Common::TOKENS, Common::VALUE_BASED_TOKENS
Instance Method Summary collapse
-
#initialize(lexer) ⇒ Core
constructor
A new instance of Core.
- #parse ⇒ Object
Methods included from ParseErrorHandler
Methods included from Common
define_token_predicate_method, define_token_type_method, token_entity
Constructor Details
#initialize(lexer) ⇒ Core
Returns a new instance of Core.
12 13 14 15 16 |
# File 'lib/omnium/parser/core.rb', line 12 def initialize(lexer) @lexer = lexer @token = nil @consumed_token = nil end |
Instance Method Details
#parse ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/omnium/parser/core.rb', line 18 def parse @token = @lexer.next_token node = program error(expected_type: eof_token, actual_type: @token.type) unless eof? node end |