Skip to content

Compilation command fails to parse #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #185
certik opened this issue Mar 16, 2025 · 5 comments · Fixed by #264
Closed
Tracked by #185

Compilation command fails to parse #257

certik opened this issue Mar 16, 2025 · 5 comments · Fixed by #264
Labels
bug Something isn't working

Comments

@certik
Copy link
Collaborator

certik commented Mar 16, 2025

(lf-mpi) ~/pot3d/src(337546b...)$ ${FC} -c mpi_wrapper.o mpi_c_bindings.o mpi.o psi_io.o pot3d.o -o pot3d -L$CONDA_PREFIX/lib -lmpi -Wl,-rpath,$CONDA_PREFIX/lib

Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((1, 102))
   ╭────
 1 │ ${FC} -c mpi_wrapper.o mpi_c_bindings.o mpi.o psi_io.o pot3d.o -o pot3d -L$CONDA_PREFIX/lib -lmpi -Wl,-rpath,$CONDA_PREFIX/lib
   ·                                                                                                      ┬
   ·                                                                                                      ╰── expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr, io_redirect, or separator_op
   ╰────
  help: expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr,
        io_redirect, or separator_op

I do not have a workaround, besides switching to another shell.

@certik certik added the bug Something isn't working label Mar 16, 2025
@certik certik mentioned this issue Mar 16, 2025
16 tasks
@lucascolley
Copy link
Contributor

As a workaround, could you use quotes @certik ? As a more minimal example:

shell on 🎋 main via 🦀 v1.85.1 cargo r    
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.32s
     Running `target/debug/shell`
$ rg -efile1,
Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((1, 11))
   ╭────
 1 │ rg -efile1,
   ·           ┬
   ·           ╰── expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr, io_redirect, or separator_op
   ╰────
  help: expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr, io_redirect, or separator_op

shell on 🎋 main via 🦀 v1.85.1 took 11s cargo r    
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.25s
     Running `target/debug/shell`
$ rg -e"file1,"
crates/deno_task_shell/src/shell/commands/cp_mv.rs
318:        fs::write(&file1, "test").unwrap();
442:        fs::write(&file1, "test").unwrap();
453:        fs::write(&file1, "test").unwrap(); // recreate
$ rg -e="file1,"
crates/deno_task_shell/src/shell/commands/cp_mv.rs
318:        fs::write(&file1, "test").unwrap();
442:        fs::write(&file1, "test").unwrap();
453:        fs::write(&file1, "test").unwrap(); // recreate

Looks like we should still fix this though, it works in zsh:

shell on 🎋 main via 🦀 v1.85.1 took 2m56s rg -efile1,
crates/deno_task_shell/src/shell/commands/cp_mv.rs
318:        fs::write(&file1, "test").unwrap();
442:        fs::write(&file1, "test").unwrap();
453:        fs::write(&file1, "test").unwrap(); // recreate

@lucascolley
Copy link
Contributor

lucascolley commented Apr 11, 2025

UNQUOTED_PENDING_WORD = ${
(TILDE_PREFIX ~ (!(OPERATOR | WHITESPACE | NEWLINE) ~ (
EXIT_STATUS |
UNQUOTED_ESCAPE_CHAR |
"$" ~ ARITHMETIC_EXPRESSION |
SUB_COMMAND |
VARIABLE_EXPANSION |
UNQUOTED_CHAR |
QUOTED_WORD
))*)
|
(!(OPERATOR | WHITESPACE | NEWLINE) ~ (
EXIT_STATUS |
UNQUOTED_ESCAPE_CHAR |
"$" ~ ARITHMETIC_EXPRESSION |
SUB_COMMAND |
VARIABLE_EXPANSION |
UNQUOTED_CHAR |
QUOTED_WORD
))+
}

Line 23 forbids using OPERATORs in unquoted words, and , is an OPERATOR:

OPERATOR = _{
AND_IF | OR_IF | DSEMI | DLESS | DGREAT | LESSAND | GREATAND | LESSGREAT | DLESSDASH | CLOBBER |
"," |"(" | ")" | "{" | "}" | ";" | "&" | "|" | "<" | ">"
}

@lucascolley
Copy link
Contributor

all tests actually pass if we remove , as an OPERATOR, PR at gh-264

@certik
Copy link
Collaborator Author

certik commented May 2, 2025

Another case:

$ gfortran -o a.out arrays_reshape_23.f90 -Wl,-rpath,/Users/ondrej/.pixi/envs/gfortran/lib
Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((1, 44))
   ╭────
 1 │ gfortran -o a.out arrays_reshape_23.f90 -Wl,-rpath,/Users/ondrej/.pixi/envs/gfortran/lib
   ·                                            ┬
   ·                                            ╰── expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr, io_redirect, or separator_op
   ╰────
  help: expected EOI, TILDE_PREFIX, AND_IF, OR_IF, Stdout, StdoutStderr,
        io_redirect, or separator_op

@certik
Copy link
Collaborator Author

certik commented May 2, 2025

Ok, it looks like it's fixed, thank you @lucascolley ! Much appreciated, this was a super annoying bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants