Closed crl-n closed 2 years ago
I tried moving the parser_jumptable
to parser.h but I decided to roll back that change, because it triggers a norminette warning. This is what norminette says Notice: GLOBAL_VAR_DETECTED (line: 62, col: 1): Global variable present in file. Make sure it is a reasonable choice.
This warning is not present when the jumptable is in the .c file. I was also getting another norm warning that I couldn't seem to figure out how to fix Error: MISALIGNED_VAR_DECL (line: 62, col: 29): Misaligned variable declaration
. Usually I know how to fix this error but for some reason I couldn't figure out the correct alignment.
In the end I figured that it's more tidy to have the jumptable in the .c file. If you still feel the jumptable should be in parser.h we can have another look at this.
I'll try to commit the other requested changes asap.
Alright, the remaining changes have been added.
Regarding the pos struct (coordinate pair struct), I only added the struct in d95d8f6. It will be easier to refactor the code to use the struct in the hashtable branch, so I will do that once we have this branch merged to master.
The GLOBAL_VAR_DETECTED error is fine. It's only a warning that appears when you have another norm error. It's most likely that misaligned error you're seeing, once that is fixed, it will be fine.
But yeah, since the jump table is only local to that once c file it might make sense to leave it there
Alright, behold the first draft of the parser! It is by no means finished but contains most, if not all, functionality we will need from the parser + some basic unit tests. Please have a look and let me know what you think!
I'd appreciate feedback on error handling, unit tests, the general structure of the parser, the readability and cleanliness of the code. Basically anything that comes to mind!
At the moment, the parser finds nodes from the adjacency list with a 'naive approach'. Next step would be to implement hash table or binary search, like we discussed, to speed that process up.
Another next step is to polish the error handling and the validation of the input. I'm still figuring out how to write unit tests for
get_link
. I've been getting some strange results when trying to assert that the edge vecs contain the correct info. I might need your help with that when you come back.