Commit 8446c65f64c39090c278b3a9204eb2fbc5f62bcf

Authored by totoro
1 parent 8b2fc1b7

Revert "Enhanced the $colorrule mark (3rd argument accepts MAML text)."

This reverts commit 9056d99f605a5264959f81f2fcfb4348eed42317.
anubis_dev/library/anubis_doc.maml
... ... @@ -5,25 +5,27 @@
5 5  
6 6 $begin
7 7  
8   - $comment(Putting some emphasis on the text)
9   - $define(em)(1)($italic($1))
10   -
11   - $comment(Defining a colorizer for Anubis code)
12   - $colorrule(anubis)(public[ ]+((type)|(define))[ ]+(alias)?)($rgb(0,80,0)($1))
13   - $colorrule(anubis)((then)|(else)|(if)|(is)|(with))($em($rgb(0,150,150)($1)))
14   - $colorrule(anubis)([a-z_][A-Za-z0-9_]*)($rgb(150,0,0)($1))
15   - $colorrule(anubis)([A-Z][A-Za-z0-9_]*)($bold($rgb(0,70,150)($1)))
16   - $colorrule(anubis)(($)[A-Z][A-Za-z0-9_]*)($bold($rgb(70,100,60)($1)))
17   - $colorrule(anubis)([0-9]+)($rgb(0,170,0)($1))
18   - $colorrule(anubis)(0x[0-9a-fA-F]+)($rgb(0,170,0)($1))
19   - $colorrule(anubis)("[^"]*")($rgb(100,100,0)($1))
20   - $colorrule(anubis)(<[a-z ]+>)($rgb(0,80,0)($1))
21   - $colorrule(anubis)(//.*)($rgb(20,100,20)($1))
  8 + $comment(Defining rules for a colorizer for Anubis code)
  9 + $colorrule(anubis)((if)|(then)|(is))(0,150,150)
  10 + $colorrule(anubis)(public[ ]+((type)|(define)))(0,80,0)
  11 + $colorrule(anubis)([a-z_][A-Za-z0-9_]*)(150,0,0)
  12 + $colorrule(anubis)([A-Z][A-Za-z0-9_]*)(0,70,150)
  13 + $colorrule(anubis)(($)[A-Z][A-Za-z0-9_]*)(70,100,60)
  14 + $colorrule(anubis)([0-9]+)(0,170,0)
  15 + $colorrule(anubis)(0x[0-9a-fA-F]+)(0,170,0)
  16 + $colorrule(anubis)("[^"]*")(100,100,0)
  17 + $colorrule(anubis)(<[a-z ]+>)(0,80,0)
  18 + $colorrule(anubis)(//.*)(20,100,20)
  19 +
  20 + $comment(Making the colorizer)
22 21 $colorizer(anubis)
23 22  
24 23 $comment(Printing the text in red)
25 24 $define(textred)(1)($rgb(120,0,0)($1))
26 25  
  26 + $comment(Putting some emphasis on the text)
  27 + $define(em)(1)($italic($1))
  28 +
27 29 $comment(Used for all file names)
28 30 $define(fname)(1)($rgb(0,70,0)($bold($tt($1))))
29 31  
... ... @@ -33,7 +35,7 @@
33 35 $comment(acode = Anubis code; used for presenting within a display
34 36 with background color the Anubis code which is also read
35 37 by the Anubis compiler)
36   - $define(acode)(1)($code(240,240,230)(~$colorize(anubis)($1)))
  38 + $define(acode)(1)($code(240,240,220)(~$colorize(anubis)($1)))
37 39  
38 40 $comment(The same one, but for inline short pieces of code)
39 41 $define(att)(1)($tt($rgb(120,0,0)($colorize(anubis)($1))))
... ...
anubis_dev/library/doc_tools/maml3.anubis
... ... @@ -18,7 +18,7 @@
18 18  
19 19  
20 20 $begin
21   - $define(mark)(1)($rgb(100,0,0)($$$1))
  21 + $define(mark)(1)($rgb(100,0,0)($ $1))
22 22  
23 23 $section(MAML (The Minimalist Anubis Markup Language))
24 24 $toberead(doc_tools/maml3.anubis)
... ... @@ -398,7 +398,7 @@ public type MAMLMark:
398 398 type ColorRule:
399 399 rule (String colorizer_name,
400 400 String regular_expression,
401   - MAML color). // an expression containing a $1 to be replaced by the token read
  401 + String color). color has the form r,g,b without parentheses
402 402  
403 403 type Colorizer:
404 404 clrzr(String name,
... ... @@ -407,7 +407,7 @@ type Colorizer:
407 407  
408 408 type ColorToken:
409 409 end_of_input,
410   - color(MAML color, String text), // same format for color
  410 + color(String color, String text), // same format for color
411 411 text (String text).
412 412  
413 413 type MAML_Macro:
... ... @@ -757,13 +757,6 @@ define Result(MAML_Error,String)
757 757  
758 758 *** Handle color rule declaration.
759 759  
760   -define MAML
761   - replace_args
762   - (
763   - MAML body,
764   - List(MAML) values
765   - ).
766   -
767 760 Creating a colorizer:
768 761  
769 762 define MAML
... ... @@ -778,7 +771,7 @@ define MAML
778 771 {
779 772 end_of_input then text(t),
780 773 color(c,tx) then //iprint("color_parser: inserting color on '"+tx+"'\n");
781   - replace_args(c,[text(t-tx)]) + color_parser(lex),
  774 + mark("rgb",[text(t-c),text(t-tx)]) + color_parser(lex),
782 775 text(tx) then text(t-tx) + color_parser(lex)
783 776 }
784 777 }.
... ... @@ -883,9 +876,9 @@ define Result(RegExprError,String -&gt; MAML) // the colorizing function
883 876 then success(r)
884 877 else failure,
885 878 rules),
886   - ldesc = reverse(map((ColorRule r) |-> if r is rule(_,re,c) then
  879 + ldesc = map((ColorRule r) |-> if r is rule(_,re,c) then
887 880 lexer_item(re,
888   - return((ByteArray b, LexingTools t, One u) |-> ok(color(c,to_string(b))))),myrules))
  881 + return((ByteArray b, LexingTools t, One u) |-> ok(color(c,to_string(b))))),myrules)
