Make UEFI boot-platform build again
[haiku.git] / headers / private / shared / ExpressionParser.h
blobb180b87e17d07eb97acf1daa6a903196d13a45de
1 /*
2 * Copyright 2006-2009 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 * John Scipione <jscipione@gmail.com>
8 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
9 */
10 #ifndef EXPRESSION_PARSER_H
11 #define EXPRESSION_PARSER_H
14 #include <String.h>
17 class ParseException {
18 public:
19 ParseException(const char* message, int32 position)
20 : message(message),
21 position(position)
25 ParseException(const ParseException& other)
26 : message(other.message),
27 position(other.position)
31 BString message;
32 int32 position;
35 struct Function;
36 class MAPM;
38 class ExpressionParser {
40 public:
41 ExpressionParser();
42 ~ExpressionParser();
44 bool DegreeMode();
45 void SetDegreeMode(bool degrees);
47 void SetSupportHexInput(bool enabled);
49 BString Evaluate(const char* expressionString);
50 int64 EvaluateToInt64(const char* expressionString);
51 double EvaluateToDouble(const char* expressionString);
53 private:
54 struct Token;
55 class Tokenizer;
57 private:
58 MAPM _ParseBinary();
59 MAPM _ParseSum();
60 MAPM _ParseProduct();
61 MAPM _ParsePower();
62 MAPM _ParseUnary();
63 void _InitArguments(MAPM values[],
64 int32 argumentCount);
65 MAPM _ParseFunction(const Token& token);
66 MAPM _ParseAtom();
67 MAPM _ParseFactorial(MAPM value);
69 void _EatToken(int32 type);
71 Tokenizer* fTokenizer;
73 bool fDegreeMode;
76 #endif // EXPRESSION_PARSER_H