summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-23 05:54:56 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-23 05:54:56 +0200
commitb059a63e7ff3cd7c26dd5664bf048aa42338fbe1 (patch)
tree18138a0daaeba4dce48c411c5e12d929f131d1ad
parentd6cc5767c9a9bfb4c08bcd5127145b38cb1d29de (diff)
downloadcoderay-b059a63e7ff3cd7c26dd5664bf048aa42338fbe1.tar.gz
close open tokens in Groovy scanner
-rw-r--r--lib/coderay/scanners/groovy.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/coderay/scanners/groovy.rb b/lib/coderay/scanners/groovy.rb
index cf55daf..d04a535 100644
--- a/lib/coderay/scanners/groovy.rb
+++ b/lib/coderay/scanners/groovy.rb
@@ -36,9 +36,12 @@ module Scanners
protected
+ def setup
+ @state = :initial
+ end
+
def scan_tokens encoder, options
-
- state = :initial
+ state = options[:state] || @state
inline_block_stack = []
inline_block_paren_depth = nil
string_delimiter = nil
@@ -246,6 +249,16 @@ module Scanners
encoder.end_group state
end
+ if options[:keep_state]
+ @state = state
+ end
+
+ until inline_block_stack.empty?
+ state, = *inline_block_stack.pop
+ encoder.end_group :inline
+ encoder.end_group state
+ end
+
encoder
end