From 13ac3fdc6fa5330c9eacc6ac9be92a869ab8d3be Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 14 Feb 2016 15:08:30 +0100 Subject: optional push state (return nil) --- lib/coderay/rule_based_scanner.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/coderay/rule_based_scanner.rb') diff --git a/lib/coderay/rule_based_scanner.rb b/lib/coderay/rule_based_scanner.rb index 35adad1..334c08c 100644 --- a/lib/coderay/rule_based_scanner.rb +++ b/lib/coderay/rule_based_scanner.rb @@ -120,15 +120,19 @@ module CodeRay raise @code << " p 'push %p' % [#{action.state}]\n" if $DEBUG @code << " state = #{action.state}\n" + @code << " states << state\n" when Symbol @code << " p 'push %p' % [#{action.state.inspect}]\n" if $DEBUG @code << " state = #{action.state.inspect}\n" + @code << " states << state\n" when Proc - @code << " state = #{make_callback(action.state)}\n" + @code << " if new_state = #{make_callback(action.state)}\n" + @code << " state = new_state\n" + @code << " states << new_state\n" + @code << " end\n" else raise "I don't know how to evaluate this push state: %p" % [action.state] end - @code << " states << state\n" if action.is_a? Push if action.state == action.group @code << " encoder.begin_group state\n" -- cgit v1.2.1