diff --git a/build.hancho b/build.hancho index 459e66a..3877bce 100644 --- a/build.hancho +++ b/build.hancho @@ -1,21 +1,19 @@ # matcheroni/build.hancho -import hancho +hancho.build_tag = "debug" +hancho.rules = hancho.load("symlinks/hancho/rules.hancho") +hancho.includes = [".", "{repo_dir}"] -hancho.Config.build_tag = "debug" +c_lexer = hancho.load("examples/c_lexer/c_lexer.hancho") +c_parser = hancho.load("examples/c_parser/c_parser.hancho", c_lexer = c_lexer) +json = hancho.load("examples/json/json.hancho") +#regex = hancho.load("examples/regex/regex.hancho") +#toml = hancho.load("examples/toml/toml.hancho") +#tests = hancho.load("tests/tests.hancho") +#tutorial = hancho.load("examples/tutorial/tutorial.hancho", c_lexer = c_lexer, c_parser = c_parser) -rules = hancho.load("symlinks/hancho/rules.hancho", exports) -rules.compile_cpp.includes = [".", "{repo_path}"] - -c_lexer = hancho.load("examples/c_lexer/c_lexer.hancho", rules = rules) -c_parser = hancho.load("examples/c_parser/c_parser.hancho", rules = rules, c_lexer = c_lexer) -json = hancho.load("examples/json/json.hancho", rules = rules) -regex = hancho.load("examples/regex/regex.hancho", rules = rules) -toml = hancho.load("examples/toml/toml.hancho", rules = rules) -tests = hancho.load("tests/tests.hancho", rules = rules) -tutorial = hancho.load("examples/tutorial/tutorial.hancho", rules = rules, c_lexer = c_lexer, c_parser = c_parser) - -ini = rules.cpp_lib( +ini = hancho( + hancho.rules.cpp_lib, name = "ini_parser", in_srcs = "examples/ini/ini_parser.cpp", ) diff --git a/examples/c_lexer/c_lexer.hancho b/examples/c_lexer/c_lexer.hancho index 91f9904..3b7c986 100644 --- a/examples/c_lexer/c_lexer.hancho +++ b/examples/c_lexer/c_lexer.hancho @@ -1,21 +1,24 @@ #------------------------------------------------------------------------------- # Matcheroni C lexer demo -c_lexer = imports.rules.cpp_lib( - name = "c_lexer", +rules = hancho.pop('rules') + +lib = hancho( + rules.cpp_lib, + name = "c_lexer.a", in_srcs = ["CLexer.cpp", "CToken.cpp"], ) -imports.rules.c_test( +hancho( + rules.cpp_test, name = "c_lexer_test", in_srcs = "c_lexer_test.cpp", - in_libs = c_lexer, + in_libs = lib, ) -imports.rules.cpp_bin( +hancho( + rules.cpp_bin, name = "c_lexer_benchmark", in_srcs = "c_lexer_benchmark.cpp", - in_libs = c_lexer, + in_libs = lib, ) - -exports.lib = c_lexer diff --git a/examples/c_parser/c_parser.hancho b/examples/c_parser/c_parser.hancho index d192260..deb38ec 100644 --- a/examples/c_parser/c_parser.hancho +++ b/examples/c_parser/c_parser.hancho @@ -1,15 +1,20 @@ #------------------------------------------------------------------------------- # C parser example (not finished) -c_parser = imports.rules.cpp_lib( +rules = hancho.pop('rules') +c_lexer = hancho.pop('c_lexer') + +lib = hancho( + rules.cpp_lib, name = "c_parser", in_srcs = ["CContext.cpp", "CNode.cpp", "CScope.cpp"], ) -imports.rules.cpp_bin( +hancho( + rules.cpp_bin, name = "c_parser_benchmark", in_srcs = "c_parser_benchmark.cpp", - in_libs = [imports.c_lexer.lib, c_parser], + in_libs = [c_lexer.lib, lib], ) # Broken? @@ -18,5 +23,3 @@ imports.rules.cpp_bin( # "c_parser_test", # libs = [c_lexer.c_lexer_lib, c_parser_lib], #) - -exports.lib = c_parser diff --git a/examples/json/json.hancho b/examples/json/json.hancho index f954ff1..b6a26c4 100644 --- a/examples/json/json.hancho +++ b/examples/json/json.hancho @@ -1,33 +1,38 @@ #------------------------------------------------------------------------------- # Matcheroni JSON parser example -json_parser = imports.rules.cpp_lib( +rules = hancho.pop('rules') + +lib = hancho( + rules.cpp_lib, name = "json_parser", in_srcs = ["json_matcher.cpp", "json_parser.cpp"], ) -imports.rules.cpp_bin( +hancho( + rules.cpp_bin, name = "json_conformance", in_srcs = "json_conformance.cpp", - in_libs = json_parser, + in_libs = lib, ) -imports.rules.cpp_bin( +hancho( + rules.cpp_bin, name = "json_benchmark", in_srcs = "json_benchmark.cpp", - in_libs = json_parser, + in_libs = lib, ) -imports.rules.cpp_bin( +hancho( + rules.cpp_bin, name = "json_demo", in_srcs = "json_demo.cpp", - in_libs = json_parser, + in_libs = lib, ) -imports.rules.c_test( +hancho( + rules.cpp_test, name = "json_test", in_srcs = "json_test.cpp", - in_libs = json_parser, + in_libs = lib, ) - -exports.lib = json_parser