Module: Namarara
- Defined in:
- lib/namarara.rb,
lib/namarara.rb,
lib/namarara/lexer.rb,
lib/namarara/parser.rb,
lib/namarara/version.rb,
lib/namarara/eval_error.rb,
lib/namarara/errors/invalid_grammar.rb,
lib/namarara/errors/var_not_defined.rb
Defined Under Namespace
Modules: Errors Classes: AndOp, BoolValue, EqOp, EvalError, Lexer, NotOp, NumberValue, OrOp, Parser, StringValue, TreeExpr, TreeValue, VarValue
Constant Summary collapse
- VERSION =
'0.9.5'
Class Method Summary collapse
Class Method Details
.parse_string(line, vars, debug = false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/namarara.rb', line 16 def self.parse_string(line, vars, debug = false) parser = Parser.new(Lexer.new) parser.names = vars parser_bet = parser.parse(line.chomp, debug) parser.check_grammar line, parser_bet { expr: line, tree: parser_bet.to_s, errors: parser_bet&.errors&.map { |e| e. }, result: parser_bet&.compute } end |