#include <parameterdescription.h>
Public Member Functions | |
| Parser (const std::string &) | |
| std::string | run () |
Static Public Member Functions | |
| static std::string | parse (const std::string &) |
program: END expression END
expression: expression + term expression - term term
term: term / primary term * primary primary
primary: NUMBER
In other words, the operations +,-,*,/ are supported as well as parentheses for grouping. But as soon as a non-number character (i.e. arbitrary string) is found, the parsing is terminated and a simth::token_not_found exception is thrown.
|
|
Only store the string, don't do anything yet |
|
|
Parse the string. This parser will only accept number expressions. As soon as a non-number character (i.e. arbitrary string) is found, the parsing is terminated and a simth::token_not_found exception is thrown. |
|
|
Driver for the parser. Returns a string with the evaluated arithmetic expression. If there are any non-number literals in the string, the parsing will be stopped and the input string will be returned unchanged. |
1.4.1