Module: Brevity::StretchModifier
- Includes:
- Duration, Treetop::Runtime
- Included in:
- Modifier, StretchModifierParser
- Defined in:
- lib/brevity/parsing/modifiers/stretch_modifier.rb
Defined Under Namespace
Modules: StretchModifier0
Instance Method Summary collapse
Methods included from Duration
#_nt_den_only, #_nt_duration, #_nt_num_and_den, #_nt_num_only
Methods included from PositiveInteger
Methods included from NonnegativeInteger
Instance Method Details
#_nt_stretch_modifier ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/brevity/parsing/modifiers/stretch_modifier.rb', line 25 def _nt_stretch_modifier start_index = index if node_cache[:stretch_modifier].has_key?(index) cached = node_cache[:stretch_modifier][index] if cached node_cache[:stretch_modifier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?(@regexps[gr = '\A[=*]'] ||= Regexp.new(gr), :regexp, index) r1 = true @index += 1 else terminal_parse_failure('[=*]') r1 = nil end s0 << r1 if r1 r2 = _nt_duration s0 << r2 end if s0.last r0 = instantiate_node(StretchModifierNode,input, i0...index, s0) r0.extend(StretchModifier0) else @index = i0 r0 = nil end node_cache[:stretch_modifier][start_index] = r0 r0 end |
#root ⇒ Object
9 10 11 |
# File 'lib/brevity/parsing/modifiers/stretch_modifier.rb', line 9 def root @root ||= :stretch_modifier end |