Skip to content

Commit

Permalink
change include folder to calyx
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDeathlyCow committed Nov 4, 2023
1 parent 3d7b808 commit 07e8c38
Show file tree
Hide file tree
Showing 32 changed files with 71 additions and 59 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/include/grammar.cpp → src/calyx/grammar.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "calyx.h"
#include "grammar.h"

using namespace calyx;

Expand Down
33 changes: 1 addition & 32 deletions src/include/calyx.h → src/calyx/grammar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/include/result.cpp → src/calyx/result.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "calyx.h"
#include "grammar.h"


using namespace calyx;
Expand Down
43 changes: 43 additions & 0 deletions src/calyx/result.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once

#include <string>

#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;
};
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/errors.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "include/string_converter.h"
#include "calyx/string_converter.h"

namespace calyx
{
Expand Down
2 changes: 1 addition & 1 deletion src/expansion.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <vector>
#include <vector>

#include "include/string_converter.h"
#include "calyx/string_converter.h"
#include "options.h"

namespace calyx
Expand Down
2 changes: 1 addition & 1 deletion src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <random>
#include <memory>
#include <stdint.h>
#include "include/string_converter.h"
#include "calyx/string_converter.h"
#include "errors.h"


Expand Down
2 changes: 1 addition & 1 deletion src/production/uniform_branch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <optional>

#include "expansion.h"
#include "include/string_converter.h"
#include "calyx/string_converter.h"
#include "production.h"

namespace calyx
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/atom_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/expression_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/syntax/template_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/syntax/unique_node.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "../production.h"
#include "../include/string_converter.h"
#include "../calyx/string_converter.h"

namespace calyx
{
Expand Down
2 changes: 1 addition & 1 deletion test/cycle_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <catch2/catch_all.hpp>

#include <memory>
#include <include/calyx.h>
#include <calyx/grammar.h>
#include <cycle.h>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/expansion_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <expansion.h>
#include <vector>
#include <options.h>
Expand Down
2 changes: 1 addition & 1 deletion test/filter_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include "include/calyx.h"
#include "calyx/grammar.h"

using namespace calyx;

Expand Down
2 changes: 1 addition & 1 deletion test/options_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <options.h>
#include <stdint.h>

Expand Down
2 changes: 1 addition & 1 deletion test/production/weighted_branch_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>

using namespace calyx;

Expand Down
2 changes: 1 addition & 1 deletion test/registry_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <registry.h>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/result_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <expansion.h>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion test/syntax/atom_node_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <catch2/catch_all.hpp>
#include <memory>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <syntax/atom_node.h>
#include <errors.h>

Expand Down
2 changes: 1 addition & 1 deletion test/syntax/expression_chain_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>
#include <iostream>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/syntax/expression_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <vector>
#include <string>
#include <include/calyx.h>
#include <calyx/grammar.h>
#include <syntax/expression_node.h>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/syntax/memo_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <catch2/catch_all.hpp>

#include <include/calyx.h>
#include <calyx/grammar.h>

using namespace calyx;

Expand Down
2 changes: 1 addition & 1 deletion test/syntax/template_fragment_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <vector>
#include <string>
#include <include/calyx.h>
#include <calyx/grammar.h>
#include <syntax/template_node.h>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/syntax/template_node_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <catch2/catch_all.hpp>
#include <include/calyx.h>
#include <calyx/grammar.h>
#include <syntax/template_node.h>

using namespace calyx;
Expand Down
2 changes: 1 addition & 1 deletion test/syntax/unique_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <catch2/catch_all.hpp>

#include "include/calyx.h"
#include "calyx/grammar.h"
#include "syntax/template_node.h"

using namespace calyx;
Expand Down

0 comments on commit 07e8c38

Please sign in to comment.