Class: Factbase::Syntax
- Inherits:
-
Object
- Object
- Factbase::Syntax
- Defined in:
- lib/factbase/syntax.rb
Overview
Syntax.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(query) ⇒ Syntax
constructor
A new instance of Syntax.
-
#to_term ⇒ Term
Convert it to a term.
Constructor Details
#initialize(query) ⇒ Syntax
Returns a new instance of Syntax.
32 33 34 |
# File 'lib/factbase/syntax.rb', line 32 def initialize(query) @query = query end |
Instance Method Details
#to_term ⇒ Term
Convert it to a term.
38 39 40 41 42 43 44 |
# File 'lib/factbase/syntax.rb', line 38 def to_term @tokens ||= to_tokens @ast ||= to_ast(@tokens, 0) term = @ast[0] raise 'No terms found' if term.nil? term end |