Sha256: fa5aac1157d8b29dd63a000b222a7ca5e9c9d1d24d11088c11504aa06362ab99
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
class Code class Parser class Operation < ::Code::Parser def initialize(input, operators:, subclass:, **kargs) super(input, **kargs) @operators = operators @subclass = subclass end def parse previous_cursor = cursor left = parse_subclass(subclass) if left right = [] previous_cursor = cursor comments = parse_comments while operator = match(operators) comments = parse_comments statement = parse_subclass(subclass) right << { comments: comments, statement: statement, operator: operator }.compact end if right.empty? @cursor = previous_cursor buffer! left else { operation: { left: left, comments: comments, right: right }.compact } end else @cursor = previous_cursor buffer! return end end private attr_reader :operators, :subclass end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
template-ruby-parser-0.1.2 | lib/code/parser/operation.rb |
code-ruby-parser-0.1.2 | lib/code/parser/operation.rb |