lib/fusuma/plugin/parsers/tap_parser.rb in fusuma-plugin-tap-0.1.1 vs lib/fusuma/plugin/parsers/tap_parser.rb in fusuma-plugin-tap-0.1.3

- old
+ new

@@ -53,16 +53,16 @@ def parse_record(record) gesture = 'tap' case record.to_s # BEGIN - when /\stap(| state):\s.*TAP_STATE_IDLE → TAP_EVENT_TOUCH → TAP_STATE_TOUCH/ + when /\stap(?:| state):\s.*TAP_STATE_IDLE → TAP_EVENT_TOUCH → TAP_STATE_TOUCH/ status = 'begin' finger = 1 # TOUCH - when /\stap(| state):\s.*(#{STATE[:touches].join('|')}) → TAP_EVENT_TOUCH → (#{STATE[:touches].join('|')})/ + when /\stap(?:| state):\s.*(#{STATE[:touches].join('|')}) → TAP_EVENT_TOUCH → (#{STATE[:touches].join('|')})/ status = 'touch' finger = case Regexp.last_match(2) when 'TAP_STATE_DEAD' @@ -74,11 +74,11 @@ when 'TAP_STATE_TOUCH' 1 end # HOLD - when /\stap(| state):\s.*(#{STATE[:touches].join('|')}) → TAP_EVENT_TIMEOUT → (#{STATE[:holds].join('|')})/ + when /\stap(?:| state):\s.*(#{STATE[:touches].join('|')}) → TAP_EVENT_TIMEOUT → (#{STATE[:holds].join('|')})/ status = 'hold' matched = Regexp.last_match @@ -97,11 +97,11 @@ # NOTE: treat the "gesture(| state):" as KEEP status = 'keep' finger = 0 # RELEASE - when /\stap(| state):\s.*(#{(STATE[:touches] | STATE[:holds]).join('|')}) → TAP_EVENT_RELEASE → (#{STATE[:releases].join('|')})/ + when /\stap(?:| state):\s.*(#{(STATE[:touches] | STATE[:holds]).join('|')}) → TAP_EVENT_RELEASE → (#{STATE[:releases].join('|')})/ status = 'release' matched = Regexp.last_match finger = case matched[1] @@ -114,10 +114,10 @@ when 'TAP_STATE_TOUCH', 'TAP_STATE_HOLD' 1 end # END - when /\stap(| state):\s.*(#{STATE[:releases].join('|')}) → TAP_EVENT_(.*) → #{STATE[:idle]}/ + when /\stap(?:| state):\s.*(#{STATE[:releases].join('|')}) → TAP_EVENT_(.*) → #{STATE[:idle]}/ status = 'end' matched = Regexp.last_match finger = case matched[1] when 'TAP_STATE_TOUCH_3', 'TAP_STATE_TOUCH_3_HOLD'