in lib/twitter_cldr/parsers/unicode_regex_parser.rb [195:227]
def character_class
operator_stack = []
operand_stack = []
open_count = 0
loop do
case current_token.type
when *CharacterClass.closing_types
open_count -= 1
build_until_open(operator_stack, operand_stack)
add_implicit_union(operator_stack, open_count)
when *CharacterClass.opening_types
open_count += 1
operator_stack.push(current_token)
when *(BINARY_OPERATORS + UNARY_OPERATORS)
operator_stack.push(current_token)
else
add_implicit_union(operator_stack, open_count)
operand_stack.push(
send(current_token.type, current_token)
)
end
next_token(current_token.type)
break if operator_stack.empty? && open_count == 0
end
CharacterClass.new(operand_stack.pop)
end