Fix parsing concat
This commit is contained in:
parent
68da93541d
commit
fb12568e33
@ -94,4 +94,4 @@ for k, v in (ipairs(table)) do
|
|||||||
print(k, v)
|
print(k, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
print(_ENV.b)
|
print("hello " .. "there")
|
||||||
12
src/ast.rs
12
src/ast.rs
@ -480,6 +480,11 @@ impl Parse for IndexedAccess {
|
|||||||
fn parse(mut stream: TokenStream) -> Result<Self, TokenStreamError> {
|
fn parse(mut stream: TokenStream) -> Result<Self, TokenStreamError> {
|
||||||
let mut expressions = Vec::new();
|
let mut expressions = Vec::new();
|
||||||
while let Some(Token::Symbol('[') | Token::Symbol('.')) = stream.peek() {
|
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() {
|
match stream.next().unwrap() {
|
||||||
Token::Symbol('[') => {
|
Token::Symbol('[') => {
|
||||||
let expression = stream.parse()?;
|
let expression = stream.parse()?;
|
||||||
@ -668,6 +673,10 @@ impl Parse for BinaryOperator {
|
|||||||
stream.next();
|
stream.next();
|
||||||
Ok(BinaryOperator::NotEqual)
|
Ok(BinaryOperator::NotEqual)
|
||||||
}
|
}
|
||||||
|
(Token::Symbol('.'), Some(Token::Symbol('.'))) => {
|
||||||
|
stream.next();
|
||||||
|
Ok(BinaryOperator::Concat)
|
||||||
|
}
|
||||||
|
|
||||||
(Token::Symbol('>'), Some(Token::Symbol('>'))) => {
|
(Token::Symbol('>'), Some(Token::Symbol('>'))) => {
|
||||||
stream.next();
|
stream.next();
|
||||||
@ -790,6 +799,9 @@ impl Parse for PrimaryExpression {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Token::Symbol('[') | Token::Symbol('.') => {
|
Token::Symbol('[') | Token::Symbol('.') => {
|
||||||
|
if stream.peek2() == Some(Token::Symbol('.')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
let meta = Metadata::produce(&mut stream, pre.clone());
|
let meta = Metadata::produce(&mut stream, pre.clone());
|
||||||
let IndexedAccess(accesses) = stream.parse()?;
|
let IndexedAccess(accesses) = stream.parse()?;
|
||||||
for access in accesses {
|
for access in accesses {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user