Sha256: 85c34517fe3870abaa78f5ab847554025761a93171ff4555f4c7379e334e7c79
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
require 'spec_helper' describe "the README examples" do it 'works as announced' do grammar = Sexpr.load(<<-YAML) # alternative rule bool_expr: - bool_and - bool_or - bool_not - var_ref - literal # non-terminal bool_and: - [ bool_expr, bool_expr ] bool_or: - [ bool_expr, bool_expr ] bool_not: - [ bool_expr ] literal: - [ truth_value ] var_ref: - [ var_name ] # terminals var_name: !ruby/regexp /^[a-z]+$/ truth_value: - true - false YAML f = (grammar === [:bool_and, [:bool_not, [:var_ref, "x"]], [:literal, true]]) f.should be_true f = (grammar === [:bool_and, [:literal, "true"]]) f.should be_false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.2.0 | spec/test_readme_examples.rb |