Class: TDParser::BackrefParser
- Inherits:
-
ReferenceParser
- Object
- Parser
- ReferenceParser
- TDParser::BackrefParser
- Defined in:
- lib/tdp.rb
Instance Attribute Summary collapse
-
#equality ⇒ Object
readonly
Returns the value of attribute equality.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #==(r) ⇒ Object
- #call(tokens, buff) ⇒ Object
-
#initialize(label, eqsym) ⇒ BackrefParser
constructor
A new instance of BackrefParser.
- #to_s ⇒ Object
Methods inherited from ReferenceParser
Methods inherited from Parser
#%, #*, #+, #-, #/, #>, #>>, #do, #optimize, #parse, #peek, #same?, #to_proc, #|, #~@
Methods included from TDParser
#any_rule, #backref, #chainl, #chainr, #condition_rule, define, #empty_rule, #fail_rule, #leftrec, #none_rule, #rightrec, #rule, #stackref, #state, #token
Methods included from BufferUtils
Constructor Details
#initialize(label, eqsym) ⇒ BackrefParser
Returns a new instance of BackrefParser.
690 691 692 693 |
# File 'lib/tdp.rb', line 690 def initialize(label, eqsym) @label = label @equality = eqsym end |
Instance Attribute Details
#equality ⇒ Object (readonly)
Returns the value of attribute equality.
688 689 690 |
# File 'lib/tdp.rb', line 688 def equality @equality end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
688 689 690 |
# File 'lib/tdp.rb', line 688 def label @label end |
Instance Method Details
#==(r) ⇒ Object
708 709 710 711 712 |
# File 'lib/tdp.rb', line 708 def ==(r) super(r) && (@label == r.label) && (@equality == r.equality) end |
#call(tokens, buff) ⇒ Object
695 696 697 698 699 700 701 702 |
# File 'lib/tdp.rb', line 695 def call(tokens, buff) ys = buff.map[@label] if (ys.nil? || ys.empty?) nil else __backref__(ys.dup(), @equality).call(tokens,buff) end end |
#to_s ⇒ Object
704 705 706 |
# File 'lib/tdp.rb', line 704 def to_s() "<backref:#{@label}>" end |