Commit 9154fe59f6b7d754245594725ac203778b4f17ff

Authored by Alain Prouté
1 parent 005c043f

Fixed some tricky problem about 'dollar clash' between MAML and Anubis.

New MAML mark $$ means $ but doesn't need a white after it.
anubis_dev/library/anubis_doc.maml
... ... @@ -10,6 +10,7 @@
10 10 $colorrule(anubis)(public[ ]+((type)|(define)))(0,80,0)
11 11 $colorrule(anubis)([a-z_][A-Za-z0-9_]*)(150,0,0)
12 12 $colorrule(anubis)([A-Z][A-Za-z0-9_]*)(0,70,150)
  13 + $colorrule(anubis)($[A-Z][A-Za-z0-9_]*)(70,70,0)
13 14 $colorrule(anubis)(//.*)(20,100,20)
14 15  
15 16 $comment(Making the colorizer)
... ... @@ -30,7 +31,7 @@
30 31 $comment(acode = Anubis code; used for presenting within a display
31 32 with background color the Anubis code which is also read
32 33 by the Anubis compiler)
33   - $define(acode)(1)($code(220,220,180)($colorize(anubis)($1)))
  34 + $define(acode)(1)($code(240,240,220)(~$colorize(anubis)($1)))
34 35  
35 36 $comment(The same one, but for inline short pieces of code)
36 37 $define(att)(1)($textred($tt($1)))
... ...
anubis_dev/library/doc_tools/maml3.anubis
... ... @@ -524,7 +524,7 @@ define String
524 524 end then "",
525 525 var(v) then "$"+abs_to_decimal(v),
526 526 text(txt) then to_string(txt),
527   - mark(name,args) then if args is [] then "$"+name+" " else
  527 + mark(name,args) then if args is [] then "$"+name+(if name = "" then "" else "") else
528 528 "$" + name + concat(map((MAML a) |-> "("+to_string(a)+")" ,args)),
529 529 a+b then to_string(a) + to_string(b)
530 530 }.
... ... @@ -1070,9 +1070,9 @@ define String
1070 1070 success(c) then
1071 1071 if is_name_char(c)
1072 1072 then read_mark_name_aux(s,[c . so_far]) // continue reading the name
1073   - else if is_blank_char(c)
  1073 + else /*if is_blank_char(c)
1074 1074 then implode(reverse(so_far)) // eat the first blank character
1075   - else unput_byte(c,s); implode(reverse(so_far)) // don't eat if not blank
  1075 + else*/ unput_byte(c,s); implode(reverse(so_far)) // don't eat if not blank
1076 1076 }.
1077 1077  
1078 1078 type ReadMarkNameResult:
... ... @@ -1085,14 +1085,24 @@ define ReadMarkNameResult
1085 1085 (
1086 1086 Stream s
1087 1087 ) =
1088   - with name = read_mark_name_aux(s,[]),
1089   - //iprint(line(get_pos(s))+" Mark name: "+name+"\n");
1090   - if name = "" then mark("") else
1091   - if decimal_scan(name) is
  1088 + if read_byte(s) is
1092 1089 {
1093   - failure then mark(name),
1094   - success(n) then var(n)
  1090 + failure then mark(""),
  1091 + success(c) then
  1092 + if c = '$'
  1093 + then mark("")
  1094 + else if is_name_char(c)
  1095 + then (with name = read_mark_name_aux(s,[c]),
  1096 + //iprint(line(get_pos(s))+" Mark name: "+name+"\n");
  1097 + if name = "" then mark("") else
  1098 + if decimal_scan(name) is
  1099 + {
  1100 + failure then mark(name),
  1101 + success(n) then var(n)
  1102 + })
  1103 + else unput_byte(c,s); mark("")
1095 1104 }.
  1105 +
1096 1106  
1097 1107  
1098 1108  
... ...
anubis_dev/library/documentation.maml
... ... @@ -6,8 +6,8 @@
6 6  
7 7 $input(anubis_doc.maml)
8 8  
9   - $define(E)(0)($ E)
10   - $define(T)(0)($ T)
  9 + $define(E)(0)($$E)
  10 + $define(T)(0)($$T)
11 11  
12 12  
13 13 $center($big($big($big($bold(The Anubis Standard Library Documentation)))))$p
... ...
anubis_dev/library/predefined.anubis
... ... @@ -228,7 +228,7 @@ public type Compare:
228 228 )
229 229  
230 230 $acode(
231   -public define macro Bool $T x /= $T y = if x = y then false else true.
  231 +public define macro Bool $T x /= $T y = if x = y then false else true.
232 232 )
233 233  
234 234  
... ... @@ -292,7 +292,7 @@ public type Result($E,$T):
292 292 $acode(
293 293 public type List($T):
294 294 [ ], // the empty list (for type $T)
295   - [$T . List($T)]. // non empty lists
  295 + [$T . List($T)]. // non empty lists
296 296 )
297 297 Recall that the Anubis compiler reads (say) $att([a,b,c]) as $att([a . [b . [c . []]]]), so that
298 298 you may write lists without too many characters.$p
... ...