Sha256: 4c4f19e593478cae120bbb6da9fbfc274d4b3d50b741af03618a441aa0c3c6ca

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module Houndstooth::SemanticNode
    # The `true` keyword.
    class TrueKeyword < Base
        register_ast_converter :true do |ast_node|
            TrueKeyword.new(ast_node: ast_node)
        end

        def to_instructions(block)
            block.instructions << I::LiteralInstruction.new(block: block, node: self, value: true)
        end
    end

    # The `false` keyword.
    class FalseKeyword < Base
        register_ast_converter :false do |ast_node|
            FalseKeyword.new(ast_node: ast_node)
        end

        def to_instructions(block)
            block.instructions << I::LiteralInstruction.new(block: block, node: self, value: false)
        end
    end

    # The `self` keyword.
    class SelfKeyword < Base
        register_ast_converter :self do |ast_node|
            SelfKeyword.new(ast_node: ast_node)
        end

        def to_instructions(block)
            block.instructions << I::SelfInstruction.new(block: block, node: self)
        end
    end

    # The `nil` keyword.
    class NilKeyword < Base
        register_ast_converter :nil do |ast_node|
            NilKeyword.new(ast_node: ast_node)
        end

        def to_instructions(block)
            block.instructions << I::LiteralInstruction.new(block: block, node: self, value: nil)
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houndstooth-0.1.0 lib/houndstooth/semantic_node/keywords.rb