Class: Spectre::StringParsing::PunctParser
- Inherits:
-
Object
- Object
- Spectre::StringParsing::PunctParser
show all
- Includes:
- Parser
- Defined in:
- lib/spectre/string/primitives.rb
Overview
Matches punctuation symbols. Shortcut: punct_char
.
Instance Attribute Summary
Attributes included from Parser
#node
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Parser
#backtrack, #create_match, from_POD, #pre_skip?, #to_p
Instance Method Details
#inspect ⇒ Object
294
295
296
|
# File 'lib/spectre/string/primitives.rb', line 294
def inspect
"[punct_char]"
end
|
#scan(iter) ⇒ Object
282
283
284
285
286
287
288
289
290
291
292
|
# File 'lib/spectre/string/primitives.rb', line 282
def scan iter
return nil unless iter.valid?
char = +iter
if char and ( char[0].between? 33, 126 ) and ( not ('a'..'z').include? char ) and
( not ('A'..'Z').include? char ) and ( not ('0'..'9').include? char )
create_match iter, char
else
nil
end
end
|