digitalmars.D.learn - Named character entities
- H. S. Teoh (9/9) Feb 13 2012 What is the correct format for named character entities? According to
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (7/14) Feb 13 2012 The latter is right. The spec must be implying the \ character as all of...
- H. S. Teoh (20/36) Feb 14 2012 [...]
What is the correct format for named character entities? According to the online specs, I should be able to write: dchar ch = '&'; But gdc-4.6.2 refuses to compile this; apparently it wants: dchar ch = '\&'; Which is right?? T -- People say I'm indecisive, but I'm not sure about that. -- YHL, CONLANG
Feb 13 2012
On 02/13/2012 09:46 PM, H. S. Teoh wrote:What is the correct format for named character entities? According to the online specs, I should be able to write: dchar ch = '&'; But gdc-4.6.2 refuses to compile this; apparently it wants: dchar ch = '\&'; Which is right?? TThe latter is right. The spec must be implying the \ character as all of the other special character syntaxes use it. One of the reasons is that character are specified the same way in strings. So "&" is 5 characters as written. Again, a \ character is required to distinguish it as a single character literal. Ali
Feb 13 2012
On Mon, Feb 13, 2012 at 11:01:05PM -0800, Ali Çehreli wrote:On 02/13/2012 09:46 PM, H. S. Teoh wrote:[...]What is the correct format for named character entities? According to the online specs, I should be able to write: dchar ch = '&'; But gdc-4.6.2 refuses to compile this; apparently it wants: dchar ch = '\&'; Which is right??The latter is right. The spec must be implying the \ character as all of the other special character syntaxes use it. One of the reasons is that character are specified the same way in strings. So "&" is 5 characters as written. Again, a \ character is required to distinguish it as a single character literal.[...] Hmm, then the specs need to be fixed, since currently it says: EscapeSequence: \' \" \? \\ [...snip...] NamedCharacterEntity And: NamedCharacterEntity: & Identifier ; Somewhere in there a \ needs to be included. T -- The right half of the brain controls the left half of the body. This means that only left-handed people are in their right mind. -- Manoj Srivastava
Feb 14 2012