Module: CEML::Casting
- Includes:
- Lexer, Treetop::Runtime
- Included in:
- CastingParser, Scripts
- Defined in:
- lib/ceml/lang/tt/casting.rb
Defined Under Namespace
Modules: CastingStatement0, OverPhrase0, StanzaMarker0, WithMatchingPhrase0, WithinPhrase0
Instance Method Summary collapse
- #_nt_casting_statement ⇒ Object
- #_nt_modifier_phrase ⇒ Object
- #_nt_over_phrase ⇒ Object
- #_nt_stanza_marker ⇒ Object
- #_nt_with_matching_phrase ⇒ Object
- #_nt_within_phrase ⇒ Object
- #root ⇒ Object
Methods included from Lexer
#_nt_and, #_nt_comment, #_nt_distance, #_nt_duration, #_nt_eol, #_nt_id, #_nt_linebreak, #_nt_mapped_role, #_nt_nl, #_nt_number, #_nt_qualifier, #_nt_range, #_nt_reserved_word, #_nt_role, #_nt_rolemap, #_nt_rolename, #_nt_roles, #_nt_text, #_nt_ws
Instance Method Details
#_nt_casting_statement ⇒ Object
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ceml/lang/tt/casting.rb', line 32 def _nt_casting_statement start_index = index if node_cache[:casting_statement].has_key?(index) cached = node_cache[:casting_statement][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r2 = _nt_stanza_marker if r2 r1 = r2 else r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 i3 = index if has_terminal?('gather', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure('gather') r4 = nil end if r4 r3 = r4 else if has_terminal?('await', false, index) r5 = instantiate_node(SyntaxNode,input, index...(index + 5)) @index += 5 else terminal_parse_failure('await') r5 = nil end if r5 r3 = r5 else if has_terminal?('nab', false, index) r6 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('nab') r6 = nil end if r6 r3 = r6 else if has_terminal?('accept', false, index) r7 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure('accept') r7 = nil end if r7 r3 = r7 else @index = i3 r3 = nil end end end end s0 << r3 if r3 r8 = _nt_ws s0 << r8 if r8 r9 = _nt_roles s0 << r9 if r9 s10, i10 = [], index loop do r11 = _nt_modifier_phrase if r11 s10 << r11 else break end end r10 = instantiate_node(SyntaxNode,input, i10...index, s10) s0 << r10 end end end end if s0.last r0 = instantiate_node(CastingStatement,input, i0...index, s0) r0.extend(CastingStatement0) else @index = i0 r0 = nil end node_cache[:casting_statement][start_index] = r0 r0 end |
#_nt_modifier_phrase ⇒ Object
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/ceml/lang/tt/casting.rb', line 196 def _nt_modifier_phrase start_index = index if node_cache[:modifier_phrase].has_key?(index) cached = node_cache[:modifier_phrase][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_over_phrase if r1 r0 = r1 else r2 = _nt_within_phrase if r2 r0 = r2 else r3 = _nt_with_matching_phrase if r3 r0 = r3 else @index = i0 r0 = nil end end end node_cache[:modifier_phrase][start_index] = r0 r0 end |
#_nt_over_phrase ⇒ Object
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/ceml/lang/tt/casting.rb', line 245 def _nt_over_phrase start_index = index if node_cache[:over_phrase].has_key?(index) cached = node_cache[:over_phrase][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_ws s0 << r1 if r1 if has_terminal?('over', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 4)) @index += 4 else terminal_parse_failure('over') r2 = nil end s0 << r2 if r2 r3 = _nt_ws s0 << r3 if r3 r4 = _nt_duration s0 << r4 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(OverPhrase0) else @index = i0 r0 = nil end node_cache[:over_phrase][start_index] = r0 r0 end |
#_nt_stanza_marker ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/ceml/lang/tt/casting.rb', line 145 def _nt_stanza_marker start_index = index if node_cache[:stanza_marker].has_key?(index) cached = node_cache[:stanza_marker][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('(', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('(') r1 = nil end s0 << r1 if r1 r2 = _nt_id s0 << r2 if r2 if has_terminal?(')', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(')') r3 = nil end s0 << r3 if r3 r4 = _nt_nl s0 << r4 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(StanzaMarker0) else @index = i0 r0 = nil end node_cache[:stanza_marker][start_index] = r0 r0 end |
#_nt_with_matching_phrase ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/ceml/lang/tt/casting.rb', line 367 def _nt_with_matching_phrase start_index = index if node_cache[:with_matching_phrase].has_key?(index) cached = node_cache[:with_matching_phrase][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_ws s0 << r1 if r1 if has_terminal?('with', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 4)) @index += 4 else terminal_parse_failure('with') r2 = nil end s0 << r2 if r2 r3 = _nt_ws s0 << r3 if r3 if has_terminal?('matching', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 8)) @index += 8 else terminal_parse_failure('matching') r4 = nil end s0 << r4 if r4 r5 = _nt_ws s0 << r5 if r5 r6 = _nt_id s0 << r6 end end end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(WithMatchingPhrase0) else @index = i0 r0 = nil end node_cache[:with_matching_phrase][start_index] = r0 r0 end |
#_nt_within_phrase ⇒ Object
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/ceml/lang/tt/casting.rb', line 304 def _nt_within_phrase start_index = index if node_cache[:within_phrase].has_key?(index) cached = node_cache[:within_phrase][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_ws s0 << r1 if r1 if has_terminal?('within', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure('within') r2 = nil end s0 << r2 if r2 r3 = _nt_ws s0 << r3 if r3 r4 = _nt_distance s0 << r4 end end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(WithinPhrase0) else @index = i0 r0 = nil end node_cache[:within_phrase][start_index] = r0 r0 end |
#root ⇒ Object
8 9 10 |
# File 'lib/ceml/lang/tt/casting.rb', line 8 def root @root ||= :casting_statement end |