Fix parsing concat

This commit is contained in:
Sofia 2026-03-20 19:23:53 +02:00
parent 68da93541d
commit fb12568e33
2 changed files with 13 additions and 1 deletions

View File

@ -94,4 +94,4 @@ for k, v in (ipairs(table)) do
print(k, v)
end
print(_ENV.b)
print("hello " .. "there")

View File

@ -480,6 +480,11 @@ impl Parse for IndexedAccess {
fn parse(mut stream: TokenStream) -> Result<Self, TokenStreamError> {
let mut expressions = Vec::new();
while let Some(Token::Symbol('[') | Token::Symbol('.')) = stream.peek() {
if let (Some(Token::Symbol('.')), Some(Token::Symbol('.'))) =
(stream.peek(), stream.peek2())
{
break;
}
match stream.next().unwrap() {
Token::Symbol('[') => {
let expression = stream.parse()?;
@ -668,6 +673,10 @@ impl Parse for BinaryOperator {
stream.next();
Ok(BinaryOperator::NotEqual)
}
(Token::Symbol('.'), Some(Token::Symbol('.'))) => {
stream.next();
Ok(BinaryOperator::Concat)
}
(Token::Symbol('>'), Some(Token::Symbol('>'))) => {
stream.next();
@ -790,6 +799,9 @@ impl Parse for PrimaryExpression {
);
}
Token::Symbol('[') | Token::Symbol('.') => {
if stream.peek2() == Some(Token::Symbol('.')) {
break;
}
let meta = Metadata::produce(&mut stream, pre.clone());
let IndexedAccess(accesses) = stream.parse()?;
for access in accesses {