From 576b2a2a695b47a3c3326826f5fdefd272cea9b5 Mon Sep 17 00:00:00 2001
From: "Esteban Prince, Liam (UG - Computer Science)" <le00210@surrey.ac.uk>
Date: Sat, 15 Feb 2020 19:07:02 +0000
Subject: [PATCH] Update parser.py

---
 parser.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/parser.py b/parser.py
index 995d46d..15c6b4b 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
-- 
GitLab