awk: a comment line next to a newline breaks the statement ("invalid statement start")
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 76/100
Rechercherichtung
Start by finding the parser code that reports “invalid statement start” and trace how it handles comments between statements, after an if condition, and inside function arguments. Use the three Rust tests in the issue as reproductions, then run them and confirm each succeeds with the expected output. The issue says the GNU awk suite has 31 tests affected; passing those cases is the completion criterion.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
A # comment on a line of its own is rejected as a syntax error when it sits
between two statements that are separated by ; or by another comment line,
after if (...), after switch (...) {, or inside a function call argument
list. Real-world awk scripts are full of comment lines, so this is the most
frequent parse failure in the GNU test suite: 31 tests stop on it.
Reproduction
Rust (incorrect)
$ printf 'BEGIN {\n x = 1;\n # set y\n y = 2\n print x, y\n}\n' > c.awk
$ ./target/release/awk -f c.awk
Error: Syntax error
╭─[ c.awk:3:12 ]
3 │ # set y
│ ╰── Unexpected token: invalid statement start.
GNU (correct)
$ gawk -f c.awk
1 2
Other shapes that fail the same way:
BEGIN {
# first comment line
# second comment line
print 1 }
BEGIN { if (1)
# comment
print 2 }
BEGIN { printf("%s\n",
# comment
"x") }
Test
#[test]
fn comment_lines_between_statements() {
ucmd()
.arg("BEGIN {\n x = 1;\n # one\n # two\n y = 2\n print x, y\n}")
.succeeds()
.stdout_only("1 2\n");
}
#[test]
fn comment_line_after_if_condition() {
ucmd()
.arg("BEGIN { if (1)\n # why\n print \"yes\" }")
.succeeds()
.stdout_only("yes\n");
}
#[test]
fn comment_line_in_argument_list() {
ucmd()
.arg("BEGIN { printf(\"%s-%s\\n\",\n # first\n \"a\",\n # second\n \"b\") }")
.succeeds()
.stdout_only("a-b\n");
}
Exposed by the GNU awk test suite: aadelete2, arrayind1, arrayind3, arynasty,
arynocls, close_status, clsflnam, delarpm2, fldterm, forcenum, forref, fpat1,
fpat4, gsubtst2, hsprint, indirectbuiltin, iolint, leaddig, lintindex, mdim3,
mdim8, nasty, profile10, profile11, profile14, profile17, regx8bit, sortglos,
strnum2, typeof6, wjposer1.
- Vorherrschende Sprache
- Rust
- Sterne
- 31
- Forks
- 13
- Ø Merge
- 23 Std. 42 Min.
- Gemergte PRs (30 T.)
- 29
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus uutils/awk
-
bug gnu-compat good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug crash gnu-compat good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug gnu-compat good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug gnu-compat good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
awk: `-f missing-file` and `--source` panicEvtl. vergeben @VanshajPoonia hat das vor 4 Tagen übernommen. Offenbug crash gnu-compat good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
awxkee/yuvutils-rs#149 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Ignore entry for RUSTSEC-2026-0002 no longer matches anything (`lru` is no longer in `Cargo.lock`)Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
influxdata/influxdb#27767 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
shell-pool/shpool#463 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
oras-project/rust-oci-client-node#132 ·
Maintainer antworten meist innerhalb von 2 Tagen