Class: Refi::MinilangScript
- Inherits:
-
Object
- Object
- Refi::MinilangScript
- Defined in:
- lib/minilang_refi.rb
Instance Method Summary collapse
- #assert_valid ⇒ Object
-
#compute_val ⇒ Object
TODO logger.
- #get_val ⇒ Object
-
#initialize(str) ⇒ MinilangScript
constructor
A new instance of MinilangScript.
- #report_errors ⇒ Object
- #run(env) ⇒ Object
- #valid ⇒ Object
Constructor Details
#initialize(str) ⇒ MinilangScript
251 252 253 254 255 |
# File 'lib/minilang_refi.rb', line 251 def initialize(str) @parser = MinilangGrammarParser.new @parse_result = @parser.parse(str) @val = nil end |
Instance Method Details
#assert_valid ⇒ Object
260 261 262 263 264 265 |
# File 'lib/minilang_refi.rb', line 260 def assert_valid unless valid report_errors dperr 1010,"#{self.class} assert_valid failed" end end |
#compute_val ⇒ Object
TODO logger
270 271 272 |
# File 'lib/minilang_refi.rb', line 270 def compute_val @val = @parse_result.content end |
#get_val ⇒ Object
273 274 275 |
# File 'lib/minilang_refi.rb', line 273 def get_val return @val || compute_val end |
#report_errors ⇒ Object
266 267 268 269 |
# File 'lib/minilang_refi.rb', line 266 def report_errors pp @parser.get_errors # TODO logger end |
#run(env) ⇒ Object
276 277 278 |
# File 'lib/minilang_refi.rb', line 276 def run env return @parse_result.run(env) end |
#valid ⇒ Object
256 257 258 259 |
# File 'lib/minilang_refi.rb', line 256 def valid return true if @parse_result return false end |