[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comment in last line
From: |
David Kastrup |
Subject: |
Re: Comment in last line |
Date: |
Sat, 12 Jan 2013 08:54:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Urs Liska <address@hidden> writes:
> Am 11.01.2013 23:25, schrieb David Kastrup:
>> David Kastrup <address@hidden> writes:
>>
>>> Noeck <address@hidden> writes:
>>>
>>>> Hi,
>>>>
>>>> why does compiling this code fail to compile with lilypond?
>>>>
>>>> \version "2.16.0"
>>>> { a }
>>>> %
>>>>
>>> No, the problem is that there _is_ no last line. You have an EOF in
>>> the middle of the line (not every editor will even allow producing
>>> that).
>>>
>>> One would need to non-trivially rewrite comment matching in the
>>> lexer to get either a nicer error message or just silently a line
>>> comment even though the line does not end.
>> Ok, apparently I lied.
>>
>> <URL:http://code.google.com/p/lilypond/issues/detail?id=3102>
>>
> Hm. I never managed to understand these expression matching hieroglyphs.
> But is it right that the 'new' side of the diff does look much simpler
> than the old one?
I said I lied. The old patterns were seemingly not all written while
trusting Flex to pick the longest matching pattern. And writing a
pattern that will only match when there is an EOF at a certain place is
not really feasible in Flex (you can explicitly match EOF only when
<<EOF>> is the whole pattern, so you'd need to juggle with semantic
states). But if Flex would not use the pattern under any other
circumstance (because in all other circumstances a longer pattern would
match), that's just as good.
--
David Kastrup