class ERLE::Ref

Public Class Methods

new(input) click to toggle source
# File lib/erle/elements/ref.rb, line 10
def initialize(input)
  @input = input
end
parse(parser) click to toggle source
# File lib/erle/elements/ref.rb, line 20
def self.parse(parser)

  result = parser.scan(@pattern)

  if close && !parser.scan(close)
    raise parser.raise_unexpected_token("Expected term closure \" #{close.source} \"")
  end

  # Make sure we kill any trailing close
  # TODO: Consider raising if no match?
  # TODO: Consider doing only if we started with an opening...
  # parser.scan(ERLE::Registry.closings_regex)
  new(result)
end

Public Instance Methods

to_ruby() click to toggle source

TODO: Leverage Enum, and refactor (Enum) to handle conflicting delimiters e.g. a “.” delimeter is preempted by the “float” pattern.

# File lib/erle/elements/ref.rb, line 16
def to_ruby
  @output ||= @input.split(".")
end