Class: Spectre::StringParsing::GraphParser

Inherits:
Object
  • Object
show all
Includes:
Parser
Defined in:
lib/spectre/string/primitives.rb

Overview

Matches non-space printing characters. Shortcut: graph_char.

Instance Attribute Summary

Attributes included from Parser

#node

Instance Method Summary collapse

Methods included from Parser

#backtrack, #create_match, from_POD, #pre_skip?, #to_p

Instance Method Details

#inspectObject



225
226
227
# File 'lib/spectre/string/primitives.rb', line 225

def inspect
    "[graph_char]"
end

#negationObject



212
# File 'lib/spectre/string/primitives.rb', line 212

def negation; Negations::NegatedSingleTokenParser.new; end

#scan(iter) ⇒ Object



214
215
216
217
218
219
220
221
222
223
# File 'lib/spectre/string/primitives.rb', line 214

def scan iter
    return nil unless iter.valid?
    char = +iter

    if char and char[0].between? 33, 126
        create_match iter, char
    else
        nil
    end
end