Closed TheOtterlord closed 4 years ago
I've narrowed down the problem to line 237
in src/lib/action.rs
.
Instead of calling next_char
, we need to fetch the current character.
As I do not know how the interactions work with variables, I thought I'd get your opinion before deciding to implement anything.
So i've fixed a few things in the action.rs
file in this commit: https://github.com/mjarkk/general_programming_language/commit/cd4cb30fd90ced93e7410409fbaf11d146ff218f
Instead of calling next_char, we need to fetch the current character.
I think this is an issue with the try_match
function that is used a bit earlier, that function seeks the next chars and resets the index to the index when the function started if it doesn't find anything.
Currently the counts all the cars and subtracts that of the index here:
// Reset the index if we havent found the requested item
self.index -= char_count;
None
}
Maybe it's better if we make a copy of the original index at the top of this function and restore it at the end, this also reduces the cpu cycles needed to run this function.
Thought it would be better to open an issue for this than use the OSI issue.
I noticed the Fixed the test_function_call test commit and equalised my fork. After rerunning the tests, I edited example.gpl to include a function call. Now for some reason it would not accept any newlines inside the function. But the real issue is that after checking the console log, I noticed that the parsed
mpty
as ActionFunctionCall.name when the function I was calling was namedempty
.This was the console log outputted by main:
I also made the test log the output for further info, and got this:
My modified test looks like this:
My modified example.gpl