MCPcopy Create free account
hub / github.com/ActiveState/code / parse

Function parse

recipes/Python/578366_The_Normal_Cow/recipe-578366.py:58–69  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

56################################################################################
57
58def parse(string):
59 index = 0
60 code = []
61 ins = string[index:index+3]
62 while len(ins) == 3:
63 if ins in INS:
64 code.append(INS.index(ins))
65 index += 3
66 else:
67 index += 1
68 ins = string[index:index+3]
69 return tuple(code)
70
71DECODE = ['END', 'P--', 'P++', 'EXE', 'I/O', 'M--',
72 'M++', 'LOP', 'M=0', 'REG', 'OUT', 'INP']

Callers 1

mainFunction · 0.70

Calls 2

appendMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected