[m-rev.] diff: fix calculator example with CRLF line endings
Julien Fischer
jfischer at opturion.com
Sat Jul 27 02:14:19 AEST 2013
Branches: master, 13.05.
Make the calculator example handle CRLF line endings.
samples/calculator.m;
As above.
diff --git a/samples/calculator.m b/samples/calculator.m
index 7242dce..86f92ff 100644
--- a/samples/calculator.m
+++ b/samples/calculator.m
@@ -76,7 +76,7 @@ evalexpr(div(X, Y)) = evalexpr(X) // evalexpr(Y).
fullexpr(X) -->
expr(X),
- ['\n'].
+ newline.
:- pred expr(expr::out, list(char)::in, list(char)::out) is semidet.
@@ -134,6 +134,11 @@ digit(Char) -->
[Char],
{ char.is_digit(Char) }.
+:- pred newline(list(char)::in, list(char)::out) is semidet.
+
+newline --> ['\n'].
+newline --> ['\r'], ['\n'].
+
%-----------------------------------------------------------------------------%
:- end_module calculator.
%-----------------------------------------------------------------------------%
More information about the reviews
mailing list