Sha256: 76e09246f8b31873c44bf9c108ebdf7d4274b95b2a31cf9f9581010925ed4630
Contents?: true
Size: 694 Bytes
Versions: 49
Compression:
Stored size: 694 Bytes
Contents
module Gherkin class TokenFormatterBuilder def initialize reset end def reset @tokens_text = "" end def build(token) @tokens_text << "#{format_token(token)}\n" end def start_rule(rule_type) end def end_rule(rule_type) end def get_result @tokens_text end private def format_token(token) return "EOF" if token.eof? sprintf "(%s:%s)%s:%s/%s/%s", token.location[:line], token.location[:column], token.matched_type, token.matched_keyword, token.matched_text, Array(token.matched_items).map { |i| "#{i.column}:#{i.text}"}.join(',') end end end
Version data entries
49 entries across 49 versions & 5 rubygems