mirror of
https://github.com/Dummi26/mers.git
synced 2025-04-28 18:16:05 +02:00
added support for shebangs: if the file starts with "#!", the first line will be ignored.
This commit is contained in:
parent
5bb4d2e4a5
commit
ed8aecde86
@ -32,6 +32,11 @@ impl Display for FilePosition {
|
|||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
pub fn new(data: String, path: PathBuf) -> Self {
|
pub fn new(data: String, path: PathBuf) -> Self {
|
||||||
|
let data = if data.starts_with("#!") {
|
||||||
|
&data[data.lines().next().unwrap().len()..].trim_start()
|
||||||
|
} else {
|
||||||
|
data.trim_start()
|
||||||
|
};
|
||||||
let mut chs = data.chars();
|
let mut chs = data.chars();
|
||||||
let mut data = String::with_capacity(data.len());
|
let mut data = String::with_capacity(data.len());
|
||||||
loop {
|
loop {
|
||||||
|
Loading…
Reference in New Issue
Block a user