allow beginning words with :
This commit is contained in:
parent
88257715c3
commit
fa488c4b08
1 changed files with 12 additions and 10 deletions
22
src/lexer.rs
22
src/lexer.rs
|
@ -193,16 +193,18 @@ fn read_block(str_words: &[String], isfn: bool) -> Result<(Option<u32>, Words, u
|
|||
let mut word = x
|
||||
.split(':')
|
||||
.next()
|
||||
.expect("unreachable (empty words are filtered by the parser)");
|
||||
let mut ra = 0;
|
||||
while word.starts_with('&') {
|
||||
ra += 1;
|
||||
word = &word[1..];
|
||||
}
|
||||
if let Some(word) = word.strip_suffix(';') {
|
||||
words.push(Word::Call(word.to_owned(), true, ra));
|
||||
} else {
|
||||
words.push(Word::Call(word.to_owned(), false, ra));
|
||||
.unwrap(); // SAFETY: One item always exists after a split.
|
||||
if !word.is_empty() {
|
||||
let mut ra = 0;
|
||||
while word.starts_with('&') {
|
||||
ra += 1;
|
||||
word = &word[1..];
|
||||
}
|
||||
if let Some(word) = word.strip_suffix(';') {
|
||||
words.push(Word::Call(word.to_owned(), true, ra));
|
||||
} else {
|
||||
words.push(Word::Call(word.to_owned(), false, ra));
|
||||
}
|
||||
}
|
||||
for mut word in x.split(':').skip(1) {
|
||||
let mut ra = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue