Skip to contentSkip to conversation

slight oddity in script parser

DISCUSSION Patrick Georgi 5 participants 11 messages Jul 31, 2008 – Aug 1, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line

Regards,
Patrick Georgi

#1 lore raw
Quoted 6 lines · Patrick Georgi

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

Quoted 7 lines

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line

Hi,

Actually, # and \ is handled in the read line function, it can't handle complicated situation.

Signature · 1 line
Bean
#2 lore raw
Quoted 17 lines · Bean
Quoted 6 lines · Patrick Georgi

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

Quoted 8 lines

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line
Quoted 5 lines

Hi,

Actually, # and \ is handled in the read line function, it can't handle complicated situation.

Are you implying it is wrong there and should be moved to the parser?

Signature · 5 lines
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [email protected]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
#3 lore raw
Quoted 18 lines · Stefan Reinauer
Quoted 17 lines · Bean
Quoted 14 lines · Patrick Georgi

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line
Quoted 7 lines
Quoted 5 lines

Hi,

Actually, # and \ is handled in the read line function, it can't handle complicated situation.

Are you implying it is wrong there and should be moved to the parser?

Hi,

In theory, it should be handled by the lexer. but actually, it's not so easy. lexer already has some issue, adding new handling would not help.

Signature · 1 line
Bean
#4 lore raw
Quoted 28 lines · Bean
Quoted 26 lines · Stefan Reinauer
Quoted 24 lines · Bean
Quoted 6 lines · Patrick Georgi

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

Quoted 9 lines

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line

Hi,

Actually, # and \ is handled in the read line function, it can't handle complicated situation.

Quoted 10 lines
Quoted 2 lines

Are you implying it is wrong there and should be moved to the parser?

Hi,

In theory, it should be handled by the lexer. but actually, it's not so easy. lexer already has some issue, adding new handling would not help.

So, what's the right way to fix it, then?

Signature · 5 lines
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [email protected]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
#5 lore raw
Quoted 32 lines · Stefan Reinauer
Quoted 31 lines · Bean
Quoted 28 lines · Stefan Reinauer
Quoted 18 lines · Bean
Quoted 6 lines · Patrick Georgi

Hi,

I forgot this, so sorry for the separate mail:
Currently, the parser expects comments to start at the beginning of the line, so "ls /foo # necessary because of baz" doesn't work properly

Quoted 9 lines

I think a good scenario would be to have comments start either on "#" at pos0, or on " #". This way, ls /foo#bar continues to work.

Also, currently the following is a single comment, which is an unusual feature:

# this comment starts here\
and continues on this line
Quoted 6 lines

Hi,

Actually, # and \ is handled in the read line function, it can't handle complicated situation.

Are you implying it is wrong there and should be moved to the parser?

Quoted 8 lines
Quoted 7 lines

Hi,

In theory, it should be handled by the lexer. but actually, it's not so easy. lexer already has some issue, adding new handling would not help.

So, what's the right way to fix it, then?

Hi,

Perhaps we should use automatic tool to generate the lexer, like using bison for the parser. But I recall that Marco encounter some issue with flex, but I can't remember what it's now.

Signature · 1 line
Bean
#6 lore raw

Hi,

Quoted 3 lines · Bean

Perhaps we should use automatic tool to generate the lexer, like using bison for the parser. But I recall that Marco encounter some issue with flex, but I can't remember what it's now.

You are right. I am not happy with the current lexer and would prefer a generated lexer like flex. Unfortunately, flex depends on a POSIX environment.

--
Marco

#7 lore raw
Quoted 11 lines · Marco Gerards

Hi,

Quoted 3 lines · Bean

Perhaps we should use automatic tool to generate the lexer, like using bison for the parser. But I recall that Marco encounter some issue with flex, but I can't remember what it's now.

You are right. I am not happy with the current lexer and would prefer a generated lexer like flex. Unfortunately, flex depends on a POSIX environment.

Hi,

Which POSIX feature does it use ? Can it be configured using option ?

Signature · 1 line
Bean
#8 lore raw

Hi,

Quoted 9 lines · Bean
Quoted 8 lines · Marco Gerards

Hi,

Quoted 3 lines · Bean

Perhaps we should use automatic tool to generate the lexer, like using bison for the parser. But I recall that Marco encounter some issue with flex, but I can't remember what it's now.

Quoted 7 lines
Quoted 3 lines

You are right. I am not happy with the current lexer and would prefer a generated lexer like flex. Unfortunately, flex depends on a POSIX environment.

Hi,

Which POSIX feature does it use ? Can it be configured using option ?

Sorry, I do not recall. IIRC it could not be disabled, otherwise I would have done that.

--
Marco

#9 lore raw
In reply to Bean
Quoted 6 lines · Bean

Hi,

In theory, it should be handled by the lexer. but actually, it's not so easy. lexer already has some issue, adding new handling would not help.

I'm not familiar with this part of GRUB. But based on what you say, I think before we venture into significant redesign of the parser we'd have to evaluate what do we gain with it.

If it's just to support \ in comments, I think it's not worth the hassle to implement and later debug any problems it creates.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#10 lore raw
Quoted 2 lines · Robert Millan

If it's just to support \ in comments, I think it's not worth the hassle to implement and later debug any problems it creates.

There's also the "comments that don't start at the beginning of the line" thing, and it might be that one of the issues in my other mail (leading spaces within if/then/else trigger malloc magic failure) is related to it. Couldn't pinpoint it yet. The text corruption thing probably has its roots in the parser, too.

Regards,
Patrick Georgi