Module: TExp
- Extended by:
- DSL
- Defined in:
- lib/texp/day_of_week_interval.rb,
lib/texp/dsl.rb,
lib/texp/ext.rb,
lib/texp/base.rb,
lib/texp/week.rb,
lib/texp/year.rb,
lib/texp/logic.rb,
lib/texp/month.rb,
lib/texp/parse.rb,
lib/texp/errors.rb,
lib/texp/window.rb,
lib/texp/version.rb,
lib/texp/every_day.rb,
lib/texp/operators.rb,
lib/texp/day_of_week.rb,
lib/texp/day_interval.rb,
lib/texp/day_of_month.rb,
lib/texp/week_interval.rb,
lib/texp/month_interval.rb
Overview
To change this template, choose Tools | Templates and open the template in the editor.
Defined Under Namespace
Modules: DSL, Extensions Classes: And, Base, DateArgumentError, DayInterval, DayOfMonth, DayOfWeek, DayOfWeekInterval, Error, EvalEnvironment, EveryDay, Month, MonthInterval, MultiTermBase, Not, Or, ParseCallback, ParseError, SingleTermBase, TExpError, TExpIncludeError, Week, WeekInterval, Window, Year
Constant Summary collapse
- PARSE_CALLBACKS =
:nodoc:
{}
- TOKEN_PATTERNS =
Lexical Definitions
[ # Dates '\d\d\d\d-\d\d-\d\d', # Numbers '[+-]?\d+', # Extension Tokens '<(?:[a-zA-Z_][a-zA-Z0-9_]*::)?[a-zA-Z_][a-zA-Z0-9_]*>', # Everything else is a single character # (except commas and spaces which are ignored) '[^, ]', ].join('|')
- TOKEN_RE =
:nodoc:
Regexp.new(TOKEN_PATTERNS)
- MARK =
Mark the end of the list.
:mark
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.parse(string) ⇒ Object
Return the temporal expression encoded by string.
- .parse_callbacks ⇒ Object
-
.register_parse_callback(token, callback) ⇒ Object
Register a parsing callback.
Methods included from DSL
day, dow, evaluate_expression_in_environment, every, month, normalize_units, on, week, year
Class Method Details
.parse(string) ⇒ Object
Return the temporal expression encoded by string.
31 32 33 34 35 36 37 38 |
# File 'lib/texp/parse.rb', line 31 def parse(string) @stack = [] string.scan(TOKEN_RE) do |tok| compile(tok) end fail ParseError, "Incomplete expression" if @stack.size > 1 @stack.pop end |
.parse_callbacks ⇒ Object
40 41 42 |
# File 'lib/texp/parse.rb', line 40 def parse_callbacks PARSE_CALLBACKS end |
.register_parse_callback(token, callback) ⇒ Object
Register a parsing callback. Individual Temporal Expression classes will register their own callbacks as needed. A handful of non-class based parser callbacks are registered below.
26 27 28 |
# File 'lib/texp/parse.rb', line 26 def register_parse_callback(token, callback) PARSE_CALLBACKS[token] = callback end |