Class: ERLE::String

Inherits:
Term
  • Object
show all
Defined in:
lib/erle/elements/string.rb

Constant Summary collapse

PATTERN =

pattern %r|

     # escaped special characters:
    \\["/bfnrt] |
    \\u[0-9a-fA-F]{4 |
     # match all but escaped special characters:
    \\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*)
}nx
%r{[^\"]*}nx

Instance Attribute Summary

Attributes inherited from Term

#input, #output

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Term

enclosure, #initialize, pattern, to_ruby, until_any_closing

Constructor Details

This class inherits a constructor from ERLE::Term

Class Method Details

.parse(parser) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/erle/elements/string.rb', line 20

def self.parse(parser)
  opener = parser.matched == "\""

  parser.scan(PATTERN)
  result = parser.matched

  parser.scan(close) if opener

  new(result)
end

Instance Method Details

#to_rubyObject



15
16
17
18
# File 'lib/erle/elements/string.rb', line 15

def to_ruby
  # self.str.gsub(/"/,"")
  @output ||= @input
end