Skip to content

Commit

Permalink
ok that's working again
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Oct 21, 2024
1 parent 3e5d696 commit aaede0a
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 20 deletions.
10 changes: 7 additions & 3 deletions build.hancho
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# matcheroni/build.hancho

hancho.build_tag = "debug"
hancho.rules = hancho.load("symlinks/hancho/rules.hancho")
hancho.includes = [".", "{repo_dir}"]
hancho.build_tag = "debug"
hancho.rules = hancho.load("symlinks/hancho/rules.hancho")
hancho.cpp_config = hancho.Config(
includes = "{repo_dir}",
test_dir = "{repo_dir}",
)

json = hancho.load("examples/json/json.hancho")
regex = hancho.load("examples/regex/regex.hancho")
Expand All @@ -15,6 +18,7 @@ tutorial = hancho.load("examples/tutorial/tutorial.hancho", c_lexer = c_lexer, c

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

rules = hancho.pop('rules')
rules = hancho.rules
config = hancho.cpp_config

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

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

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

rules = hancho.pop('rules')
c_lexer = hancho.pop('c_lexer')
rules = hancho.rules
config = hancho.cpp_config
c_lexer = hancho.c_lexer

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

hancho(
rules.cpp_bin,
config,
in_srcs = "c_parser_benchmark.cpp",
in_libs = [c_lexer.lib, lib],
out_bin = "c_parser_benchmark",
Expand Down
11 changes: 8 additions & 3 deletions examples/json/json.hancho
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
#-------------------------------------------------------------------------------
# Matcheroni JSON parser example

rules = hancho.pop('rules')
rules = hancho.rules

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

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

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

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

hancho(
rules.cpp_test,
hancho.cpp_config,
in_srcs = "json_test.cpp",
in_libs = lib,
out_bin = "json_test",
Expand Down
6 changes: 5 additions & 1 deletion examples/regex/regex.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_NAMEDCAPTURE
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_VMODE

rules = hancho.pop('rules')
rules = hancho.rules

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

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

hancho(
rules.cpp_bin,
hancho.cpp_config,
in_srcs = "regex_benchmark.cpp",
in_libs = lib,
out_bin = "regex_benchmark",
Expand All @@ -36,6 +39,7 @@ hancho(

hancho(
rules.cpp_test,
hancho.cpp_config,
in_srcs = "regex_test.cpp",
in_libs = lib,
out_bin = "regex_test",
Expand Down
4 changes: 3 additions & 1 deletion examples/toml/toml.hancho
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#-------------------------------------------------------------------------------
# TOML parser example

rules = hancho.pop('rules')
rules = hancho.rules

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

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

rules = hancho.pop('rules')
rules = hancho.rules
config = hancho.cpp_config

test_config = hancho.Config(task_dir = "{repo_dir}")

hancho(rules.cpp_test, in_srcs = "json_tut0a.cpp", out_bin = "json_tut0a", test_config = test_config)
hancho(rules.cpp_test, in_srcs = "json_tut1a.cpp", out_bin = "json_tut1a", test_config = test_config)
hancho(rules.cpp_test, in_srcs = "json_tut1b.cpp", out_bin = "json_tut1b", test_config = test_config)
hancho(rules.cpp_test, in_srcs = "json_tut1c.cpp", out_bin = "json_tut1c", test_config = test_config)
hancho(rules.cpp_test, in_srcs = "json_tut2a.cpp", out_bin = "json_tut2a", test_config = test_config)
hancho(rules.cpp_test, in_srcs = "json_tut2b.cpp", out_bin = "json_tut2b", test_config = test_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(
rules.cpp_bin,
config,
in_srcs = "tiny_c_parser.cpp",
in_libs = [hancho.c_lexer.lib, hancho.c_parser.lib],
out_bin = "tiny_c_parser",
Expand Down
1 change: 1 addition & 0 deletions tests/tests.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rules = hancho.rules

hancho(
rules.cpp_test,
hancho.cpp_config,
in_srcs = "parseroni_test.cpp",
out_bin = "parseroni_test",
)

0 comments on commit aaede0a

Please sign in to comment.