Class: Lisp::Format::Directives::ArgJump

Inherits:
Directive show all
Defined in:
lib/carat/lisp-format.rb

Overview

Represents the ~* (Argument jumping) directive. This moves arbitrarily amongst the arguments passed to the formatting engine.

Instance Attribute Summary

Attributes inherited from Directive

#pos

Instance Method Summary collapse

Methods inherited from Directive

#initialize, #join

Constructor Details

This class inherits a constructor from Lisp::Format::Directives::Directive

Instance Method Details

#execute(state) ⇒ Object

Moves backwards or forwards, relative or absolute, among the formatting arguments. The full form is

~n:@*

with the following interpretations

n (1)

the amount of arguments to move or the argument to move to if moving to an absolute position, indexed from zero (0),

:

move backwards n arguments

@

move to the n:th argument, using zero-based indexing (absolute).



1400
1401
1402
1403
# File 'lib/carat/lisp-format.rb', line 1400

def execute(state)
  n = param(0, state, 1)
  state.args_move(colon_mod? ? -n : n, !at_mod?)
end