[M3devel] Widechars

Rodney M. Bates rodney.bates at wichita.edu
Wed Jan 7 04:25:08 CET 2009


Literals of type WIDECHAR are written, e.g. W'\x304A', note the 'W'.
It makes them have type WIDECHAR and also enables the 16-bit escape
sequences you are using.  If it is a CHAR or plain TEXT literal
(no 'W' or 'w'), octal escapes must have exactly 3 octal digits and
hex escapes must have exactly 2 hex digits.  In WIDECHAR and wide
TEXT literals, octal escapes must have exactly 6 and hex escapes
exactly 4.

Note that character literals without/with the 'W' are of different
types, CHAR and WIDECHAR, respectively.  For Text literals, both
forms have the same type TEXT, but the lexical formation rules
are different without/with the 'W'.

I'm not sure where or even whether this is documented.

Rodney Bates


Martin Bishop wrote:
> I'm playing around with WIDECHARS, and having some trouble.
> 
> VAR wide := ARRAY OF WIDECHAR {'\x304A', '\x306F', '\x3088', '\x3046'};
>     s := Text.FromWideChars(wide);
> 
> I get these errors from the compiler:
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: syntax error: missing '}' (4)
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  "../Length.m3", line 5: missing closing quote on character literal
>  9 errors encountered
> 
> It seems like it's reading '\x304A' as '\x30' (which is why it says
> "syntax error: missing '}' (4)")
> 
> Do I need some special literal letter or something?
> 
> 




More information about the M3devel mailing list