Class: Oga::XPath::Parser Private
- Inherits:
-
LL::Driver
- Object
- LL::Driver
- Oga::XPath::Parser
- Defined in:
- lib/oga/xpath/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.
AST parser for XPath expressions. The AST is built using AST::Node
instances.
Unlike Oga::XML::Parser this parser only takes String instances as input.
Constant Summary collapse
- CONFIG =
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.
LL::DriverConfig.new
- CACHE =
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.
LRU.new
Class Method Summary collapse
Instance Method Summary collapse
-
#_rule_0(val) ⇒ Object
private
-
#_rule_1(val) ⇒ Object
private
-
#_rule_10(val) ⇒ Object
private
-
#_rule_11(val) ⇒ Object
private
-
#_rule_12(val) ⇒ Object
private
-
#_rule_13(val) ⇒ Object
private
-
#_rule_14(val) ⇒ Object
private
-
#_rule_15(val) ⇒ Object
private
-
#_rule_16(val) ⇒ Object
private
-
#_rule_17(val) ⇒ Object
private
-
#_rule_18(val) ⇒ Object
private
-
#_rule_19(val) ⇒ Object
private
-
#_rule_2(val) ⇒ Object
private
-
#_rule_20(val) ⇒ Object
private
-
#_rule_21(val) ⇒ Object
private
-
#_rule_22(val) ⇒ Object
private
-
#_rule_23(val) ⇒ Object
private
-
#_rule_24(val) ⇒ Object
private
-
#_rule_25(val) ⇒ Object
private
-
#_rule_26(val) ⇒ Object
private
-
#_rule_27(val) ⇒ Object
private
-
#_rule_28(val) ⇒ Object
private
-
#_rule_29(val) ⇒ Object
private
-
#_rule_3(val) ⇒ Object
private
-
#_rule_30(val) ⇒ Object
private
-
#_rule_31(val) ⇒ Object
private
-
#_rule_32(val) ⇒ Object
private
-
#_rule_33(val) ⇒ Object
private
-
#_rule_34(val) ⇒ Object
private
-
#_rule_35(val) ⇒ Object
private
-
#_rule_36(val) ⇒ Object
private
-
#_rule_37(val) ⇒ Object
private
-
#_rule_38(val) ⇒ Object
private
-
#_rule_39(val) ⇒ Object
private
-
#_rule_4(val) ⇒ Object
private
-
#_rule_40(val) ⇒ Object
private
-
#_rule_41(val) ⇒ Object
private
-
#_rule_42(val) ⇒ Object
private
-
#_rule_43(val) ⇒ Object
private
-
#_rule_44(val) ⇒ Object
private
-
#_rule_45(val) ⇒ Object
private
-
#_rule_46(val) ⇒ Object
private
-
#_rule_47(val) ⇒ Object
private
-
#_rule_48(val) ⇒ Object
private
-
#_rule_49(val) ⇒ Object
private
-
#_rule_5(val) ⇒ Object
private
-
#_rule_50(val) ⇒ Object
private
-
#_rule_51(val) ⇒ Object
private
-
#_rule_52(val) ⇒ Object
private
-
#_rule_53(val) ⇒ Object
private
-
#_rule_54(val) ⇒ Object
private
-
#_rule_55(val) ⇒ Object
private
-
#_rule_56(val) ⇒ Object
private
-
#_rule_57(val) ⇒ Object
private
-
#_rule_58(val) ⇒ Object
private
-
#_rule_59(val) ⇒ Object
private
-
#_rule_6(val) ⇒ Object
private
-
#_rule_60(val) ⇒ Object
private
-
#_rule_61(val) ⇒ Object
private
-
#_rule_62(val) ⇒ Object
private
-
#_rule_63(val) ⇒ Object
private
-
#_rule_64(val) ⇒ Object
private
-
#_rule_65(val) ⇒ Object
private
-
#_rule_66(val) ⇒ Object
private
-
#_rule_67(val) ⇒ Object
private
-
#_rule_68(val) ⇒ Object
private
-
#_rule_69(val) ⇒ Object
private
-
#_rule_7(val) ⇒ Object
private
-
#_rule_8(val) ⇒ Object
private
-
#_rule_9(val) ⇒ Object
private
-
#combine_operators(val) ⇒ Object
private
-
#combine_optional_operator(val) ⇒ Object
private
-
#each_token {|| ... } ⇒ Object
private
Yields the next token from the lexer.
-
#initialize(data) ⇒ Parser
constructor
private
A new instance of Parser.
-
#s(type, *children) ⇒ AST::Node
private
Creates a new XPath node.
Constructor Details
#initialize(data) ⇒ 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
260 261 262 |
# File 'lib/oga/xpath/parser.rb', line 260 def initialize(data) @lexer = Lexer.new(data) end |
Class Method Details
.parse_with_cache(data) ⇒ AST::Node
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.
255 256 257 |
# File 'lib/oga/xpath/parser.rb', line 255 def self.parse_with_cache(data) CACHE.get_or_set(data) { new(data).parse } end |
Instance Method Details
#_rule_0(val) ⇒ 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.
308 309 310 |
# File 'lib/oga/xpath/parser.rb', line 308 def _rule_0(val) val[0] end |
#_rule_1(val) ⇒ 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.
312 313 314 |
# File 'lib/oga/xpath/parser.rb', line 312 def _rule_1(val) combine_operators(val) end |
#_rule_10(val) ⇒ 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.
348 349 350 |
# File 'lib/oga/xpath/parser.rb', line 348 def _rule_10(val) [:gt, val[1]] end |
#_rule_11(val) ⇒ 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.
352 353 354 |
# File 'lib/oga/xpath/parser.rb', line 352 def _rule_11(val) [:lte, val[1]] end |
#_rule_12(val) ⇒ 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.
356 357 358 |
# File 'lib/oga/xpath/parser.rb', line 356 def _rule_12(val) [:gte, val[1]] end |
#_rule_13(val) ⇒ 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.
360 361 362 |
# File 'lib/oga/xpath/parser.rb', line 360 def _rule_13(val) combine_operators(val) end |
#_rule_14(val) ⇒ 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.
364 365 366 |
# File 'lib/oga/xpath/parser.rb', line 364 def _rule_14(val) [:add, val[1]] end |
#_rule_15(val) ⇒ 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.
368 369 370 |
# File 'lib/oga/xpath/parser.rb', line 368 def _rule_15(val) [:sub, val[1]] end |
#_rule_16(val) ⇒ 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.
372 373 374 |
# File 'lib/oga/xpath/parser.rb', line 372 def _rule_16(val) combine_optional_operator(val) end |
#_rule_17(val) ⇒ 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.
376 377 378 |
# File 'lib/oga/xpath/parser.rb', line 376 def _rule_17(val) [:div, val[1]] end |
#_rule_18(val) ⇒ 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.
380 381 382 |
# File 'lib/oga/xpath/parser.rb', line 380 def _rule_18(val) [:mod, val[1]] end |
#_rule_19(val) ⇒ 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.
384 385 386 |
# File 'lib/oga/xpath/parser.rb', line 384 def _rule_19(val) [:mul, val[1]] end |
#_rule_2(val) ⇒ 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.
316 317 318 |
# File 'lib/oga/xpath/parser.rb', line 316 def _rule_2(val) [:or, val[1]] end |
#_rule_20(val) ⇒ 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.
388 389 390 |
# File 'lib/oga/xpath/parser.rb', line 388 def _rule_20(val) combine_operators(val) end |
#_rule_21(val) ⇒ 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.
392 393 394 |
# File 'lib/oga/xpath/parser.rb', line 392 def _rule_21(val) [:pipe, val[1]] end |
#_rule_22(val) ⇒ 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.
396 397 398 |
# File 'lib/oga/xpath/parser.rb', line 396 def _rule_22(val) val[0] end |
#_rule_23(val) ⇒ 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.
400 401 402 |
# File 'lib/oga/xpath/parser.rb', line 400 def _rule_23(val) val[0] end |
#_rule_24(val) ⇒ 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.
404 405 406 |
# File 'lib/oga/xpath/parser.rb', line 404 def _rule_24(val) val[0] end |
#_rule_25(val) ⇒ 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.
408 409 410 |
# File 'lib/oga/xpath/parser.rb', line 408 def _rule_25(val) val[0] end |
#_rule_26(val) ⇒ 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.
412 413 414 |
# File 'lib/oga/xpath/parser.rb', line 412 def _rule_26(val) val[0] end |
#_rule_27(val) ⇒ 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.
416 417 418 |
# File 'lib/oga/xpath/parser.rb', line 416 def _rule_27(val) val[1] end |
#_rule_28(val) ⇒ 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.
420 421 422 423 424 425 426 427 428 |
# File 'lib/oga/xpath/parser.rb', line 420 def _rule_28(val) if val[1] s(:absolute_path, val[1]) else s(:absolute_path) end end |
#_rule_29(val) ⇒ 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.
430 431 432 |
# File 'lib/oga/xpath/parser.rb', line 430 def _rule_29(val) val[0] end |
#_rule_3(val) ⇒ 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.
320 321 322 |
# File 'lib/oga/xpath/parser.rb', line 320 def _rule_3(val) combine_operators(val) end |
#_rule_30(val) ⇒ 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.
434 435 436 |
# File 'lib/oga/xpath/parser.rb', line 434 def _rule_30(val) val[0] end |
#_rule_31(val) ⇒ 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.
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/oga/xpath/parser.rb', line 438 def _rule_31(val) type = val[1][0] args = val[1][1] pred = val[1][2] more = val[1][3] if type.equal?(:test) # Whenever a bare test is used (e.g. just "A") this actually means # "child::A". Handling this on parser level is the easiest. if args node = s(:axis, 'child', s(:test, val[0], args)) else node = s(:axis, 'child', s(:test, nil, val[0])) end else node = s(type, val[0], *args) end if pred node = s(:predicate, node, pred) end if more node = node.updated(nil, node.children + [more]) end node end |
#_rule_32(val) ⇒ 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.
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/oga/xpath/parser.rb', line 469 def _rule_32(val) pred = val[1] more = val[2] node = s(:axis, 'child', val[0]) if pred node = s(:predicate, node, pred) end if more node = node.updated(nil, node.children + [more]) end node end |
#_rule_33(val) ⇒ 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.
487 488 489 |
# File 'lib/oga/xpath/parser.rb', line 487 def _rule_33(val) [:call, val[1]] end |
#_rule_34(val) ⇒ 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.
491 492 493 |
# File 'lib/oga/xpath/parser.rb', line 491 def _rule_34(val) [:test, val[1], val[2], val[3]] end |
#_rule_35(val) ⇒ 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.
495 496 497 |
# File 'lib/oga/xpath/parser.rb', line 495 def _rule_35(val) [:test, nil, val[0], val[1]] end |
#_rule_36(val) ⇒ 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.
499 500 501 |
# File 'lib/oga/xpath/parser.rb', line 499 def _rule_36(val) val[1] end |
#_rule_37(val) ⇒ 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.
503 504 505 |
# File 'lib/oga/xpath/parser.rb', line 503 def _rule_37(val) val[1] end |
#_rule_38(val) ⇒ 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.
507 508 509 |
# File 'lib/oga/xpath/parser.rb', line 507 def _rule_38(val) s(:type_test, val[0]) end |
#_rule_39(val) ⇒ 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.
511 512 513 514 515 |
# File 'lib/oga/xpath/parser.rb', line 511 def _rule_39(val) val[1] ? s(:test, val[0], val[1]) : s(:test, nil, val[0]) end |
#_rule_4(val) ⇒ 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.
324 325 326 |
# File 'lib/oga/xpath/parser.rb', line 324 def _rule_4(val) [:and, val[1]] end |
#_rule_40(val) ⇒ 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.
517 518 519 |
# File 'lib/oga/xpath/parser.rb', line 517 def _rule_40(val) val[1] end |
#_rule_41(val) ⇒ 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.
521 522 523 |
# File 'lib/oga/xpath/parser.rb', line 521 def _rule_41(val) [val[0], *val[1]] end |
#_rule_42(val) ⇒ 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.
525 526 527 |
# File 'lib/oga/xpath/parser.rb', line 525 def _rule_42(val) val end |
#_rule_43(val) ⇒ 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.
529 530 531 |
# File 'lib/oga/xpath/parser.rb', line 529 def _rule_43(val) val[1] end |
#_rule_44(val) ⇒ 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.
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/oga/xpath/parser.rb', line 533 def _rule_44(val) ret = s(:axis, val[0], val[1]) more = val[3] if val[2] ret = s(:predicate, ret, val[2]) end if more ret = ret.updated(nil, ret.children + [more]) end ret end |
#_rule_45(val) ⇒ 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.
550 551 552 |
# File 'lib/oga/xpath/parser.rb', line 550 def _rule_45(val) val[0] end |
#_rule_46(val) ⇒ 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.
554 555 556 |
# File 'lib/oga/xpath/parser.rb', line 554 def _rule_46(val) val[0] end |
#_rule_47(val) ⇒ 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.
558 559 560 |
# File 'lib/oga/xpath/parser.rb', line 558 def _rule_47(val) s(:string, val[0]) end |
#_rule_48(val) ⇒ 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.
562 563 564 |
# File 'lib/oga/xpath/parser.rb', line 562 def _rule_48(val) s(:int, val[0]) end |
#_rule_49(val) ⇒ 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.
566 567 568 |
# File 'lib/oga/xpath/parser.rb', line 566 def _rule_49(val) s(:float, val[0]) end |
#_rule_5(val) ⇒ 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.
328 329 330 |
# File 'lib/oga/xpath/parser.rb', line 328 def _rule_5(val) combine_operators(val) end |
#_rule_50(val) ⇒ 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.
570 571 572 |
# File 'lib/oga/xpath/parser.rb', line 570 def _rule_50(val) s(:var, val[0]) end |
#_rule_51(val) ⇒ 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.
574 575 576 |
# File 'lib/oga/xpath/parser.rb', line 574 def _rule_51(val) val[0] end |
#_rule_52(val) ⇒ 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.
578 579 580 |
# File 'lib/oga/xpath/parser.rb', line 578 def _rule_52(val) val[0] end |
#_rule_53(val) ⇒ 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.
582 583 584 |
# File 'lib/oga/xpath/parser.rb', line 582 def _rule_53(val) val[0] end |
#_rule_54(val) ⇒ 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.
586 587 588 |
# File 'lib/oga/xpath/parser.rb', line 586 def _rule_54(val) val[0] end |
#_rule_55(val) ⇒ 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.
590 591 592 |
# File 'lib/oga/xpath/parser.rb', line 590 def _rule_55(val) val[0] end |
#_rule_56(val) ⇒ 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.
594 595 596 |
# File 'lib/oga/xpath/parser.rb', line 594 def _rule_56(val) val[0] end |
#_rule_57(val) ⇒ 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.
598 599 600 |
# File 'lib/oga/xpath/parser.rb', line 598 def _rule_57(val) val[0] end |
#_rule_58(val) ⇒ 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.
602 603 604 |
# File 'lib/oga/xpath/parser.rb', line 602 def _rule_58(val) val[0] end |
#_rule_59(val) ⇒ 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.
606 607 608 |
# File 'lib/oga/xpath/parser.rb', line 606 def _rule_59(val) val[0] end |
#_rule_6(val) ⇒ 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.
332 333 334 |
# File 'lib/oga/xpath/parser.rb', line 332 def _rule_6(val) [:eq, val[1]] end |
#_rule_60(val) ⇒ 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.
610 611 612 |
# File 'lib/oga/xpath/parser.rb', line 610 def _rule_60(val) val[0] end |
#_rule_61(val) ⇒ 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.
614 615 616 |
# File 'lib/oga/xpath/parser.rb', line 614 def _rule_61(val) val[0] end |
#_rule_62(val) ⇒ 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.
618 619 620 |
# File 'lib/oga/xpath/parser.rb', line 618 def _rule_62(val) val[0] end |
#_rule_63(val) ⇒ 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.
622 623 624 |
# File 'lib/oga/xpath/parser.rb', line 622 def _rule_63(val) val[0] end |
#_rule_64(val) ⇒ 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.
626 627 628 |
# File 'lib/oga/xpath/parser.rb', line 626 def _rule_64(val) val[0] end |
#_rule_65(val) ⇒ 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.
630 631 632 |
# File 'lib/oga/xpath/parser.rb', line 630 def _rule_65(val) val[0] end |
#_rule_66(val) ⇒ 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.
634 635 636 |
# File 'lib/oga/xpath/parser.rb', line 634 def _rule_66(val) val[0] end |
#_rule_67(val) ⇒ 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.
638 639 640 |
# File 'lib/oga/xpath/parser.rb', line 638 def _rule_67(val) val[0] end |
#_rule_68(val) ⇒ 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.
642 643 644 |
# File 'lib/oga/xpath/parser.rb', line 642 def _rule_68(val) val[0] end |
#_rule_69(val) ⇒ 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.
646 647 648 |
# File 'lib/oga/xpath/parser.rb', line 646 def _rule_69(val) val[0] end |
#_rule_7(val) ⇒ 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.
336 337 338 |
# File 'lib/oga/xpath/parser.rb', line 336 def _rule_7(val) [:neq, val[1]] end |
#_rule_8(val) ⇒ 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.
340 341 342 |
# File 'lib/oga/xpath/parser.rb', line 340 def _rule_8(val) combine_operators(val) end |
#_rule_9(val) ⇒ 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.
344 345 346 |
# File 'lib/oga/xpath/parser.rb', line 344 def _rule_9(val) [:lt, val[1]] end |
#combine_operators(val) ⇒ 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.
287 288 289 290 291 292 293 294 295 |
# File 'lib/oga/xpath/parser.rb', line 287 def combine_operators(val) ret = val[0] val[1].each do |expr| ret = s(expr[0], ret, expr[1]) end ret end |
#combine_optional_operator(val) ⇒ 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.
298 299 300 301 302 303 304 305 306 |
# File 'lib/oga/xpath/parser.rb', line 298 def combine_optional_operator(val) ret = val[0] if val[1] ret = s(val[1][0], ret, val[1][1]) end ret end |
#each_token {|| ... } ⇒ 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.
Yields the next token from the lexer.
276 277 278 279 280 281 282 283 284 |
# File 'lib/oga/xpath/parser.rb', line 276 def each_token @lexer.advance do |type, value, line| @line = line if line yield [type, value] end yield [-1, -1] end |
#s(type, *children) ⇒ AST::Node
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.
Creates a new XPath node.
269 270 271 |
# File 'lib/oga/xpath/parser.rb', line 269 def s(type, *children) AST::Node.new(type, children) end |