Mercurial > projects > dil
changeset 44:5055947e0f98
- Specific operators and comments can be formatted with CSS now.
author | aziz |
---|---|
date | Tue, 26 Jun 2007 14:00:01 +0000 |
parents | 1845c23dd056 |
children | cc84b9ca9d0a |
files | trunk/src/Lexer.d trunk/src/format.css trunk/src/main.d |
diffstat | 3 files changed, 30 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Lexer.d Tue Jun 26 13:15:00 2007 +0000 +++ b/trunk/src/Lexer.d Tue Jun 26 14:00:01 2007 +0000 @@ -68,7 +68,7 @@ ptable[i] |= CP.Alpha; if (i == '_') ptable[i] |= CP.Underscore; - if (i == ' ' || i == '\t' || i == '\v'|| i == '\f') + if (i == ' ' || i == '\t' || i == '\v' || i == '\f') ptable[i] |= CP.Whitespace; } // Print a formatted array literal.
--- a/trunk/src/format.css Tue Jun 26 13:15:00 2007 +0000 +++ b/trunk/src/format.css Tue Jun 26 14:00:01 2007 +0000 @@ -1,3 +1,4 @@ +@charset "utf-8"; sourcetext { display: block; white-space: pre; @@ -5,9 +6,17 @@ font-size: 0.8em; } k { color: darkblue; font-weight: bold; } -c { color: green; } -i { color: darkblue; } +c[c=lc], c[c=bc] { color: green; } +c[c=nc] { color: darkgreen; } +i { color: black; } sl { color: red; } cl { color: purple; } op { color: royalblue; } br { color: orange; } +op[c=aa] { content: "and"; } /*&& ∧*/ +op[c=oo] { content: "or"; } /*|| ∨*/ +op[c=n] { content: "¬"; } /*!*/ +op[c=ne] { content: "≠"; } /*!=*/ +op[c=le] { content: "≤"; } /*<=*/ +op[c=ge] { content: "≥"; } /*>=*/ +op[c=lg] { content: "≶"; } /*<>*/
--- a/trunk/src/main.d Tue Jun 26 13:15:00 2007 +0000 +++ b/trunk/src/main.d Tue Jun 26 14:00:01 2007 +0000 @@ -44,7 +44,14 @@ writef("<i>%s</i>", span); break; case TOK.Comment: - writef("<c>%s</c>", span); + string c; + switch (token.start[1]) + { + case '/': c = "lc"; break; + case '*': c = "bc"; break; + case '+': c = "nc"; break; + } + writef(`<c c="%s">%s</c>`, c, span); break; case TOK.String: writef("<sl>%s</sl>", span); @@ -52,7 +59,7 @@ case TOK.Character: writef("<cl>%s</cl>", span); break; - case TOK.Assign, TOK.Equal, TOK.Not, + case TOK.Assign, TOK.Equal, TOK.Less, TOK.Greater, TOK.LShiftAssign, TOK.LShift, TOK.RShiftAssign, TOK.RShift, @@ -77,22 +84,25 @@ writef("<op>%s</op>", span); break; case TOK.LorG: - writef("<op>≶</op>"); + writef(`<op c="lg"><></op>`); break; case TOK.LessEqual: - writef("<op>≤</op>"); + writef(`<op c="le"><=</op>`); break; case TOK.GreaterEqual: - writef("<op>≥</op>"); + writef(`<op c="ge">>=</op>`); break; case TOK.AndLogical: - writef("<op>∧</op>"); + writef(`<op c="aa">&&</op>`); break; case TOK.OrLogical: - writef("<op>∨</op>"); + writef(`<op c="oo">||</op>`); break; case TOK.NotEqual: - writef("<op>≠</op>"); + writef(`<op c="ne">!=</op>`); + break; + case TOK.Not: + writef(`<op c="n">!</op>`); break; case TOK.Number: writef("<n>%s</n>", span);