diff --git a/parser.py b/parser.py index 995d46d5092c2ce1319f4abcd478b94365c13356..15c6b4baf12d7df2cb65e437de45864c0d733a7a 100644 --- a/parser.py +++ b/parser.py @@ -1,12 +1,19 @@ def preprocess(): # Return the next token from the input -def getToken(): - int lastChar = ' ' - for c in input: - lastChar = c if c != ' ' +def lex(input): + tokens = [] + + while len(input.split()): + if input is not None: + continue + + if input[0] in ingredients: + input = input[1:] + else: + raise Exception('Don\'t know what this is: {}'.format(input[0])) def parse(): - preprocess(): - tokenise() + preprocess() + lex(input) isValid() \ No newline at end of file