Преглед на файлове

Add schema info for parser.

Sam Jaffe преди 4 години
родител
ревизия
a4fd39e75e
променени са 1 файла, в които са добавени 20 реда и са изтрити 0 реда
  1. 20 0
      include/dice-roll/parser.h

+ 20 - 0
include/dice-roll/parser.h

@@ -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_;