summaryrefslogtreecommitdiff
path: root/src/sexpr
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:16:45 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:33:42 -0700
commit7af4c5b5c561362cb1135ab504095ae667a9270a (patch)
tree49ffd3008d7634ba36f3951493a68e928407ce89 /src/sexpr
parent8d7f1dadeeb1dc1609b72de5a4ee3a5247b0e9e6 (diff)
downloadtmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.gz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.bz2
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.xz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.zip
This is more reliable
Diffstat (limited to 'src/sexpr')
-rw-r--r--src/sexpr/bind.hpp9
-rw-r--r--src/sexpr/fwd.hpp7
-rw-r--r--src/sexpr/lexer.hpp19
-rw-r--r--src/sexpr/parser.hpp17
-rw-r--r--src/sexpr/union.hpp15
-rw-r--r--src/sexpr/variant.hpp29
-rw-r--r--src/sexpr/void.hpp7
7 files changed, 41 insertions, 62 deletions
diff --git a/src/sexpr/bind.hpp b/src/sexpr/bind.hpp
index 7250f9d..79d7cae 100644
--- a/src/sexpr/bind.hpp
+++ b/src/sexpr/bind.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_BIND_HPP
-#define TMWA_SEXPR_BIND_HPP
+#pragma once
// bind.hpp - Like std::bind, but with arbitrary arguments.
//
// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,9 +18,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include <utility>
+#include <utility>
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -47,5 +46,3 @@ namespace sexpr
}
} // namespace sexpr
} // namespace tmwa
-
-#endif //TMWA_SEXPR_VARIANT_HPP
diff --git a/src/sexpr/fwd.hpp b/src/sexpr/fwd.hpp
index 722d923..580b322 100644
--- a/src/sexpr/fwd.hpp
+++ b/src/sexpr/fwd.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_FWD_HPP
-#define TMWA_SEXPR_FWD_HPP
+#pragma once
// sexpr/fwd.hpp - list of type names for sexpr lib
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,12 +18,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "../sanity.hpp"
+#include "../sanity.hpp"
namespace tmwa
{
// meh, add more when I feel like it
} // namespace tmwa
-
-#endif // TMWA_SEXPR_FWD_HPP
diff --git a/src/sexpr/lexer.hpp b/src/sexpr/lexer.hpp
index bd7b532..63be72d 100644
--- a/src/sexpr/lexer.hpp
+++ b/src/sexpr/lexer.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_LEXER_HPP
-#define TMWA_SEXPR_LEXER_HPP
+#pragma once
// lexer.hpp - tokenize a stream of S-expressions
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,17 +18,17 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <vector>
+#include <vector>
-# include "../strings/fwd.hpp"
-# include "../strings/astring.hpp"
-# include "../strings/zstring.hpp"
+#include "../strings/fwd.hpp"
+#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
-# include "../io/line.hpp"
+#include "../io/line.hpp"
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -76,5 +75,3 @@ namespace sexpr
LString token_name(Lexeme tok);
} // namespace sexpr
} // namespace tmwa
-
-#endif // TMWA_SEXPR_LEXER_HPP
diff --git a/src/sexpr/parser.hpp b/src/sexpr/parser.hpp
index c787e56..feed636 100644
--- a/src/sexpr/parser.hpp
+++ b/src/sexpr/parser.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_PARSER_HPP
-#define TMWA_SEXPR_PARSER_HPP
+#pragma once
// parser.hpp - build a tree of S-expressions
//
// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,17 +18,17 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
-# include <cstdlib>
+#include <cstdlib>
-# include "../strings/fwd.hpp"
+#include "../strings/fwd.hpp"
-# include "../io/line.hpp"
+#include "../io/line.hpp"
-# include "lexer.hpp"
+#include "lexer.hpp"
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -84,5 +83,3 @@ namespace sexpr
bool parse(Lexer& lex, SExpr& out);
} // namespace sexpr
} // namespace tmwa
-
-#endif // TMWA_SEXPR_PARSER_HPP
diff --git a/src/sexpr/union.hpp b/src/sexpr/union.hpp
index e0c3051..6a0b6b0 100644
--- a/src/sexpr/union.hpp
+++ b/src/sexpr/union.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_UNION_HPP
-#define TMWA_SEXPR_UNION_HPP
+#pragma once
// union.hpp - A (unsafe!) convenience wrapper for classes in unions.
//
// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,12 +18,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include <utility>
-# include <type_traits>
-# include <cstddef>
-# include <new>
+#include <utility>
+#include <type_traits>
+#include <cstddef>
+#include <new>
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -104,5 +103,3 @@ namespace sexpr
};
} // namespace sexpr
} // namespace tmwa
-
-#endif //TMWA_SEXPR_UNION_HPP
diff --git a/src/sexpr/variant.hpp b/src/sexpr/variant.hpp
index ccbfeaa..04f35dc 100644
--- a/src/sexpr/variant.hpp
+++ b/src/sexpr/variant.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_VARIANT_HPP
-#define TMWA_SEXPR_VARIANT_HPP
+#pragma once
// variant.hpp - A single value, multiple type container. Better than boost's.
//
// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,30 +18,30 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include <type_traits>
-# include <cstdint>
-# include <cstddef>
-# include <utility>
+#include <type_traits>
+#include <cstdint>
+#include <cstddef>
+#include <utility>
-# include "union.hpp"
-# include "void.hpp"
+#include "union.hpp"
+#include "void.hpp"
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
{
namespace sexpr
{
-# define JOIN(a, b) a##b
+#define JOIN(a, b) a##b
-# define WITH_VAR(ty, var, expr) \
+#define WITH_VAR(ty, var, expr) \
for (bool JOIN(var, _guard) = true; JOIN(var, _guard); ) \
for (ty var = expr; JOIN(var, _guard); JOIN(var, _guard) = false)
-# define MATCH(expr) \
+#define MATCH(expr) \
WITH_VAR(auto&&, _match_var, expr) \
switch (tmwa::sexpr::VariantFriend::get_state(_match_var))
-# define CASE(ty, var) \
+#define CASE(ty, var) \
break; \
case tmwa::sexpr::VariantFriend::get_state_for<ty, decltype(_match_var)>(): \
WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get<ty>(_match_var))
@@ -114,6 +113,4 @@ namespace sexpr
} // namespace sexpr
} // namespace tmwa
-# include "variant.tcc"
-
-#endif //TMWA_SEXPR_VARIANT_HPP
+#include "variant.tcc"
diff --git a/src/sexpr/void.hpp b/src/sexpr/void.hpp
index 9fb6bc4..4ef20cc 100644
--- a/src/sexpr/void.hpp
+++ b/src/sexpr/void.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_VOID_HPP
-#define TMWA_SEXPR_VOID_HPP
+#pragma once
// void.hpp - A type that represents nothing and anything.
//
// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
@@ -39,5 +38,3 @@ namespace sexpr
constexpr Void::Void() noexcept = default;
} // namespace sexpr
} // namespace tmwa
-
-#endif //TMWA_SEXPR_VOID_HPP