A NOTE has been added to this issue.
==
http://austingroupbugs.net/view.php?id=1098
==
Reported By:Mark_Galeck
Assigned To:
==
Project:1003.1(2016)/Issue7+TC2
Issue ID: 1098
Category: Shell and Utilities
Type: Error
Severity: Editorial
Priority: normal
Status: New
Name: Mark Galeck
Organization:
User Reference:
Section:2.10.2 Shell Grammar Rules
Page Number:2379
Line Number:76091
Interp Status: ---
Final Accepted Text:
==
Date Submitted: 2016-10-20 16:56 UTC
Last Modified: 2016-10-26 16:32 UTC
==
Summary:do_group symbol cannot be accepted as written,
because rule 6 cannot yield Done token
==
--
(0003458) Mark_Galeck (reporter) - 2016-10-26 16:32
http://austingroupbugs.net/view.php?id=1098#c3458
--
>Rule 6 is necessary to force 'for' as unquoted text being treated as a
keyword and not a simple command with arguments, in the absence of a
sequential_sep as 'best/longest matching production' to satisfy the command
production.
It could be that I already know what you are talking about, but can't tell
because I don't understand this sentence.
Since you write "necessary", can you give me an example involving "for",
that if we dropped rule 6 and just applied default rule 1, would behave
differently compared to the current standard?
>A similar ambiguity exists for 'in'
Likewise, please, an example involving "in".
I am not trying to argue with you, I just want to see if there is anything
in what you wrote, that I don't already know.
> for varname do ( ) done
parses as a for loop, with '( )' representing a valid subshell
compound-list that does nothing, and fully matches for_clause choice 1
No it doesn't. '( )', with or without the space inside is invalid
subshell.
Both dash and bash do not accept it.
> for varname do \() done
parses as a simple command, 'for'; with 'varname', 'do', '()', and 'done'
as textual arguments,
as '\()' is an invalid compound-list that forces backtracking to
simple_command as best match
No it doesn't, for multiple reasons:
* 'for' as the first token will be treated as reserved word, regardless of
whether the remaining tokens do or not form valid 'for' loop sequence.
That is because, in order for it to parse as a simple command, 'for' would
have to be WORD in the cmd_name production, and rule 7a applies, which
says, 'for' is For, not WORD.
* Even if 'for' were a command name (which is not), \() is not one WORD
token, but two tokens, one \( and then second ), and the second token is
the ')' operator, so the whole thing would still not be one simple command
, but it would be invalid use of ')'.
As before, check either dash or bash, they show what I wrote above.
> \for varname do ( ) done
also parses as a simple command, but with '(' and ')' as separate
arguments, due to the escaping '\' disabling keyword recognition.
No it doesn't. Here '\for' is command OK, but both ( and ) are operators,
regardless of space between them, and they are unexpected.
Again, bash and dash do not accept this.
Issue History
Date ModifiedUsername FieldChange
==
2016-10-20 16:56 Mark_GaleckNew Issue
2016-10-20 16:56 Mark_GaleckName => Mark Galeck
2016-10-20 16:56 Mark_GaleckSection => 2.10.2 Shell
Grammar Rules
2016-10-20 16:56 Mark_GaleckPage Number => 2379
2016-10-20 16:56 Mark_GaleckLine Number => 76091
2016-10-21 09:23 geoffclare Note Added: 0003448
2016-10-21 09:24 geoffclare Note Edited: 0003448
2016-10-21 09:41 geoffclare Note Edited: 0003448
2016-10-21 21:56 Mark_GaleckNote Added: 0003449
2016-10-22 08:00 geoffclare Note Added: 0003450
2016-10-22 08:22 Mark_GaleckNote Added: 0003451
2016-10-22 10:44 geoffclare Note Added: 0003452