Sha256: c041f0061e91fd2735c47f865a9c6e840935250b6a5282a45b3cce57d9bf24a9
Contents?: true
Size: 1.62 KB
Versions: 5
Compression:
Stored size: 1.62 KB
Contents
module ToSource # Abstract base class for emitter command class Command include Adamantium::Flat # A null command NULL = Class.new(self) do # Run command # # @param [State] _state # # @return [self] # # @api private # def run(_state) self end end.new.freeze # Command that emits token class Token < self # Return token content # # @return [String] # # @api private # attr_reader :content # Run command # # @param [State] state # # @return [self] # # @api private # def run(state) state.push(self) self end private # Initialize object # # @param [String] content # # @return [undefined] # # @api private # def initialize(content) @content = content end end # Command that does a shift class Shift < self include Equalizer.new(:width) # Return shift width # # @return [Fixnum] # # @api private # attr_reader :width # Run command # # @param [State] state # # @return [self] # # @api private # def run(state) state.shift(width) self end private # Initialize command # # @param [Fixnum] width # # @return [undefined] # # @api private # def initialize(width) @width = width end INDENT = Shift.new( 2) UNINDENT = Shift.new(-2) end end end
Version data entries
5 entries across 5 versions & 1 rubygems