Strengthened constness for cstrings and bytecode

This commit is contained in:
2023-02-10 08:52:38 +00:00
parent 76a0290290
commit ee226ea426
24 changed files with 138 additions and 143 deletions

View File

@@ -11,7 +11,7 @@
int main() {
{
//source
char* source = "print null;";
const char* source = "print null;";
//test init & quit
Toy_Lexer lexer;
@@ -24,7 +24,7 @@ int main() {
{
//source
char* source = "print null;";
const char* source = "print null;";
//test parsing
Toy_Lexer lexer;
@@ -58,7 +58,7 @@ int main() {
{
//get the source file
size_t size = 0;
char* source = Toy_readFile("scripts/parser_sample_code.toy", &size);
const char* source = Toy_readFile("scripts/parser_sample_code.toy", &size);
//test parsing a chunk of junk (valgrind will find leaks)
Toy_Lexer lexer;
@@ -85,7 +85,7 @@ int main() {
{
//test parsing of escaped characters
char* source = "print \"\\\"\";"; //NOTE: this string goes through two layers of escaping
const char* source = "print \"\\\"\";"; //NOTE: this string goes through two layers of escaping
//test parsing
Toy_Lexer lexer;
@@ -123,7 +123,7 @@ int main() {
{
//test parsing of underscored numbers
char* source = "print 1_000_000;";
const char* source = "print 1_000_000;";
//test parsing
Toy_Lexer lexer;