/* Generated by re2swift */
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 1)
// re2swift $INPUT -o $OUTPUT

// Expects a null-terminated string.
func lex(_ yyinput: UnsafePointer<UInt8>) -> Int? {
  var yycursor = 0, count = 0

  loop: while true {
    
#sourceLocation(file: "swift/eof/01_sentinel.swift", line: 12)
  var yych: UInt8 = 0
  var yystate: UInt = 0
  yyl: while true {
    switch yystate {
      case 0:
        yych = yyinput[yycursor]
        yycursor += 1
        switch yych {
          case 0x00:
            yystate = 1
            continue yyl
          case 0x20:
            yystate = 3
            continue yyl
          case 0x61...0x7A:
            yystate = 5
            continue yyl
          default:
            yystate = 2
            continue yyl
        }
      case 1:
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 16)
        return count
#sourceLocation(file: "swift/eof/01_sentinel.swift", line: 37)
      case 2:
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 17)
        return nil
#sourceLocation(file: "swift/eof/01_sentinel.swift", line: 41)
      case 3:
        yych = yyinput[yycursor]
        switch yych {
          case 0x20:
            yycursor += 1
            yystate = 3
            continue yyl
          default:
            yystate = 4
            continue yyl
        }
      case 4:
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 15)
        continue loop
#sourceLocation(file: "swift/eof/01_sentinel.swift", line: 56)
      case 5:
        yych = yyinput[yycursor]
        switch yych {
          case 0x61...0x7A:
            yycursor += 1
            yystate = 5
            continue yyl
          default:
            yystate = 6
            continue yyl
        }
      case 6:
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 11)
        
        count += 1
        continue loop

#sourceLocation(file: "swift/eof/01_sentinel.swift", line: 74)
      default: fatalError("internal lexer error")
    }
  }
#sourceLocation(file: "swift/eof/01_sentinel.re", line: 18)

  }
}

func test(_ str: StaticString, _ expect: Int?) {
  assert(lex(str.utf8Start) == expect)
}

test("", 0)
test("one two three", 3)
test("f0ur", nil)