889 882 + [lexer_item("[# #n#r#t]+", return((ByteArray b, LexingTools t, One u) |-> ok(text(to_string(b))))),
890 883 lexer_item(".", return((ByteArray b, LexingTools t, One u) |-> ok(text(to_string(b)))))],
891 884 if make_lexer(ldesc,end_of_input,'#') is
... ... @@ -1219,68 +1212,6 @@ define Result(MAML_Error,(List(MAML),MAML_Toolbox))
1219 1212 }
1220 1213 }.
1221 1214  
1222   -
1223   -define Result(MAML_Error,(MAML,MAML_Toolbox))
1224   - read_1_argument
1225   - (
1226   - MAML_Toolbox tbox,
1227   - String mark_name,
1228   - ) =
1229   - read_argument(tbox,mark_name,0,1).
1230   -
1231   -define Result(MAML_Error,(MAML,MAML,MAML_Toolbox))
1232   - read_2_arguments
1233   - (
1234   - MAML_Toolbox tbox,
1235   - String mark_name,
1236   - ) =
1237   - if read_1_argument(tbox,mark_name) is
1238   - {
1239   - error(e) then error(e),
1240   - ok(p1) then since p1 is (arg1,tbox1),
1241   - if read_1_argument(tbox1,mark_name) is
1242   - {
1243   - error(e) then error(e),
1244   - ok(p2) then since p2 is (arg2,tbox2),
1245   - ok((arg1,arg2,tbox2))
1246   - }
1247   - }.
1248   -
1249   -define Result(MAML_Error,(MAML,MAML,MAML,MAML_Toolbox))
1250   - read_3_arguments
1251   - (
1252   - MAML_Toolbox tbox,
1253   - String mark_name,
1254   - ) =
1255   - if read_2_arguments(tbox,mark_name) is
1256   - {
1257   - error(e) then error(e),
1258   - ok(p1) then since p1 is (arg1,arg2,tbox1),
1259   - if read_1_argument(tbox1,mark_name) is
1260   - {
1261   - error(e) then error(e),
1262   - ok(p2) then since p2 is (arg3,tbox2),
1263   - ok((arg1,arg2,arg3,tbox2))
1264   - }
1265   - }.
1266   -
1267   -define Result(MAML_Error,(MAML,MAML,MAML,MAML,MAML_Toolbox))
1268   - read_4_arguments
1269   - (
1270   - MAML_Toolbox tbox,
1271   - String mark_name,
1272   - ) =
1273   - if read_3_arguments(tbox,mark_name) is
1274   - {
1275   - error(e) then error(e),
1276   - ok(p1) then since p1 is (arg1,arg2,arg3,tbox1),
1277   - if read_1_argument(tbox1,mark_name) is
1278   - {
1279   - error(e) then error(e),
1280   - ok(p2) then since p2 is (arg4,tbox2),
1281   - ok((arg1,arg2,arg3,arg4,tbox2))
1282   - }
1283   - }.
1284 1215  
1285 1216  
1286 1217 *** [3.1] 'must_be_text'.
... ... @@ -1388,29 +1319,49 @@ define Result(MAML_Error,(MAML,MAML_Toolbox))
1388 1319 error(msg) then error(msg),
1389 1320 ok(verbatim_body) then ok((mark(name,[text(t-verbatim_body)]),tbox))
1390 1321 } else
1391   - if name = "define" then if read_3_arguments(tbox,name) is
  1322 + if name = "define" then if read_argument(tbox,name,0,1) is
