Sha256: edb3520df1dcb2f89983eead0af45c6eb454111d8c8a8af315bb071599c0dd6d

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

module Slate
  module SlateTree
    class Target < Treetop::Runtime::SyntaxNode
      def type
        :target
      end

      def text_value
        elements.detect{ |e| e.is_a? String }.text_value
      end
    end

    class Function < Treetop::Runtime::SyntaxNode
      def type
        :function
      end

      def text_value
        elements.detect{ |e| e.is_a? Token }.text_value
      end
    end

    class Token < Treetop::Runtime::SyntaxNode
      def type
        :token
      end
    end

    class Argument < Treetop::Runtime::SyntaxNode
      def type
        :argument
      end

      def text_value
        elements.first.text_value
      end
    end

    class String < Treetop::Runtime::SyntaxNode
      def type
        :string
      end

      def text_value
        super.gsub(/"/,'')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slate-0.2.0 lib/slate/parser/extensions.rb
slate-0.1.0 lib/slate/parser/extensions.rb