|
|
@@ -14,6 +14,26 @@
|
|
|
|
|
|
namespace dice {
|
|
|
|
|
|
+/*
|
|
|
+ * A parser that translates a stream of text input into a dice object. The
|
|
|
+ * string matches the following schema-rule:
|
|
|
+ *
|
|
|
+ * dice-string:
|
|
|
+ * dice-expression
|
|
|
+ * positive-integer { dice-expression }
|
|
|
+ *
|
|
|
+ * positive-integer: Any integer number >= 0
|
|
|
+ *
|
|
|
+ * dice-expression:
|
|
|
+ * die-expression
|
|
|
+ * die-expression + dice-expression
|
|
|
+ * die-expression - dice-expression
|
|
|
+ *
|
|
|
+ * die-expression:
|
|
|
+ * integer
|
|
|
+ * positive-integer 'd' positive-integer
|
|
|
+ * positive-integer 'D' positive-integer
|
|
|
+ */
|
|
|
class parser {
|
|
|
private:
|
|
|
std::istream & is_;
|