Pascal Literal String

12 views
Skip to first unread message

Gambit

unread,
Mar 28, 2008, 10:22:24 AM3/28/08
to GOLD Parsing System
Hello

I´m trying to use the Delphi grammar found in GOLD web site, with the
last release of GOLD Builder, but I always get a syntax error when the
parser finds a literal string. It is defined as follows:

{String Ch} = {Printable Extended} - {#39} + {HT}

StringLiteral = ( {#39} {String Ch}* {#39} | '#' {digit}+ | '#'
'$' {hex digit}+ | {#39} {#39} )+

Originally it was like this

{String Ch} = {Printable} - [''] + {HT}

StringLiteral = ( '' {String Ch}* '' | '#' {digit}+ | '#' '$' {hex
digit}+ | '''' )+

In both cases I have the same behavior, the parsers stops with an
error saying the token ' (apostrophe) is not expected.

Where I am mistaking?

Thanks in advance.

Gambit

Gambit

unread,
Mar 28, 2008, 12:55:30 PM3/28/08
to GOLD Parsing System
Hello

I found it! My mistake on understanding the meaning of {Printable
Extended}. I thought that that charset included {Printable} too. So,
the solution is just to define {String Ch} like this:

{String Ch} = {Printable} + {Printable Extended} - {#39} + {HT}

However, the original grammar available in GOLD Parser website still
doens´t work, unless I replace [''] by {#39}.

Gambit
Reply all
Reply to author
Forward
0 new messages