These are no longer necessary now that we target Ruby 2.1 and up.
require 'continuation'
module Walrat
- major, minor = RUBY_VERSION.split '.'
- if major == '1' and minor == '8'
- $KCODE = 'U' # UTF-8 (necessary for Unicode support)
- end
-
autoload :AndPredicate, 'walrat/and_predicate'
autoload :ArrayResult, 'walrat/array_result'
autoload :ContinuationWrapperException, 'walrat/continuation_wrapper_exception'
module Walrat
# Unicode-aware (UTF-8) string enumerator.
- # For Unicode support $KCODE must be set to 'U' (UTF-8).
class StringEnumerator
# Returns the char most recently scanned before the last "next" call, or
# nil if nothing previously scanned.
@last = nil
end
- # This method will only work as expected if $KCODE is set to 'U' (UTF-8).
def next
@last = @current
@current = @scanner.scan(/./m) # must use multiline mode or "." won't match newlines