Class: Lisp::Format::Directives::SkipWhitespace

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

Overview

Represents the ~?n (Real new-line) directive. This is used to skip the new-line and any following white-space characters in the input format. This is useful in long format strings, where the string has to be split into multiple lines without ruining indentation.

Instance Attribute Summary

Attributes inherited from Directive

#pos

Instance Method Summary collapse

Methods inherited from Directive

#execute, #initialize

Constructor Details

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

Instance Method Details

#join(other) ⇒ Object

Join this directive with the following. This removes any new-line and/or following white-space from the directive that follows, if it is a string Literal.



1338
1339
1340
1341
1342
1343
# File 'lib/carat/lisp-format.rb', line 1338

def join(other)
  return other if not other.is_a?(FormatLiteral) or colon_mod?
  other.sub!(/^[\s\t]+/, '')
  other[0,0] = '\n' if at_mod?
  other
end