Class: Mailmate::Parser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mailmate/parser.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Filter-language parser. Use ‘Mailmate.compile_filter` as the public surface.

Defined Under Namespace

Classes: Error

Constant Summary collapse

UNITS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  "day" => :day, "days" => :day,
  "week" => :week, "weeks" => :week,
  "month" => :month, "months" => :month,
  "year" => :year, "years" => :year,
}.freeze
DATE_LIKE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/\A\s*\d{4}[-\/.]\d{1,2}([-\/.]\d{1,2}|.*\d{2}:\d{2})/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ Parser

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Parser.



46
47
48
49
# File 'lib/mailmate/parser.rb', line 46

def initialize(tokens)
  @tokens = tokens
  @i = 0
end

Class Method Details

.parse(tokens) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/mailmate/parser.rb', line 42

def self.parse(tokens)
  new(tokens).parse_filter
end

Instance Method Details

#parse_filterObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
54
55
# File 'lib/mailmate/parser.rb', line 51

def parse_filter
  expr = parse_expr
  expect(:eof)
  expr
end