/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "selelem.h"
//! Error handler needed by Bison.
-static void
-yyerror(YYLTYPE *location, yyscan_t scanner, char const *s)
+static void yyerror(YYLTYPE* location, yyscan_t scanner, char const* s)
{
try
{
}
_gmx_sel_lexer_set_exception(scanner, std::make_exception_ptr(ex));
}
- catch (const std::exception &)
+ catch (const std::exception&)
{
_gmx_sel_lexer_set_exception(scanner, std::current_exception());
}
}
//! Logic for computing the location of the output of Bison reduction.
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- do { \
- if ((N) != 0) \
- { \
- (Current).startIndex = YYRHSLOC(Rhs, 1).startIndex; \
- (Current).endIndex = YYRHSLOC(Rhs, N).endIndex; \
- } \
- else \
- { \
- (Current).startIndex = (Current).endIndex = \
- YYRHSLOC(Rhs, 0).endIndex; \
- } \
- _gmx_sel_lexer_set_current_location(scanner, (Current)); \
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ { \
+ if ((N) != 0) \
+ { \
+ (Current).startIndex = YYRHSLOC(Rhs, 1).startIndex; \
+ (Current).endIndex = YYRHSLOC(Rhs, N).endIndex; \
+ } \
+ else \
+ { \
+ (Current).startIndex = (Current).endIndex = YYRHSLOC(Rhs, 0).endIndex; \
+ } \
+ _gmx_sel_lexer_set_current_location(scanner, (Current)); \
} while (0)
/*! \brief
*/
//! Starts an action that may throw exceptions.
#define BEGIN_ACTION \
- try {
+ try \
+ {
//! Finishes an action that may throw exceptions.
-#define END_ACTION \
- } \
- catch (std::exception &ex) \
- { \
- if (_gmx_selparser_handle_exception(scanner, &ex)) \
- { \
- YYERROR; \
- } \
- else \
- { \
- YYABORT; \
- } \
+#define END_ACTION \
+ } \
+ catch (std::exception & ex) \
+ { \
+ if (_gmx_selparser_handle_exception(scanner, &ex)) \
+ { \
+ YYERROR; \
+ } \
+ else \
+ { \
+ YYABORT; \
+ } \
}
//! Finishes an action that may throw exceptions and does not support resuming.
-#define END_ACTION_TOPLEVEL \
- } \
- catch (const std::exception &) \
- { \
+#define END_ACTION_TOPLEVEL \
+ } \
+ catch (const std::exception&) \
+ { \
_gmx_sel_lexer_set_exception(scanner, std::current_exception()); \
- YYABORT; \
+ YYABORT; \
}
//!\}
* Does not throw for smart pointer types. If used with types that may throw,
* the order of operations should be such that it is exception-safe.
*/
-template <typename ValueType> static
-ValueType get(ValueType *src)
+template<typename ValueType>
+static ValueType get(ValueType* src)
{
GMX_RELEASE_ASSERT(src != nullptr, "Semantic value pointers should be non-NULL");
const std::unique_ptr<ValueType> srcGuard(src);
* This should be the last statement before ::END_ACTION, except for a
* possible ::CHECK_SEL.
*/
-template <typename ValueType> static
-void set(ValueType * &dest, ValueType value)
+template<typename ValueType>
+static void set(ValueType*& dest, ValueType value)
{
dest = new ValueType(std::move(value));
}
* This should be the last statement before ::END_ACTION, except for a
* possible ::CHECK_SEL.
*/
-template <typename ValueType> static
-void set_empty(ValueType * &dest)
+template<typename ValueType>
+static void set_empty(ValueType*& dest)
{
dest = new ValueType;
}
* exceptions.
*/
#define CHECK_SEL(sel) \
- if (!*(sel)) { \
- delete (sel); \
- YYERROR; \
+ if (!*(sel)) \
+ { \
+ delete (sel); \
+ YYERROR; \
}
#endif