A bug in scan.l
A bug in scan.l
От:
Gokulakannan Somasundaram <gokul007@gmail.com>
Дата:
There is a rule like this in scan.l
uescapefail ("-"|[uU][eE][sS][cC][aA][pP][eE]{whitespace}*"-"|[uU][eE][sS][cC][aA][pP][eE]{whitespace}*{quote}[^']|[uU][eE][sS][cC][aA][pP][eE]{whitespace}*{quote}|[uU][eE][sS][cC][aA][pP][eE]{whitespace}*|[uU][eE][sS][cC][aA][pP]|[uU][eE][sS][cC][aA]|[uU][eE][sS][cC]|[uU][eE][sS]|[uU][eE]|[uU])
I think this should be corrected to
uescapefail ("-"|[uU][eE][sS][cC][aA][pP][eE]{space}*"-"|[uU][eE][sS][cC][aA][pP][eE]{space}*{quote}[^']|[uU][eE][sS][cC][aA][pP][eE]{space}*{quote}|[uU][eE][sS][cC][aA][pP][eE]{space}*|[uU][eE][sS][cC][aA][pP]|[uU][eE][sS][cC][aA]|[uU][eE][sS][cC]|[uU][eE][sS]|[uU][eE]|[uU])
I have replaced whitespace with space. This has to be done because whitespace allows comments. This would cause conflict between some of the alternatives. I found this, while trying to make this rule work with LL(1). Just thought, it might be useful.
Thanks,
Gokul.
Re: A bug in scan.l
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Gokulakannan Somasundaram writes: > I have replaced whitespace with space. This has to be done because > whitespace allows comments. This would cause conflict between some of the > alternatives. I found this, while trying to make this rule work with LL(1). Um, if it's ambiguous, why doesn't flex complain? regards, tom lane
Re: A bug in scan.l
От:
Gokulakannan Somasundaram <gokul007@gmail.com>
Дата:
Well, i am at a very beginner level with Flex. I could see how flex works with it even if it is a ambiguity. Since it matches the rule with the maximum text and we don't allow a new line character in the rule, it works fine. Even in LL(1), it works fine, but throws warnings. So i just thought of suggesting to remove the ambiguity.
But do we need to allow comments as part of unicode escapes?
Thanks,
Gokul.
But do we need to allow comments as part of unicode escapes?
Thanks,
Gokul.
On Wed, Sep 2, 2009 at 8:37 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Gokulakannan Somasundaram <gokul007@gmail.com> writes:Um, if it's ambiguous, why doesn't flex complain?
> I have replaced whitespace with space. This has to be done because
> whitespace allows comments. This would cause conflict between some of the
> alternatives. I found this, while trying to make this rule work with LL(1).
regards, tom lane
Re: A bug in scan.l
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Gokulakannan Somasundaram writes: > Well, i am at a very beginner level with Flex. I could see how flex works > with it even if it is a ambiguity. Since it matches the rule with the > maximum text and we don't allow a new line character in the rule, it works > fine. Even in LL(1), it works fine, but throws warnings. So i just thought > of suggesting to remove the ambiguity. Well, that whole rule is only there for implementation-specific reasons --- a flex scanner is faster if it doesn't need to back up. You might be best off to just remove the anti-backup rules in the LL translation. > But do we need to allow comments as part of unicode escapes? If they're like normal strings, yes. regression=# select 'this is' -- comment regression-# ' one string'; ?column? --------------------this is one string (1 row) Don't blame us, blame the SQL committee. This was not one of their better ideas IMO. regards, tom lane