Sha256: e47e7e31091e35136bf792c15771302d8baa1bea7e82b0b817de6550bfeeaf5c
Contents?: true
Size: 1021 Bytes
Versions: 9
Compression:
Stored size: 1021 Bytes
Contents
# frozen-string-literal: true module Bioshogi module Parser class Ki2Parser < Base include KakinokiMethods ACCEPT_REGEXP = /^\p{blank}*(#{InputParser.regexp}|.*:.*)/o MOVE_REGEXP = /^\p{blank}*#{InputParser.regexp}/o class << self def accept?(source) str = Source.wrap(source).to_s if str.present? if !KifParser.accept?(str) && !CsaParser.accept?(str) str.match?(ACCEPT_REGEXP) || BoardParser::KakinokiBoardParser.accept?(str) end end end end private def body_parse body_part.lines.each do |line| kknk_comment_read(line) if line.match?(MOVE_REGEXP) @pi.move_infos += InputParser.scan(line).collect do |e| { input: e } end end end if body_part.match?(/^まで\d+手で千日手/) @pi.last_action_params = { last_action_key: "SENNICHITE" } end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems