Re: non-standard json output

2013-06-05 Thread Alix Pexton

On 04/06/2013 9:59 PM, Anthony Goins wrote:

Is this a bug?

file : /home/anthony/projects/dcomposer/src/printui.d,

A line from DMD 2.063 json output.

file : \/usr\/include\/d\/gsv\/SourceBuffer.d,

A line from an older DMD version. Forward slashes escaped according to
json standard.

Hesitant to file a bug report because by the time I see something it's
probably already well known and fixed.





I looked into this out of curiosity.
The solidus _can be_ escaped to allow JSON strings to contain XML 
closing tags (like /b) while the JSON itself is wrapped by an XML element.


In contexts where the JSON is not going to be read by an XML parser, or 
will not make a potentially confusing closing tag (such as in part of a 
web address or file path) it becomes totally optional.


However, I also read that some buggy implementations of JSON parsers 
treat // as the beginning of a comment even when inside a string.


I hope that helps!

A...


Re: non-standard json output

2013-06-04 Thread Brian Schott

On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:

Is this a bug?

file : /home/anthony/projects/dcomposer/src/printui.d,

A line from DMD 2.063 json output.

file : \/usr\/include\/d\/gsv\/SourceBuffer.d,

A line from an older DMD version. Forward slashes escaped 
according to json standard.


Hesitant to file a bug report because by the time I see 
something it's probably already well known and fixed.


Where does the standard say that forward slashes have to be 
escaped? It shows in the syntax diagram that you CAN escape it, 
but there is no requirement to do so as it is a unicode character 
other than '' or '\'


Re: non-standard json output

2013-06-04 Thread Anthony Goins

On Tuesday, 4 June 2013 at 21:35:27 UTC, Brian Schott wrote:

On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:

Is this a bug?

file : /home/anthony/projects/dcomposer/src/printui.d,

A line from DMD 2.063 json output.

file : \/usr\/include\/d\/gsv\/SourceBuffer.d,

A line from an older DMD version. Forward slashes escaped 
according to json standard.


Hesitant to file a bug report because by the time I see 
something it's probably already well known and fixed.


Where does the standard say that forward slashes have to be 
escaped? It shows in the syntax diagram that you CAN escape it, 
but there is no requirement to do so as it is a unicode 
character other than '' or '\'


any-Unicode-character-
except--or-\-or-
control-character
\
\\
\/
\b
\f
\n
\r
\t
\u four-hex-digits

from http://www.json.org/;


Re: non-standard json output

2013-06-04 Thread Anthony Goins

On Tuesday, 4 June 2013 at 21:35:27 UTC, Brian Schott wrote:

On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:

Is this a bug?

file : /home/anthony/projects/dcomposer/src/printui.d,

A line from DMD 2.063 json output.

file : \/usr\/include\/d\/gsv\/SourceBuffer.d,

A line from an older DMD version. Forward slashes escaped 
according to json standard.


Hesitant to file a bug report because by the time I see 
something it's probably already well known and fixed.


Where does the standard say that forward slashes have to be 
escaped? It shows in the syntax diagram that you CAN escape it, 
but there is no requirement to do so as it is a unicode 
character other than '' or '\'


Thanks, I get it now.


Re: non-standard json output

2013-06-04 Thread Brian Schott
The char rule in the json standard can be matched by anything 
that isn't a control character, a double quote, or a backslash. 
I'm pretty sure you're not arguing that the forward slash is a 
double quote or that the forward slash is a backslash, so the 
only option left is that '/' is a control character, and thus 
needs escaping. I'm pretty sure that it's not, because 002f is 
not in the range defined as a control character[1]


[1] http://www.unicode.org/glossary/#control_codes


Re: non-standard json output

2013-06-04 Thread Anthony Goins

On Tuesday, 4 June 2013 at 21:55:38 UTC, Brian Schott wrote:
The char rule in the json standard can be matched by anything 
that isn't a control character, a double quote, or a backslash. 
I'm pretty sure you're not arguing that the forward slash is a 
double quote or that the forward slash is a backslash, so the 
only option left is that '/' is a control character, and thus 
needs escaping. I'm pretty sure that it's not, because 002f is 
not in the range defined as a control character[1]


[1] http://www.unicode.org/glossary/#control_codes


I appreciate your taking time to enlighten me.
I almost get it.
b is b
\b is backspace
f is f
\f is formfeed
/ is /
but what the heck is \/

This is a rhetorical post.
Go back to being productive ;)