blob: 141b870d2355c5aacb05dd4ce4077d045295f019 [file] [log] [blame]
Alexander Hansen4e1142d2025-07-25 17:07:27 +02001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2017 Intel Corporation, 2022 IBM Corp.
Andrew Jefferya05437e2022-04-07 16:17:21 +09303
4#pragma once
5
6#include <optional>
7#include <string>
Andrew Jeffery5ace4e42022-04-07 16:58:30 +09308#include <vector>
Andrew Jefferya05437e2022-04-07 16:17:21 +09309
10namespace expression
11{
12enum class Operation
13{
14 addition,
15 division,
16 multiplication,
17 subtraction,
18 modulo,
19};
20
John Edward Broadbent59b275f2022-10-06 15:26:25 -070021std::optional<Operation> parseOperation(const std::string& op);
Andrew Jefferya05437e2022-04-07 16:17:21 +093022int evaluate(int a, Operation op, int b);
Andrew Jeffery95559612022-04-07 17:22:47 +093023int evaluate(int substitute, std::vector<std::string>::iterator curr,
24 std::vector<std::string>::iterator& end);
Andrew Jefferya05437e2022-04-07 16:17:21 +093025} // namespace expression