diff --git a/examples/test.lua b/examples/test.lua index b9e72e3..bc22765 100644 --- a/examples/test.lua +++ b/examples/test.lua @@ -94,4 +94,4 @@ for k, v in (ipairs(table)) do print(k, v) end -print(_ENV.b) \ No newline at end of file +print("hello " .. "there") \ No newline at end of file diff --git a/src/ast.rs b/src/ast.rs index 3f3e7c6..26f2648 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -480,6 +480,11 @@ impl Parse for IndexedAccess { fn parse(mut stream: TokenStream) -> Result { 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 {