From 07e8c38f487c7efd58c164c608901756e3463bee Mon Sep 17 00:00:00 2001 From: TheDeathlyCow Date: Sun, 5 Nov 2023 00:01:27 +1300 Subject: [PATCH] change include folder to calyx --- src/{include => calyx}/filters.cpp | 0 src/{include => calyx}/filters.h | 0 src/{include => calyx}/grammar.cpp | 2 +- src/{include/calyx.h => calyx/grammar.h} | 33 +--------------- src/{include => calyx}/result.cpp | 2 +- src/calyx/result.h | 43 +++++++++++++++++++++ src/{include => calyx}/string_converter.cpp | 0 src/{include => calyx}/string_converter.h | 0 src/errors.h | 2 +- src/expansion.h | 2 +- src/options.h | 2 +- src/production/uniform_branch.h | 2 +- src/registry.h | 4 +- src/rule.h | 2 +- src/syntax/atom_node.h | 2 +- src/syntax/expression_node.h | 2 +- src/syntax/template_node.h | 2 +- src/syntax/unique_node.h | 2 +- test/cycle_test.cpp | 2 +- test/expansion_test.cpp | 2 +- test/filter_test.cpp | 2 +- test/options_test.cpp | 2 +- test/production/weighted_branch_test.cpp | 2 +- test/registry_test.cpp | 2 +- test/result_test.cpp | 2 +- test/syntax/atom_node_test.cpp | 2 +- test/syntax/expression_chain_test.cpp | 2 +- test/syntax/expression_node_test.cpp | 2 +- test/syntax/memo_node_test.cpp | 2 +- test/syntax/template_fragment_test.cpp | 2 +- test/syntax/template_node_test.cpp | 2 +- test/syntax/unique_node_test.cpp | 2 +- 32 files changed, 71 insertions(+), 59 deletions(-) rename src/{include => calyx}/filters.cpp (100%) rename src/{include => calyx}/filters.h (100%) rename src/{include => calyx}/grammar.cpp (99%) rename src/{include/calyx.h => calyx/grammar.h} (90%) rename src/{include => calyx}/result.cpp (91%) create mode 100644 src/calyx/result.h rename src/{include => calyx}/string_converter.cpp (100%) rename src/{include => calyx}/string_converter.h (100%) diff --git a/src/include/filters.cpp b/src/calyx/filters.cpp similarity index 100% rename from src/include/filters.cpp rename to src/calyx/filters.cpp diff --git a/src/include/filters.h b/src/calyx/filters.h similarity index 100% rename from src/include/filters.h rename to src/calyx/filters.h diff --git a/src/include/grammar.cpp b/src/calyx/grammar.cpp similarity index 99% rename from src/include/grammar.cpp rename to src/calyx/grammar.cpp index ee1c717..9d0e47c 100644 --- a/src/include/grammar.cpp +++ b/src/calyx/grammar.cpp @@ -1,4 +1,4 @@ -#include "calyx.h" +#include "grammar.h" using namespace calyx; diff --git a/src/include/calyx.h b/src/calyx/grammar.h similarity index 90% rename from src/include/calyx.h rename to src/calyx/grammar.h index b4dc402..221fb48 100644 --- a/src/include/calyx.h +++ b/src/calyx/grammar.h @@ -15,41 +15,10 @@ #include "../options.h" #include "string_converter.h" #include "../errors.h" -#include "../expansion.h" +#include "result.h" namespace calyx { - /** - * @brief Class representing the result of a random generation of text from a grammar. Allows for access to the underlying - * expansion tree, as well as the ability to flatten the tree into a string. - */ - class Result - { - public: - /** - * @brief Constructs the Result out of an expansion tree. - * @param tree The expansion tree of the result. - */ - Result(Expansion tree); - - /** - * @brief Get the expansion tree of the result - * - * @return Returns a reference to the expansion tree of this result - */ - const Expansion& getTree() const; - - /** - * @brief Flattens the text into a new string, and returns it - * - * @param options Options for evaluating the text. - * @return Returns a new string_t - */ - String_t getText(const Options& options) const; - - private: - Expansion _tree; - }; /** * @brief Defines a grammar in calyx. Grammars are a set of mutually-recursive rules that are evaluated randomly in order to diff --git a/src/include/result.cpp b/src/calyx/result.cpp similarity index 91% rename from src/include/result.cpp rename to src/calyx/result.cpp index edc2eee..afd7578 100644 --- a/src/include/result.cpp +++ b/src/calyx/result.cpp @@ -1,4 +1,4 @@ -#include "calyx.h" +#include "grammar.h" using namespace calyx; diff --git a/src/calyx/result.h b/src/calyx/result.h new file mode 100644 index 0000000..2a52068 --- /dev/null +++ b/src/calyx/result.h @@ -0,0 +1,43 @@ +#pragma once + +#include + +#include "filters.h" +#include "../registry.h" +#include "../options.h" +#include "string_converter.h" + +namespace calyx +{ + /** + * @brief Class representing the result of a random generation of text from a grammar. Allows for access to the underlying + * expansion tree, as well as the ability to flatten the tree into a string. + */ + class Result + { + public: + /** + * @brief Constructs the Result out of an expansion tree. + * @param tree The expansion tree of the result. + */ + Result(Expansion tree); + + /** + * @brief Get the expansion tree of the result + * + * @return Returns a reference to the expansion tree of this result + */ + const Expansion& getTree() const; + + /** + * @brief Flattens the text into a new string, and returns it + * + * @param options Options for evaluating the text. + * @return Returns a new string_t + */ + String_t getText(const Options& options) const; + + private: + Expansion _tree; + }; +} \ No newline at end of file diff --git a/src/include/string_converter.cpp b/src/calyx/string_converter.cpp similarity index 100% rename from src/include/string_converter.cpp rename to src/calyx/string_converter.cpp diff --git a/src/include/string_converter.h b/src/calyx/string_converter.h similarity index 100% rename from src/include/string_converter.h rename to src/calyx/string_converter.h diff --git a/src/errors.h b/src/errors.h index c46410e..112b04c 100644 --- a/src/errors.h +++ b/src/errors.h @@ -1,6 +1,6 @@ #pragma once -#include "include/string_converter.h" +#include "calyx/string_converter.h" namespace calyx { diff --git a/src/expansion.h b/src/expansion.h index 4b67e82..4e4c608 100644 --- a/src/expansion.h +++ b/src/expansion.h @@ -4,7 +4,7 @@ #include #include -#include "include/string_converter.h" +#include "calyx/string_converter.h" #include "options.h" namespace calyx diff --git a/src/options.h b/src/options.h index 97c2dd5..49eca76 100644 --- a/src/options.h +++ b/src/options.h @@ -4,7 +4,7 @@ #include #include #include -#include "include/string_converter.h" +#include "calyx/string_converter.h" #include "errors.h" diff --git a/src/production/uniform_branch.h b/src/production/uniform_branch.h index 9dd815b..80edb72 100644 --- a/src/production/uniform_branch.h +++ b/src/production/uniform_branch.h @@ -6,7 +6,7 @@ #include "../production.h" #include "../registry.h" #include "../expansion.h" -#include "../include/string_converter.h" +#include "../calyx/string_converter.h" namespace calyx { diff --git a/src/registry.h b/src/registry.h index db772e7..920b5ee 100644 --- a/src/registry.h +++ b/src/registry.h @@ -10,8 +10,8 @@ #include "rule.h" #include "expansion.h" #include "cycle.h" -#include "include/filters.h" -#include "include/string_converter.h" +#include "calyx/filters.h" +#include "calyx/string_converter.h" namespace calyx { diff --git a/src/rule.h b/src/rule.h index 97f48ae..d8e1347 100644 --- a/src/rule.h +++ b/src/rule.h @@ -6,7 +6,7 @@ #include #include "expansion.h" -#include "include/string_converter.h" +#include "calyx/string_converter.h" #include "production.h" namespace calyx diff --git a/src/syntax/atom_node.h b/src/syntax/atom_node.h index 40ffdee..57b809d 100644 --- a/src/syntax/atom_node.h +++ b/src/syntax/atom_node.h @@ -4,7 +4,7 @@ #include "../registry.h" #include "../production.h" #include "../expansion.h" -#include "../include/string_converter.h" +#include "../calyx/string_converter.h" #include "../options.h" namespace calyx diff --git a/src/syntax/expression_node.h b/src/syntax/expression_node.h index 881ac13..d5caa91 100644 --- a/src/syntax/expression_node.h +++ b/src/syntax/expression_node.h @@ -4,7 +4,7 @@ #include "../production.h" #include "../expansion.h" -#include "../include/string_converter.h" +#include "../calyx/string_converter.h" #include "../options.h" #include "../registry.h" diff --git a/src/syntax/template_node.h b/src/syntax/template_node.h index 81decbc..e8e56a5 100644 --- a/src/syntax/template_node.h +++ b/src/syntax/template_node.h @@ -2,7 +2,7 @@ #include "../production.h" #include "../expansion.h" -#include "../include/string_converter.h" +#include "../calyx/string_converter.h" #include "../options.h" #include "../registry.h" diff --git a/src/syntax/unique_node.h b/src/syntax/unique_node.h index 982c42f..3cee631 100644 --- a/src/syntax/unique_node.h +++ b/src/syntax/unique_node.h @@ -1,6 +1,6 @@ #pragma once #include "../production.h" -#include "../include/string_converter.h" +#include "../calyx/string_converter.h" namespace calyx { diff --git a/test/cycle_test.cpp b/test/cycle_test.cpp index d8b49b9..198887a 100644 --- a/test/cycle_test.cpp +++ b/test/cycle_test.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include using namespace calyx; diff --git a/test/expansion_test.cpp b/test/expansion_test.cpp index 9d2adfc..168199b 100644 --- a/test/expansion_test.cpp +++ b/test/expansion_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/test/filter_test.cpp b/test/filter_test.cpp index 2528734..c87e87a 100644 --- a/test/filter_test.cpp +++ b/test/filter_test.cpp @@ -1,6 +1,6 @@ #include -#include "include/calyx.h" +#include "calyx/grammar.h" using namespace calyx; diff --git a/test/options_test.cpp b/test/options_test.cpp index dc531a3..cf3b928 100644 --- a/test/options_test.cpp +++ b/test/options_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/test/production/weighted_branch_test.cpp b/test/production/weighted_branch_test.cpp index 39b6e00..524220f 100644 --- a/test/production/weighted_branch_test.cpp +++ b/test/production/weighted_branch_test.cpp @@ -2,7 +2,7 @@ #include -#include +#include using namespace calyx; diff --git a/test/registry_test.cpp b/test/registry_test.cpp index 435f303..ee3326d 100644 --- a/test/registry_test.cpp +++ b/test/registry_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include using namespace calyx; diff --git a/test/result_test.cpp b/test/result_test.cpp index b2e177f..24dd037 100644 --- a/test/result_test.cpp +++ b/test/result_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/test/syntax/atom_node_test.cpp b/test/syntax/atom_node_test.cpp index 2e100de..8274e35 100644 --- a/test/syntax/atom_node_test.cpp +++ b/test/syntax/atom_node_test.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/test/syntax/expression_chain_test.cpp b/test/syntax/expression_chain_test.cpp index a70aa1f..a5c639c 100644 --- a/test/syntax/expression_chain_test.cpp +++ b/test/syntax/expression_chain_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include using namespace calyx; diff --git a/test/syntax/expression_node_test.cpp b/test/syntax/expression_node_test.cpp index 4e60f2d..e336e0f 100644 --- a/test/syntax/expression_node_test.cpp +++ b/test/syntax/expression_node_test.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include using namespace calyx; diff --git a/test/syntax/memo_node_test.cpp b/test/syntax/memo_node_test.cpp index eb74bed..191311c 100644 --- a/test/syntax/memo_node_test.cpp +++ b/test/syntax/memo_node_test.cpp @@ -2,7 +2,7 @@ #include -#include +#include using namespace calyx; diff --git a/test/syntax/template_fragment_test.cpp b/test/syntax/template_fragment_test.cpp index a9c055a..a88068c 100644 --- a/test/syntax/template_fragment_test.cpp +++ b/test/syntax/template_fragment_test.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include using namespace calyx; diff --git a/test/syntax/template_node_test.cpp b/test/syntax/template_node_test.cpp index 5e813d2..2c0c277 100644 --- a/test/syntax/template_node_test.cpp +++ b/test/syntax/template_node_test.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include using namespace calyx; diff --git a/test/syntax/unique_node_test.cpp b/test/syntax/unique_node_test.cpp index 317f5cd..89cee36 100644 --- a/test/syntax/unique_node_test.cpp +++ b/test/syntax/unique_node_test.cpp @@ -2,7 +2,7 @@ #include -#include "include/calyx.h" +#include "calyx/grammar.h" #include "syntax/template_node.h" using namespace calyx;