/* Generated by re2swift */
// re2swift $INPUT -o $OUTPUT --api generic --recursive-functions -i

class State {
  let string: UnsafeBufferPointer<UInt8>
  var cursor: Int = 0

  init(string: UnsafeBufferPointer<UInt8>) {
    self.string = string
  }
}


func yy0(_ s: State) -> Bool {
  let yych = s.string[s.cursor]
  s.cursor += 1
  switch yych {
    case 0x41...0x5A:
      fallthrough
    case 0x61...0x7A: return yy2(s)
    default: return yy1(s)
  }
}

func yy1(_ s: State) -> Bool {
  return false
}

func yy2(_ s: State) -> Bool {
  let yych = s.string[s.cursor]
  switch yych {
    case 0x30...0x39:
      fallthrough
    case 0x41...0x5A:
      fallthrough
    case 0x61...0x7A:
      s.cursor += 1
      return yy2(s)
    default: return yy3(s)
  }
}

func yy3(_ s: State) -> Bool {
  return true
}

func lex(_ s: State) -> Bool {
  return yy0(s)
}



@main struct Program {
  static func main() {
    let test1: StaticString = "qwerty42\0"
    let test2: StaticString = "??\0"
    test1.withUTF8Buffer {
      assert(lex(State(string: $0)))
    }
    test2.withUTF8Buffer {
      assert(!lex(State(string: $0)))
    }
  }
}
