about summary refs log tree commit diff stats
path: root/apps/factorial.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-10 00:47:10 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-16 01:14:06 -0800
commitdeacf2c94e7b6a549c5b302e18e5f7d1a68ec2a8 (patch)
tree1746f20a7469205b9c0203d205ceca9deaf14142 /apps/factorial.mu
parent65eb2a57148f02a5ce59b784c0aeaaca116c205b (diff)
downloadmu-deacf2c94e7b6a549c5b302e18e5f7d1a68ec2a8.tar.gz
6008
Allow comments at the end of all kinds of statements.

To do this I replaced all calls to next-word with next-mu-token.. except
one. I'm not seeing any bugs yet, any places where comments break things.
But this exception makes me nervous.
Diffstat (limited to 'apps/factorial.mu')
-rw-r--r--apps/factorial.mu5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/factorial.mu b/apps/factorial.mu
index a94be482..7d9015e2 100644
--- a/apps/factorial.mu
+++ b/apps/factorial.mu
@@ -1,13 +1,14 @@
 fn main -> exit-status/ebx: int {
 #?   run-tests
 #?   result <- copy 0
+  test-factorial # abc
   var tmp/eax: int <- factorial 5
   exit-status <- copy tmp
 }
 
 fn factorial n: int -> result/eax: int {
   compare n 1
-  {
+  { # foo
     break-if->
     result <- copy 1
   }
@@ -15,7 +16,7 @@ fn factorial n: int -> result/eax: int {
     break-if-<=
     var tmp/ecx: int <- copy n
     tmp <- decrement
-    result <- factorial tmp
+    result <- factorial tmp  # test comment
     result <- multiply n
   }
 }