From: Arthur N. <ac...@ca...> - 2014-03-16 22:53:46
|
I have just checked in a bunch of updates that alter the exact treatment of "#". Firstly the preprocessor-like directives #if, #else, #elif, #endif, #eval and #define may now be written without a preceeding exclamation mark... but note that they are NOT recognised within quoted items (even if those items spread across several lines), so '!#if still needs the "!" and does not try to trigger conditional inclusion, and a := '( one #if nil two #endif three); does not have the #if and #endif processed (because the quote mark protects them). Secondly # can be used to notate characters that might otherwise be hard to express. So far the follow-through that uses these is not in place, but I hope to address that sometime! #name; where name is one of the entity names from HTML5 will stand for one of teh about 2000 symbols available there. RIGHT NOW you might only use things that stand for characters with codes up to 255, and if you try larger values they can crask the Lisp system maybe. So eg "#amp;" for "&" is OK. Sometime later I hope that this will extend to #alpha; etc. #hhh; or #xhhh; where hhh are hex digits (and the x can be in upper or lower case) will be for a Unicode code-point specified in hexadecimal. #uddd; or #Uddd; will be a Unicode code point specified is decimal. There are a few HTML5 names made up just of letters a-f which could look like hex specifications. The name takes precedence and you can use X or a leading 0 to forcibly indicate numeric input. If the number you specify is over 0x0010ffff then what you gave could not be valud Unicode and it will be rejected. Unrecognised names, overlarge numbers, missing semicolons and the like should just cause the characters to go through to Reduce unaltered. A way you can try this today (and this WILL CHANGE soon I hope) is to just go lisp "#xc2;#xa3;"; which gives the two byte utf-8 sequence for a a pounds-sterling sign, and if you have a utf-8 enabled terminal you should see that. There are a few places where this change is not 100% upwards compatible (and I needed to alter a few source files scattered through Reduce to survive). Mainly a sequence of characters "#d;" where d is any string of hex digits suddently means something special. I found two places where this arise naturally. In susy2 there was a line operator !#a,!#b,!#c; where the final #c; hurt. I could fix that by just putting an apparently frivolous blank before the semicolon. In the factoriser some names like !#a were used with the intent that they would never clash with normal sensible names. By altering them to use !#z I could remove the clash with hex-specfied characters. Any code that uses "#" as an infix operator could find itself writing a#b; but if instead it speced things out as a # b; it will be safe. Arthur |