Merge pull request #882 from quantified-uncertainty/issue-872

fixes #872
This commit is contained in:
Ozzie Gooen 2022-07-25 12:10:36 -07:00 committed by GitHub
commit fb0aa72aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,11 +46,11 @@ voidStatement
return h.nodeLetStatement(variable, value); }
letStatement
= variable:identifier _ assignmentOp _nl value:zeroOMoreArgumentsBlockOrExpression
= variable:variable _ assignmentOp _nl value:zeroOMoreArgumentsBlockOrExpression
{ return h.nodeLetStatement(variable, value) }
defunStatement
= variable:identifier '(' _nl args:array_parameters _nl ')' _ assignmentOp _nl body:innerBlockOrExpression
= variable:variable '(' _nl args:array_parameters _nl ')' _ assignmentOp _nl body:innerBlockOrExpression
{ var value = h.nodeLambda(args, body)
return h.nodeLetStatement(variable, value) }
@ -144,11 +144,11 @@ chainFunctionCall
}, head)}
chainedFunction
= fn:dollarIdentifier '(' _nl args:array_functionArguments _nl ')'
= fn:variable '(' _nl args:array_functionArguments _nl ')'
{ return {fnName: fn.value, args: args}}
/ fn:dollarIdentifier '(' _nl ')'
/ fn:variable '(' _nl ')'
{ return {fnName: fn.value, args: []}}
/ fn:dollarIdentifier
/ fn:variable
{ return {fnName: fn.value, args: []}}
// end of binary operators
@ -192,13 +192,14 @@ basicLiteral
= string
/ number
/ boolean
/ dollarIdentifierWithModule
/ dollarIdentifier
/ variable
/ voidLiteral
voidLiteral 'void'
= "()" {return h.nodeVoid();}
variable = dollarIdentifierWithModule / dollarIdentifier
dollarIdentifierWithModule 'identifier'
= head:$moduleIdentifier
tail:('.' _nl @$moduleIdentifier)* '.' _nl