From 901efe360c151e128098154399960cbceb5174e1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 30 Jan 2015 13:19:58 -0800 Subject: 683 --- color-repl.mu | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'color-repl.mu') diff --git a/color-repl.mu b/color-repl.mu index c5686484..a9770073 100644 --- a/color-repl.mu +++ b/color-repl.mu @@ -87,8 +87,22 @@ } (continue-from next-key:continuation) } + ; if it's a newline, decide whether to return + ; test: 34 + { begin + (newline?:boolean <- equal c:character ((#\newline literal))) + (break-unless newline?:boolean) + ($print-key-to-host c:character) + (at-top-level?:boolean <- lesser-or-equal open-parens:integer 0:literal) + (end-expression?:boolean <- and at-top-level?:boolean not-empty?:boolean) + { begin + (break-if end-expression?:boolean) + (continue-from next-key:continuation) + } + (reply nil:literal) ; wait for more keys + } ;? (print-primitive-to-host 4:literal) ;? 2 - ; not a backspace; save character + ; printable character; save ;? (print-primitive-to-host (("append\n" literal))) ;? 2 (result:buffer-address <- append result:buffer-address c:character) ;? (print-primitive-to-host (("done\n" literal))) ;? 2 @@ -175,21 +189,6 @@ (continue-from next-key:continuation) } ;? (print-primitive-to-host 11:literal) ;? 2 - ; if it's a newline, decide whether to return - ; test: 34 - { begin - (newline?:boolean <- equal c:character ((#\newline literal))) - (break-unless newline?:boolean) - ($print-key-to-host c:character) - (at-top-level?:boolean <- lesser-or-equal open-parens:integer 0:literal) - (end-expression?:boolean <- and at-top-level?:boolean not-empty?:boolean) - { begin - (break-if end-expression?:boolean) - (continue-from next-key:continuation) - } - (reply nil:literal) ; wait for more keys - } -;? (print-primitive-to-host 12:literal) ;? 2 ; if all else fails, print the character without color ($print-key-to-host c:character) ; todo: error on space outside parens, like python -- cgit 1.4.1-2-gfad0 option>
blob: f96fd0993e1c85bfff1c6f18f49e9ece526dcc2c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'n15' href='#n15'>15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120