Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,28 @@ impl Lexer {
state.source.next();
DocStringKind::Nowdoc
}
_ => DocStringKind::Heredoc,
[b'"'] => {
state.source.next();
DocStringKind::Heredoc
}
[_, ..] => DocStringKind::Heredoc,
[] => {
return Err(SyntaxError::UnexpectedEndOfFile(state.source.span()));
}
};

// FIXME: Add support for nowdocs too by checking if a `'`
// character is present before and after the identifier.
let label: ByteString = match self.peek_identifier(state) {
Some(_) => self.consume_identifier(state).into(),
None => unreachable!(),
None => match state.source.current() {
Some(c) => {
return Err(SyntaxError::UnexpectedCharacter(*c, state.source.span()))
}
None => {
return Err(SyntaxError::UnexpectedEndOfFile(state.source.span()));
}
},
};

if doc_string_kind == DocStringKind::Nowdoc {
Expand All @@ -445,6 +459,8 @@ impl Lexer {
));
}
};
} else if let Some(b'"') = state.source.current() {
state.source.next();
}

if !matches!(state.source.current(), Some(b'\n')) {
Expand Down
Loading