| 42 days after http://www.arclanguage.org/item?id=12269 , I'm happy to report that rainbow's symbols are (almost) up to spec. rocketnia reported Both Jarc 17 and Rainbow think the name of '|.| is "|.|" rather than "."
It was much worse: rainbow didn't handle symbols enclosed in pipe characters at all, except for the special case of '|| (which was necessary for news.arc).It seems that the rule is that anything that could be interpreted as a number, or containing improper characters ["'#; \n\t], needs to be enclosed in pipes. Rainbow expects the pipe characters at the beginning and end of the symbol. Scheme is a bit wilder: it accepts them anywhere, as often as you want; they are only required to enclose the offending bit of the symbol. In other words, foo|#|bar
is the same as |foo#bar|
and |"|foo||bar|"|
is dbl-quote, followed by 'foo, followed by emptiness, followed by 'bar, followed by dbl-quote again, and is thus the same as |"foobar"|
So rainbow only understands |"foobar"|, where pipes delimit the entire symbol, and doesn't read the scheme symbol syntax in all its hairiness. Another missing piece was that rainbow produced the same output for (write sym) and (disp sym); fixed.Many thanks, rocketnia, and I'm working on your other bug reports too, keep 'em coming :) Here are the new test cases for this issue: (tostring:write (coerce "foo\nbar" 'sym))
"|foo
bar|"
(tostring:disp (coerce "foo\nbar" 'sym))
"foo
bar"
(tostring:write '|foo;bar|)
"|foo;bar|"
(tostring:disp '|foo;bar|)
"foo;bar"
(tostring:write '||)
"||"
(tostring:disp '||)
""
(tostring:write '|.|)
"|.|"
(tostring:disp '|.|)
"."
(coerce "21" 'sym)
|21|
(coerce "1.23E10" 'sym)
|1.23E10|
(coerce ";" 'sym)
|;|
(coerce "+nan.0" 'sym)
|+nan.0|
(coerce "|foo|" 'sym)
\|foo\|
(coerce "(foo)" 'sym)
|(foo)|
(tostring:write (coerce "|foo|" 'sym))
"\\|foo\\|"
(tostring:disp (coerce "|foo|" 'sym))
"|foo|"
(coerce "\"foo\"" 'sym)
|"foo"|
(coerce "'" 'sym)
|'|
(coerce "||||||||||||||" 'sym)
\|\|\|\|\|\|\|\|\|\|\|\|\|\|
(coerce (coerce "" 'sym) 'string)
""
The above available as usual at http://github.com/conanite/rainbow |