File: README

package info (click to toggle)
ruby-expression-parser 0.9.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 152 kB
  • sloc: ruby: 293; makefile: 11
file content (14 lines) | stat: -rw-r--r-- 286 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Taken from http://lukaszwrobel.pl/blog/math-parser-part-3-implementation
require 'rubygems'
require 'expression_parser'

parser = ExpressionParser::Parser.new

loop do
  begin
    print '>> '
    puts parser.parse(gets)
  rescue RuntimeError
    puts 'Error occured: ' + $!
  end
end