/* Generated by re2swift */
// re2swift $INPUT -o $OUTPUT -i

func lex(_ yyinput: UnsafeBufferPointer<UInt8>) -> Bool {
  var yycursor = 0, yymarker = 0
  
  var yych: UInt8 = 0
  var yystate: UInt = 0
  yyl: while true {
    switch yystate {
      case 0:
        yych = yyinput[yycursor]
        yycursor += 1
        switch yych {
          case 0x09:
            yystate = 3
            continue yyl
          default:
            yystate = 1
            continue yyl
        }
      case 1:
        yystate = 2
        continue yyl
      case 2: 
      let _: [UnicodeScalar] = [ "\t", "\n", "\r", "\"", "\'", "\\" ]
      return false

      case 3:
        yymarker = yycursor
        yych = yyinput[yycursor]
        switch yych {
          case 0x0A:
            yycursor += 1
            yystate = 4
            continue yyl
          default:
            yystate = 2
            continue yyl
        }
      case 4:
        yych = yyinput[yycursor]
        switch yych {
          case 0x0D:
            yycursor += 1
            yystate = 6
            continue yyl
          default:
            yystate = 5
            continue yyl
        }
      case 5:
        yycursor = yymarker
        yystate = 2
        continue yyl
      case 6:
        yych = yyinput[yycursor]
        switch yych {
          case 0x22:
            yycursor += 1
            yystate = 7
            continue yyl
          default:
            yystate = 5
            continue yyl
        }
      case 7:
        yych = yyinput[yycursor]
        switch yych {
          case 0x27:
            yycursor += 1
            yystate = 8
            continue yyl
          default:
            yystate = 5
            continue yyl
        }
      case 8:
        yych = yyinput[yycursor]
        switch yych {
          case 0x5C:
            yycursor += 1
            yystate = 9
            continue yyl
          default:
            yystate = 5
            continue yyl
        }
      case 9: return true
      default: fatalError("internal lexer error")
    }
  }

}

@main struct Program {
  static func main() {
    let test: StaticString = "\u{09}\u{0A}\u{0D}\u{22}\u{27}\u{5C}\0"
    test.withUTF8Buffer {
      assert(lex($0))
    }
  }
}