1392 1323 {
1393 1324 error(msg) then error(msg),
1394   - ok(p1) then since p1 is (arg1,arg2,arg3,tbox1),
1395   - if decimal_scan(arg2) is
  1325 + ok(p1) then since p1 is (arg1,tbox1),
  1326 + if read_argument(tbox1,name,0,1) is
1396 1327 {
1397   - failure then error(number_expected_in_define(get_pos(s))),
1398   - success(numargs) then
1399   - ok((text(t),
1400   - with mac_name = must_be_text(arg1),
1401   - new_mark = mark(mac_name,numargs),
1402   - new_mac = macro(mac_name,numargs,arg3),
1403   - since tbox1 is toolbox(path1,fname1,opts1,s1,mrks1,macs1,crules1,clrzrs1),
1404   - toolbox(path1,fname1,opts1,s1,[new_mark . mrks1],[new_mac . macs1],crules1,clrzrs1)))
  1328 + error(msg) then error(msg),
  1329 + ok(p2) then since p2 is (arg2,tbox2),
  1330 + if read_argument(tbox2,name,0,1) is
  1331 + {
  1332 + error(msg) then error(msg),
  1333 + ok(p3) then since p3 is (arg3,tbox3),
  1334 + if decimal_scan(arg2) is
  1335 + {
  1336 + failure then error(number_expected_in_define(get_pos(s))),
  1337 + success(numargs) then
  1338 + ok((text(t),
  1339 + with mac_name = must_be_text(arg1),
  1340 + new_mark = mark(mac_name,numargs),
  1341 + new_mac = macro(mac_name,numargs,arg3),
  1342 + since tbox3 is toolbox(path3,fname3,opts3,s3,mrks3,macs3,crules3,clrzrs3),
  1343 + toolbox(path3,fname3,opts3,s3,[new_mark . mrks3],[new_mac . macs3],crules3,clrzrs3)))
  1344 + }
  1345 + }
1405 1346 }
1406 1347 } else
1407   - if name = "colorrule" then if read_3_arguments(tbox,name) is
  1348 + if name = "colorrule" then if read_argument(tbox,name,0,1) is
