[syslinux] comment syntax

Ferenc Wagner wferi at niif.hu
Tue Aug 31 09:03:53 PDT 2010


Steve Brown <sbrown7 at umbc.edu> writes:

> On Tue, 31 Aug 2010, Ferenc Wagner wrote:
>
>> Steve Brown <sbrown7 at umbc.edu> writes:
>>
>>> On Tue, 31 Aug 2010, Ferenc Wagner wrote:
>>>
>>>> Gene Cumm <gene.cumm at gmail.com> writes:
>>>>
>>>>> On Mon, Aug 30, 2010 at 00:33, Prof S W Damle <swdamle at bsnl.in> wrote:
>>>>>
>>>>>>  ##  menu label ^0. xxxx  -->This IS displayed
>>>>>
>>>>> Of course.  Bad syntax.  You _must_ use "# " to make a comment and may
>>>>> not use "## " as is stated in doc/syslinux.txt
>>>>
>>>> Why is this, btw?  It's rather counterintuitive.  Is there a reason
>>>> against letting a single # turn the rest of the line into a comment,
>>>> as usual in some other scripting languages?
>>>
>>> Well, without the trailing space requirement, then the diglyph "#!"
>>> wouldn't be picked up as special, either.
>>
>> #! isn't treated special now, as far as I know.  Or is it?
>>
>>> I also have a vague feeling that the "##" diglyph is special in some
>>> language I've seen.
>>
>> Yes, at least in the C preprocessor.  But why is this relevant?
>
> I haven't looked at the code at all.... but my _guess_ is that in
> moving to C from asm, a stock parser was used?  C pre-processor for C
> code? Just pointing out that diglyphs are sometimes interpreted, and
> it would be _a_ (not necessarily _the_) reason for requiring the
> trailing space on '# '

The config file parsing is still done in assembly:

getcommand:
.find:
                call skipspace          ; Skip leading whitespace
                jz .eof                 ; End of file
                jc .find                ; End of line: try again

                ; Do this explicitly so #foo is treated as a comment
                cmp al,'#'              ; Leading hash mark -> comment
                je .skipline

Which contradicts the documentation, as the actual code does not require
a space after the #.  Testing confirms this.
-- 
Regards,
Feri.




More information about the Syslinux mailing list