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
Ctor.
-
#to_term ⇒ Term
Convert it to a term.
Constructor Details
#initialize(query) ⇒ Syntax
Ctor.
34 35 36 |
# File 'lib/factbase/syntax.rb', line 34 def initialize(query) @query = query end |
Instance Method Details
#to_term ⇒ Term
Convert it to a term.
40 41 42 43 44 45 46 |
# File 'lib/factbase/syntax.rb', line 40 def to_term @tokens ||= to_tokens @ast ||= to_ast(@tokens, 0) term = @ast[0] raise 'No terms found' if term.nil? term end |