Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Oct 23, 2024
1 parent 7ccb161 commit f588311
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 55 deletions.
17 changes: 9 additions & 8 deletions build.hancho
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# matcheroni/build.hancho

hancho.build_tag = "debug"
hancho.rules = hancho.load("symlinks/hancho/rules.hancho")
if 'base_rules' not in hancho:
hancho.base_rules = hancho.load("symlinks/hancho/base_rules.hancho")

hancho.cpp_config = hancho.Config(
includes = "{repo_dir}",
test_dir = "{repo_dir}",
includes = "{repo_dir}",
test_dir = "{repo_dir}",
)

hancho.c_lexer = hancho.load("examples/c_lexer/c_lexer.hancho")
Expand All @@ -17,8 +18,8 @@ tests = hancho.load("tests/tests.hancho")
tutorial = hancho.load("examples/tutorial/tutorial.hancho")

ini = hancho(
hancho.rules.cpp_lib,
hancho.cpp_config,
in_srcs = "examples/ini/ini_parser.cpp",
out_lib = "ini_parser.a",
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = "examples/ini/ini_parser.cpp",
out_lib = "ini_parser.a",
)
15 changes: 6 additions & 9 deletions examples/c_lexer/c_lexer.hancho
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
#-------------------------------------------------------------------------------
# Matcheroni C lexer demo

rules = hancho.rules
config = hancho.cpp_config

lib = hancho(
rules.cpp_lib,
config,
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = ["CLexer.cpp", "CToken.cpp"],
out_lib = "c_lexer.a",
)

hancho(
rules.cpp_test,
config,
hancho.base_rules.cpp_test,
hancho.cpp_config,
in_srcs = "c_lexer_test.cpp",
in_libs = lib,
out_bin = "c_lexer_test",
)

hancho(
rules.cpp_bin,
config,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "c_lexer_benchmark.cpp",
in_libs = lib,
out_bin = "c_lexer_benchmark",
Expand Down
14 changes: 5 additions & 9 deletions examples/c_parser/c_parser.hancho
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#-------------------------------------------------------------------------------
# C parser example (not finished)

rules = hancho.rules
config = hancho.cpp_config
c_lexer = hancho.c_lexer

lib = hancho(
rules.cpp_lib,
config,
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = ["CContext.cpp", "CNode.cpp", "CScope.cpp"],
out_lib = "c_parser.a",
)

hancho(
rules.cpp_bin,
config,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "c_parser_benchmark.cpp",
in_libs = [c_lexer.lib, lib],
in_libs = [hancho.c_lexer.lib, lib],
out_bin = "c_parser_benchmark",
)

Expand Down
12 changes: 5 additions & 7 deletions examples/json/json.hancho
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
#-------------------------------------------------------------------------------
# Matcheroni JSON parser example

rules = hancho.rules

lib = hancho(
rules.cpp_lib,
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = ["json_matcher.cpp", "json_parser.cpp"],
out_lib = "json_parser.a",
)

hancho(
rules.cpp_bin,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "json_conformance.cpp",
in_libs = lib,
out_bin = "json_conformance",
)

hancho(
rules.cpp_bin,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "json_benchmark.cpp",
in_libs = lib,
out_bin = "json_benchmark",
)

hancho(
rules.cpp_bin,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "json_demo.cpp",
in_libs = lib,
out_bin = "json_demo",
)

hancho(
rules.cpp_test,
hancho.base_rules.cpp_test,
hancho.cpp_config,
in_srcs = "json_test.cpp",
in_libs = lib,
Expand Down
9 changes: 4 additions & 5 deletions examples/regex/regex.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_NAMEDCAPTURE
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_VMODE

rules = hancho.rules

lib = hancho(
rules.cpp_lib,
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = "regex_parser.cpp",
out_lib = "regex_parser.a",
)

hancho(
rules.cpp_bin,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "regex_demo.cpp",
in_libs = lib,
out_bin = "regex_demo",
)

hancho(
rules.cpp_bin,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "regex_benchmark.cpp",
in_libs = lib,
Expand All @@ -38,7 +37,7 @@ hancho(
)

hancho(
rules.cpp_test,
hancho.base_rules.cpp_test,
hancho.cpp_config,
in_srcs = "regex_test.cpp",
in_libs = lib,
Expand Down
6 changes: 2 additions & 4 deletions examples/toml/toml.hancho
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#-------------------------------------------------------------------------------
# TOML parser example

rules = hancho.rules

lib = hancho(
rules.cpp_lib,
hancho.base_rules.cpp_lib,
hancho.cpp_config,
in_srcs = "toml_parser.cpp",
out_lib = "toml_parser.a",
)

hancho(
rules.cpp_test,
hancho.base_rules.cpp_test,
hancho.cpp_config,
in_srcs = "toml_test.cpp",
in_libs = lib,
Expand Down
18 changes: 8 additions & 10 deletions examples/tutorial/tutorial.hancho
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#-------------------------------------------------------------------------------
# Tutorial examples

rules = hancho.rules
config = hancho.cpp_config

hancho(rules.cpp_test, config, in_srcs = "json_tut0a.cpp", out_bin = "json_tut0a")
hancho(rules.cpp_test, config, in_srcs = "json_tut1a.cpp", out_bin = "json_tut1a")
hancho(rules.cpp_test, config, in_srcs = "json_tut1b.cpp", out_bin = "json_tut1b")
hancho(rules.cpp_test, config, in_srcs = "json_tut1c.cpp", out_bin = "json_tut1c")
hancho(rules.cpp_test, config, in_srcs = "json_tut2a.cpp", out_bin = "json_tut2a")
hancho(rules.cpp_test, config, in_srcs = "json_tut2b.cpp", out_bin = "json_tut2b")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut0a.cpp", out_bin = "json_tut0a")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut1a.cpp", out_bin = "json_tut1a")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut1b.cpp", out_bin = "json_tut1b")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut1c.cpp", out_bin = "json_tut1c")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut2a.cpp", out_bin = "json_tut2a")
hancho(hancho.base_rules.cpp_test, hancho.cpp_config, in_srcs = "json_tut2b.cpp", out_bin = "json_tut2b")

hancho(
rules.cpp_bin,
config,
hancho.base_rules.cpp_bin,
hancho.cpp_config,
in_srcs = "tiny_c_parser.cpp",
in_libs = [hancho.c_lexer.lib, hancho.c_parser.lib],
out_bin = "tiny_c_parser",
Expand Down
4 changes: 1 addition & 3 deletions tests/tests.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#build obj/matcheroni/Parseroni.hpp.iwyu : iwyu matcheroni/Parseroni.hpp
#build obj/matcheroni/Utilities.hpp.iwyu : iwyu matcheroni/Utilities.hpp

rules = hancho.rules

# Apparently I broke this...
#hancho(
# rules.cpp_test,
Expand All @@ -15,7 +13,7 @@ rules = hancho.rules
#)

hancho(
rules.cpp_test,
hancho.base_rules.cpp_test,
hancho.cpp_config,
in_srcs = "parseroni_test.cpp",
out_bin = "parseroni_test",
Expand Down

0 comments on commit f588311

Please sign in to comment.