1408 1349 {
1409 1350 error(msg) then error(msg),
1410   - ok(p1) then since p1 is (arg1,arg2,arg3,tbox1),
1411   - ok((text(t),toolbox(path,fname,opts,s,mrks,macs,
1412   - [rule(must_be_text(arg1),must_be_text(arg2),arg3) . crules],
  1351 + ok(p1) then since p1 is (arg1,tbox1),
  1352 + if read_argument(tbox1,name,0,1) is
  1353 + {
  1354 + error(msg) then error(msg),
  1355 + ok(p2) then since p2 is (arg2,tbox2),
  1356 + if read_argument(tbox2,name,0,1) is
  1357 + {
  1358 + error(msg) then error(msg),
  1359 + ok(p3) then since p3 is (arg3,tbox3),
  1360 + ok((text(t),toolbox(path,fname,opts,s,mrks,macs,
  1361 + [rule(must_be_text(arg1),must_be_text(arg2),must_be_text(arg3)) . crules],
1413 1362 clrzrs)))
  1363 + }
  1364 + }
1414 1365 } else
1415 1366 if name = "colorizer" then if read_argument(tbox,name,0,1) is
1416 1367 {
... ...
anubis_dev/library/doc_tools/maml3_tutorial.maml
... ... @@ -136,7 +136,7 @@ $center($tt($$colorizer(&lt;colorizer name&gt;)))
136 136 Then you can colorize a text as follows:$par
137 137 $center($tt($$colorize(<colorizer name>)(<text>)))
138 138  
139   -As an example, consider the following definition of a colorizer:
  139 +As an exemple, consider the following definition of a colorizer:
140 140 $code(255,255,255)(
141 141 $$colorrule(mycolorizer)([0-9]+)(120,0,0)
142 142 $$colorrule(mycolorizer)([a-z]+)(0,120,0)
... ...
anubis_dev/library/doc_tools/maml3_tutorial.maml.html
... ... @@ -200,7 +200,7 @@ Once the color rules are setup, you can ceate the colorizer as follows:&lt;br&gt;
200 200 Then you can colorize a text as follows:<br>
201 201 <br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$colorize(&lt;colorizer name&gt;)(&lt;text&gt;)</span></td></tr></table></center><br>
202 202  
203   -As an example, consider the following definition of a colorizer:
  203 +As an exemple, consider the following definition of a colorizer:
204 204 <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">
205 205 $colorrule(mycolorizer)([0-9]+)(120,0,0)
206 206 $colorrule(mycolorizer)([a-z]+)(0,120,0)
... ...
anubis_dev/library/lexical_analysis/fast_lexer_5.anubis
... ... @@ -13,8 +13,8 @@
13 13  
14 14 $begin
15 15  
16   - $define(Token)(0)($$Token) $comment(Otherwise, MAML will not like $Token)
17   - $define(Aux)(0)($$Aux)
  16 + $define(Token)(0)($ Token) $comment(Otherwise, MAML will not like $Token)
  17 + $define(Aux)(0)($ Aux)
18 18  
19 19 $section(Constructing a fast lexer)
20 20 $toberead(lexical_analysis/fast_lexer_5.anubis)
... ... @@ -696,7 +696,7 @@ public type SubLexer($Token,$Aux):
696 696 where $att(sublexer_name) is the name you want to give to the corresponding sublexer. This name must be valid as an
697 697 Anubis symbol, because it is used as such in the generated file in case you want to precompile your lexer.$p
698 698  
699   - $define(LexerState)(0)($$LexerState)
  699 + $define(LexerState)(0)($ LexerState)
700 700  
701 701 A multistate lexer description (of type $att(MLexDesc($Token,$Aux))) is described by a list of sublexers:
702 702 $acode(
... ...