From 7af4c5b5c561362cb1135ab504095ae667a9270a Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Fri, 27 Jun 2014 19:16:45 -0700 Subject: This is more reliable --- src/sexpr/bind.hpp | 9 +++------ src/sexpr/fwd.hpp | 7 ++----- src/sexpr/lexer.hpp | 19 ++++++++----------- src/sexpr/parser.hpp | 17 +++++++---------- src/sexpr/union.hpp | 15 ++++++--------- src/sexpr/variant.hpp | 29 +++++++++++++---------------- src/sexpr/void.hpp | 7 ++----- 7 files changed, 41 insertions(+), 62 deletions(-) (limited to 'src/sexpr') 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 @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include +#include -# 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 @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# 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 @@ -19,17 +18,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include +#include -# 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 @@ -19,17 +18,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include +#include -# 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 @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include -# include -# include -# include +#include +#include +#include +#include -# 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 @@ -19,30 +18,30 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include -# include -# include -# include +#include +#include +#include +#include -# 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(): \ WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get(_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 @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# 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 -- cgit v1.2.3-60-g2f50