Skip to content

Commit

Permalink
done?
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Oct 19, 2024
1 parent f7f6075 commit d0e0fe1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 34 deletions.
8 changes: 4 additions & 4 deletions build.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ hancho.includes = [".", "{repo_dir}"]
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)
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)

ini = hancho(
hancho.rules.cpp_lib,
Expand Down
22 changes: 13 additions & 9 deletions examples/regex/regex.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,32 @@
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_NAMEDCAPTURE
#benchmark_defs = ${benchmark_defs} -DSRELL_NO_VMODE

regex_parser = imports.rules.cpp_lib(
rules = hancho.pop('rules')

lib = hancho(
rules.cpp_lib,
name = "regex_parser",
in_srcs = "regex_parser.cpp",
)

imports.rules.cpp_bin(
hancho(
rules.cpp_bin,
name = "regex_demo",
in_srcs = "regex_demo.cpp",
in_libs = regex_parser,
in_libs = lib,
)

imports.rules.cpp_bin(
hancho(
rules.cpp_bin,
name = "regex_benchmark",
in_srcs = "regex_benchmark.cpp",
in_libs = regex_parser,
in_libs = lib,
sys_libs = ["boost_system", "boost_regex"],
)

imports.rules.c_test(
hancho(
rules.cpp_test,
name = "regex_test",
in_srcs = "regex_test.cpp",
libs = regex_parser,
in_libs = lib,
)

exports.lib = regex_parser
10 changes: 7 additions & 3 deletions examples/toml/toml.hancho
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#-------------------------------------------------------------------------------
# TOML parser example

toml_parser = imports.rules.cpp_lib(
rules = hancho.pop('rules')

lib = hancho(
rules.cpp_lib,
name = "toml_parser",
in_srcs = "toml_parser.cpp",
)

imports.rules.c_test(
hancho(
rules.cpp_test,
name = "toml_test",
in_srcs = "toml_test.cpp",
in_libs = toml_parser,
in_libs = lib,
)
24 changes: 11 additions & 13 deletions examples/tutorial/tutorial.hancho
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#-------------------------------------------------------------------------------
# Tutorial examples

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

config = hancho.Config(
command_path = "{repo_path}",
)
test_config = hancho.Config(task_dir = "{repo_dir}")

imports.rules.c_test(config, name = "json_tut0a", in_srcs = "json_tut0a.cpp")
imports.rules.c_test(config, name = "json_tut1a", in_srcs = "json_tut1a.cpp")
imports.rules.c_test(config, name = "json_tut1b", in_srcs = "json_tut1b.cpp")
imports.rules.c_test(config, name = "json_tut1c", in_srcs = "json_tut1c.cpp")
imports.rules.c_test(config, name = "json_tut2a", in_srcs = "json_tut2a.cpp")
imports.rules.c_test(config, name = "json_tut2b", in_srcs = "json_tut2b.cpp")
hancho(rules.cpp_test, name = "json_tut0a", in_srcs = "json_tut0a.cpp", test_config = test_config)
hancho(rules.cpp_test, name = "json_tut1a", in_srcs = "json_tut1a.cpp", test_config = test_config)
hancho(rules.cpp_test, name = "json_tut1b", in_srcs = "json_tut1b.cpp", test_config = test_config)
hancho(rules.cpp_test, name = "json_tut1c", in_srcs = "json_tut1c.cpp", test_config = test_config)
hancho(rules.cpp_test, name = "json_tut2a", in_srcs = "json_tut2a.cpp", test_config = test_config)
hancho(rules.cpp_test, name = "json_tut2b", in_srcs = "json_tut2b.cpp", test_config = test_config)

imports.rules.cpp_bin(
config,
hancho(
rules.cpp_bin,
name = "tiny_c_parser",
in_srcs = "tiny_c_parser.cpp",
in_libs = [imports.c_lexer.lib, imports.c_parser.lib],
in_libs = [hancho.c_lexer.lib, hancho.c_parser.lib],
)
15 changes: 10 additions & 5 deletions tests/tests.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
#build obj/matcheroni/Parseroni.hpp.iwyu : iwyu matcheroni/Parseroni.hpp
#build obj/matcheroni/Utilities.hpp.iwyu : iwyu matcheroni/Utilities.hpp

imports.rules.c_test(
name = "matcheroni_test",
in_srcs = "matcheroni_test.cpp",
)
rules = hancho.pop('rules')

# Apparently I broke this...
#hancho(
# rules.cpp_test,
# name = "matcheroni_test",
# in_srcs = "matcheroni_test.cpp",
#)

imports.rules.c_test(
hancho(
rules.cpp_test,
name = "parseroni_test",
in_srcs = "parseroni_test.cpp",
)

0 comments on commit d0e0fe1

Please sign in to comment.