|
| static bool | is_truthy (const std::variant< int64_t, double > &val) |
| static std::string | toString (const std::variant< int64_t, double > &val) |
Definition at line 565 of file Preprocessor.cpp.
◆ Evaluator()
| infix2postfix::preprocessor::Evaluator::Evaluator |
( |
const std::vector< Token > & | tokens | ) |
|
|
inlineexplicit |
◆ evaluate()
| std::variant< int64_t, double > infix2postfix::preprocessor::Evaluator::evaluate |
( |
| ) |
|
|
inline |
Definition at line 570 of file Preprocessor.cpp.
570 {
571 pos = 0;
572 skipWhitespace();
573
574 if (is_eof()) {
575 throw std::runtime_error("Cannot evaluate an empty expression");
576 }
577
578 Value result = parseConditional();
579 skipWhitespace();
580
581 if (!is_eof()) {
582 throw std::runtime_error("Unexpected tokens at end of expression");
583 }
584
585 return result.val;
586 }
Referenced by tryEvaluate().
◆ is_truthy()
| bool infix2postfix::preprocessor::Evaluator::is_truthy |
( |
const std::variant< int64_t, double > & | val | ) |
|
|
inlinestatic |
◆ toString()
| std::string infix2postfix::preprocessor::Evaluator::toString |
( |
const std::variant< int64_t, double > & | val | ) |
|
|
inlinestatic |
◆ tryEvaluate()
| std::optional< std::variant< int64_t, double > > infix2postfix::preprocessor::Evaluator::tryEvaluate |
( |
| ) |
|
|
inline |
Definition at line 588 of file Preprocessor.cpp.
588 {
589 try {
591 } catch (const PreprocessorError&) {
592 throw;
593 } catch (const std::runtime_error&) {
594 return std::nullopt;
595 }
596 }
std::variant< int64_t, double > evaluate()
References evaluate().
The documentation for this class was generated from the following file: