Re: shebang handling

2021-07-04 Thread Marc via Gcc-rust
Mark Wielaard writes: > [PATCH 1/2] Handle shebang line, plus any whitespace and comment > [PATCH 2/2] Remove has_shebang flag from AST and HIR Crate classes Pushed to githup: https://github.com/Rust-GCC/gccrs/pull/546 Marc -- Gcc-rust mailing list Gcc-rust@gcc.gnu.org https://gcc.gnu.org/ma

[PATCH 2/2] Remove has_shebang flag from AST and HIR Crate classes

2021-07-04 Thread Mark Wielaard
The lexer deals with the shebang and the parser cannot detect whether there is or isn't a shebang line. The flag isn't relevant or useful in the AST and HIR Crate classes. --- gcc/rust/ast/rust-ast-full-test.cc | 5 + gcc/rust/ast/rust-ast.h | 13 + gcc/rust/h

[PATCH 1/2] Handle shebang line, plus any whitespace and comment skipping in lexer

2021-07-04 Thread Mark Wielaard
The lexer tried to handle the shebang line but used loc directly, instead of the current_column. And it assumed a '/' should immediately follow the "#!". But if the "#!" is followed by whitespace and/or comments and a '[' character, then the first line isn't see as a shebang line (even if the kerne

shebang handling

2021-07-04 Thread Mark Wielaard
Hi, Shebang handling, the first line starting with #! was not done fully correct and it isn't necessary to keep track of the shebang line in the AST or HIR Crate classes. Because an inner attribute also starts with #! the first line isn't regarded as a shebang line if the #! is followed by (optio