Skip to content
Paul Götze edited this page Oct 4, 2015 · 2 revisions

Examples

Braces are parsed as additional nested Arrays:

CodeBreaker.parse("1 + 3.5 * Rational(2,3) - Complex(1, 2)")
# => [Fixnum, :+, Float, :*, Rational, :-, Complex] 

CodeBreaker.parse("((1 + 3.5) - Rational(2,3)) * Complex(1, 2)")
# => [[[Fixnum, :+, Float], :-, Rational], :*, Complex] 

Empty strings and comments are parsed as an empty Array:

CodeBreaker.parse('')
CodeBreaker.parse('# a comment')
# => []
Clone this wiki locally