ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
parser.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header file is part of module \alib_expressions of the \aliblong.
4///
5/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8#ifndef HPP_ALIB_EXPRESSIONS_DETAIL_PARSER
9#define HPP_ALIB_EXPRESSIONS_DETAIL_PARSER
10#pragma once
12
13ALIB_ASSERT_MODULE(EXPRESSIONS)
14
15namespace alib {
16namespace monomem { template<typename TAllocator>class TMonoAllocator; }
17namespace expressions { class Compiler;
18namespace detail { struct AST;
19
20//==================================================================================================
21/// This detail class constitutes an abstract base class for expression parsers.
22//==================================================================================================
23struct Parser
24{
25 /// Virtual destructor.
26 virtual ~Parser() {}
27
28 /// Parses the given expression string.
29 /// \note
30 /// The return value is hidden by using <c>void*</c>. This is to allow avoid flooding
31 /// of \c boost header includes files to the code entities using module \alib_expressions_nl.
32 ///
33 /// @param expressionString The string to parse.
34 /// @param numberFormat Used to parse literal numbers.
35 /// @return The abstract syntax tree representing the expression.
36 virtual detail::AST* Parse( const String& expressionString,
37 NumberFormat* numberFormat ) = 0;
38
39
40 /// Static method to create a parser object.
41 ///
42 /// @param compiler The compiler that needs a parser.
43 /// @return The parser.
44 ALIB_API static
45 Parser* Create( Compiler& compiler );
46};
47
48}}} // namespace [alib::expressions::detail]
49
50
51#endif // HPP_ALIB_EXPRESSIONS_DETAIL_PARSER
52
#define ALIB_ASSERT_MODULE(modulename)
Definition alib.hpp:223
#define ALIB_API
Definition alib.hpp:639
Definition alib.cpp:69
expressions::Compiler Compiler
Type alias in namespace alib.
Definition compiler.hpp:553
This detail class constitutes an abstract base class for expression parsers.
Definition parser.hpp:24
virtual ~Parser()
Virtual destructor.
Definition parser.hpp:26
static ALIB_API Parser * Create(Compiler &compiler)
Definition parser.cpp:19
virtual detail::AST * Parse(const String &expressionString, NumberFormat *numberFormat)=0