diff --git a/src/com/craftinginterpreters/lox/CMakeLists.txt b/src/com/craftinginterpreters/lox/CMakeLists.txt index ca2ee27..e635245 100644 --- a/src/com/craftinginterpreters/lox/CMakeLists.txt +++ b/src/com/craftinginterpreters/lox/CMakeLists.txt @@ -1,8 +1,11 @@ get_target_property(GENERATE_AST_JAR GenerateAst JAR_FILE) -set(EXPR_JAVA_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/Expr.java CACHE INTERNAL "") +set(GENERATED_JAVA_FILENAMES + ${CMAKE_CURRENT_BINARY_DIR}/Expr.java + ${CMAKE_CURRENT_BINARY_DIR}/Stmt.java + CACHE INTERNAL "") -add_custom_command(OUTPUT ${EXPR_JAVA_FILENAME} +add_custom_command(OUTPUT ${GENERATED_JAVA_FILENAMES} COMMAND java -jar ${GENERATE_AST_JAR} ${CMAKE_CURRENT_BINARY_DIR} DEPENDS GenerateAst) @@ -11,7 +14,7 @@ add_jar(Lox TokenType.java Token.java Scanner.java - ${EXPR_JAVA_FILENAME} + ${GENERATED_JAVA_FILENAMES} AstPrinter.java Parser.java Interpreter.java diff --git a/src/com/craftinginterpreters/tool/GenerateAst.java b/src/com/craftinginterpreters/tool/GenerateAst.java index 5e79d2f..86d6942 100644 --- a/src/com/craftinginterpreters/tool/GenerateAst.java +++ b/src/com/craftinginterpreters/tool/GenerateAst.java @@ -16,6 +16,7 @@ public class GenerateAst { defineAst(outputDir, "Expr", Arrays.asList("Binary : Expr left, Token operator, Expr right", "Grouping : Expr expression", "Literal : Object value", "Unary : Token operator, Expr right")); + defineAst(outputDir, "Stmt", Arrays.asList("Expression : Expr expression", "Print : Expr expression")); } private static void defineAst(String outputDir, String baseName, List types) throws IOException {