[racket] x-expressions

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Feb 28 15:45:23 EST 2012

Actually numbers are allowed, but not all numbers. If you look at

http://docs.racket-lang.org/xml/index.html?q=xexpression#(def._((lib._xml/main..rkt)._valid-char~3f))

It tells you which numbers are allowed, and 2 is not.

I'll change the error message to say "valid numeric entity" rather than
"number".

Jay

On Tue, Feb 28, 2012 at 2:13 AM, Jens Axel Søgaard <jensaxel at soegaard.net>wrote:

> 2012/2/28 Johannes Brauer <brauer at nordakademie.de>
>
>> Hi!
>>
>> In DrRacket version 5.02 this x-expression
>>
>> (validate-xexpr '(add x 2))
>>
>> is legal. In version 5.2 I get the error message
>>
>> Expected a string, symbol, number, comment, processing instruction, or
>> list, given 2
>>
>> Can anyone explain this to me?
>>
>
> According to the grammar in the documentation a lone number is not an
> x-expression. Use '(add x "2") instead.
>
>  xexpr  =  string    |  (list<http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29>
>  symbol (list<http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29>
>  (list<http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29>
>  symbol string) ...) xexpr ...)    |  (cons<http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._cons%29%29>
>  symbol (list<http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29>
>  xexpr ...))    |  symbol    |  valid-char?<http://docs.racket-lang.org/xml/index.html?q=xexpression#%28def._%28%28lib._xml/main..rkt%29._valid-char%7E3f%29%29>
>    |  cdata    |  misc
>
> --
> Jens Axel Søgaard
>
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>
>


-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120228/27e2d4bc/attachment.html>

Posted on the users mailing list.