module FFaker::String

def generate_token(token, tokens)

def generate_token(token, tokens)
  case token
  when /\w/ then
    @last_token = [token]
    token
  when BACKSLASH then
    token = tokens.shift
    @last_token = ['\\', token]
    special(token)
  when '[' then
    set = []
    while (ch = tokens.shift) != ']'
      set << ch
    end
    @last_token = ['['] + set + [']']
    process_token([fetch_sample(generate_range(set))])
  else
    token
  end
end