Sha256: 84cd497fbeb8a4563716e57b6e1f026e28fb524ef3e78a1452d71faebd14fd97

Contents?: true

Size: 990 Bytes

Versions: 5

Compression:

Stored size: 990 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

    class Integer < Treetop::Runtime::SyntaxNode
      def type
        :integer
      end

      def text_value
        super.to_i
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slate-1.0.3 lib/slate/parser/extensions.rb
slate-1.0.2 lib/slate/parser/extensions.rb
slate-1.0.1 lib/slate/parser/extensions.rb
slate-1.0.0 lib/slate/parser/extensions.rb
slate-0.2.1 lib/slate/parser/extensions.rb