From cf64279293da1a7ce3b91e64ea869a48fc5b1460 Mon Sep 17 00:00:00 2001 From: enderger Date: Wed, 20 Nov 2019 08:47:58 -0600 Subject: [PATCH 1/2] Fixed an infinite loop When dealing with certain checks, namely the name check, the code can enter an infinite loop if the file end is reached during the while loop. The solution was to change the parameter to p_input and make a local variable called input that is equal to p_input + " ". --- the-super-tiny-compiler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/the-super-tiny-compiler.js b/the-super-tiny-compiler.js index 411fa54..eb33afc 100755 --- a/the-super-tiny-compiler.js +++ b/the-super-tiny-compiler.js @@ -378,8 +378,9 @@ // We start by accepting an input string of code, and we're gonna set up two // things... -function tokenizer(input) { +function tokenizer(p_input) { + let input = p_input + ' '; // A `current` variable for tracking our position in the code like a cursor. let current = 0; From 1ec0771ce421e2dd7f00f2e5d4766d838a2a8067 Mon Sep 17 00:00:00 2001 From: enderger Date: Wed, 20 Nov 2019 08:50:09 -0600 Subject: [PATCH 2/2] Documented previous change --- the-super-tiny-compiler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/the-super-tiny-compiler.js b/the-super-tiny-compiler.js index eb33afc..99524ea 100755 --- a/the-super-tiny-compiler.js +++ b/the-super-tiny-compiler.js @@ -380,7 +380,8 @@ // things... function tokenizer(p_input) { - let input = p_input + ' '; + //Fixes an infinite loop where the file ends before certain while loops end. + let input = p_input + ' '; // A `current` variable for tracking our position in the code like a cursor. let current = 0;