Skip to content

Commit

Permalink
Generate error messages lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Jan 4, 2024
1 parent 96ba7f1 commit af64782
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
# echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
# mkdir ./bin
# cd ./bin
# cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_LINK_STATIC=OFF -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
# cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_PROF_COMPILE=ON -DSPICE_LINK_STATIC=OFF -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
# cmake --build . --target spicetest -j$(nproc)

- name: Run Test target
Expand Down
33 changes: 10 additions & 23 deletions media/test-project/test.spice
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
import "std/io/cli-parser";
import "std/io/cli-subcommand";

type CliOptions struct {
string greetName = ""
}

p callback(bool& value) {
printf("Callback called with value %d\n", value);
}
import "../../src-bootstrap/lexer/lexer";

f<int> main(int argc, string[] argv) {
CliParser parser = CliParser("Test Program", "This is a simple test program");
parser.setVersion("v0.1.0");
parser.setFooter("Copyright (c) Marc Auberer 2021-2024");

CliOptions options;
CliSubcommand& greet = parser.addSubcommand("greet", "Greet someone");
greet.addOption("--name", options.greetName, "Name of the person to greet");

parser.parse(argc, argv);

// Greet persion if requested
if options.greetName != "" {
printf("Hello %s!\n", options.greetName);
Lexer lexer = Lexer(argv[1]);
unsigned long i = 1l;
while (!lexer.isEOF()) {
Token token = lexer.getToken();
//printf("Token %d: ", i);
//token.print();
lexer.advance();
i++;
}
printf("Tokens: %d\n", i);
}

/*type Visitable interface {
Expand Down
Loading

0 comments on commit af64782

Please sign in to comment.