# Generated by re2py
# re2py $INPUT -o $OUTPUT

NONE = -1

def parse(yyinput):
    yycursor = 0
    
    yytm3 = []
    yytm4 = [] # autogenerated tag variables


    yystate = 0
    while True:
        match yystate:
            case 0:
                yych = yyinput[yycursor]
                if yych <= 0x2F:
                    yycursor += 1
                    yystate = 1
                    continue
                if yych <= 0x39:
                    yyt1 = yycursor
                    yycursor += 1
                    yystate = 3
                    continue
                yycursor += 1
                yystate = 1
                continue
            case 1:
                yystate = 2
                continue
            case 2:
                return None
            case 3:
                yymarker = yycursor
                yych = yyinput[yycursor]
                if yych <= 0x2E:
                    if yych <= 0x00:
                        
                        
                        yyt2 = yycursor
                        yycursor += 1
                        yystate = 4
                        continue
                    if yych <= 0x2D:
                        yystate = 2
                        continue
                    yyt2 = yycursor
                    yycursor += 1
                    yystate = 5
                    continue
                else:
                    if yych <= 0x2F:
                        yystate = 2
                        continue
                    if yych <= 0x39:
                        yycursor += 1
                        yystate = 7
                        continue
                    yystate = 2
                    continue
            case 4:
                t1 = yyt1
                t2 = yyt2
                t3 = yytm3
                t4 = yytm4
                vers = [int(yyinput[t1:t2])]
                for i in range(len(t3)):
                    vers.append(int(yyinput[t3[i]:t4[i]]))
                return vers
            case 5:
                yych = yyinput[yycursor]
                if yych <= 0x2F:
                    yystate = 6
                    continue
                if yych <= 0x39:
                    yytm3.append(yycursor)
                    yycursor += 1
                    yystate = 8
                    continue
                yystate = 6
                continue
            case 6:
                yycursor = yymarker
                yystate = 2
                continue
            case 7:
                yych = yyinput[yycursor]
                if yych <= 0x2E:
                    if yych <= 0x00:
                        
                        
                        yyt2 = yycursor
                        yycursor += 1
                        yystate = 4
                        continue
                    if yych <= 0x2D:
                        yystate = 6
                        continue
                    yyt2 = yycursor
                    yycursor += 1
                    yystate = 5
                    continue
                else:
                    if yych <= 0x2F:
                        yystate = 6
                        continue
                    if yych <= 0x39:
                        yycursor += 1
                        yystate = 7
                        continue
                    yystate = 6
                    continue
            case 8:
                yych = yyinput[yycursor]
                if yych <= 0x2E:
                    if yych <= 0x00:
                        yytm4.append(yycursor)
                        yycursor += 1
                        yystate = 4
                        continue
                    if yych <= 0x2D:
                        yystate = 6
                        continue
                    yytm4.append(yycursor)
                    yycursor += 1
                    yystate = 5
                    continue
                else:
                    if yych <= 0x2F:
                        yystate = 6
                        continue
                    if yych <= 0x39:
                        yycursor += 1
                        yystate = 8
                        continue
                    yystate = 6
                    continue
            case _:
                raise "internal lexer error"


assert parse(b"1\0") == [1]
assert parse(b"1.2.3.4.5.6.7\0") == [1, 2, 3, 4, 5, 6, 7]
assert parse(b"1.2.\0") == None
