Sha256: f2704d415e261ef8dae40f218aeaa17d3c1fa077606f1acde362b53d12e74948
Contents?: true
Size: 607 Bytes
Versions: 3
Compression:
Stored size: 607 Bytes
Contents
require 'spec_helper' require 'dentaku/visitor/infix' class ArrayProcessor attr_reader :expression include Dentaku::Visitor::Infix def initialize @expression = [] end def process(node) @expression << node.to_s end end RSpec.describe Dentaku::Visitor::Infix do it 'generates array representation of operation' do processor = ArrayProcessor.new processor.visit(ast('5 + 3')) expect(processor.expression).to eq ['5', '+', '3'] end private def ast(expression) tokens = Dentaku::Tokenizer.new.tokenize(expression) Dentaku::Parser.new(tokens).parse end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
dentaku_zevo-3.5.2 | spec/visitor/infix_spec.rb |
dentaku-3.5.1 | spec/visitor/infix_spec.rb |
dentaku-3.5.0 | spec/visitor/infix_spec.rb |