On Sun, 20 Jan 2008 09:12:37 -0800, h03Ein wrote:
Hi!
during my search on tokens in ANSI C I have found following
specification for string literals based on regular expression in site
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html :
L?\"(\\.|[^\\"])*\" which L stands for [a-zA-Z_] .
No, that's not what L stands for. I'm not sure why you thought that, but
L just stands for the letter L.
can anyone explain
what does it mean ? I know regex but I can't understand this
specification. why L? . does it mean following input is correct: s"\a"
Since s is not L, no, it does not mean that is correct.
for string literals. or what's exactly (\\.|[^\\"]) means. and so on...
Thanks!
Try describing the syntax of string literals in words. For example, for
an integer literal, I might write "a zero optionally followed by other
octal digits, or a decimal non-zero digit optionally followed by other
decimal digits, or 0x followed by hexadecimal digits, in any case
optionally followed by a suffix which can be U, UL, ULL, L, or LL". (This
is incomplete and so does not match the actual definition.) When you have
done that, what do you get? Does it look a bit similar to the regex, or
do you get something completely different?