Class: TDParser::StateParser
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #==(r) ⇒ Object
- #call(tokens, buff) ⇒ Object
-
#initialize(s) ⇒ StateParser
constructor
A new instance of StateParser.
- #same?(r) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Parser
#%, #*, #+, #-, #/, #>, #>>, #do, #optimize, #parse, #peek, #to_proc, #|, #~@
Methods included from TDParser
#any_rule, #backref, #chainl, #chainr, #condition_rule, define, #empty_rule, #fail_rule, #leftrec, #none_rule, #rightrec, #rule, #stackref, #token
Methods included from BufferUtils
Constructor Details
#initialize(s) ⇒ StateParser
Returns a new instance of StateParser.
775 776 777 |
# File 'lib/tdp.rb', line 775 def initialize(s) @state = s end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
773 774 775 |
# File 'lib/tdp.rb', line 773 def state @state end |
Instance Method Details
#==(r) ⇒ Object
791 792 793 794 |
# File 'lib/tdp.rb', line 791 def ==(r) super(r) && (@state == r.state) end |
#call(tokens, buff) ⇒ Object
779 780 781 782 783 784 785 |
# File 'lib/tdp.rb', line 779 def call(tokens, buff) if (buff.map[:state] == @state) Sequence[@state] else nil end end |
#same?(r) ⇒ Boolean
796 797 798 |
# File 'lib/tdp.rb', line 796 def same?(r) false end |
#to_s ⇒ Object
787 788 789 |
# File 'lib/tdp.rb', line 787 def to_s() "<state:#{@state}>" end |