$indentified defined. Assignment not allowed

This commit is contained in:
Umur Ozkul 2022-05-20 17:22:43 +02:00
parent 1557c197a0
commit 2a176fac26
2 changed files with 260 additions and 174 deletions

View File

@ -108,7 +108,7 @@ defunStatement
return nodeLetStatment(variable, value) } return nodeLetStatment(variable, value) }
array_parameters array_parameters
= head:identifier tail:(_ ',' _nl @identifier)* = head:dollarIdentifier tail:(_ ',' _nl @dollarIdentifier)*
{ return [head, ...tail]; } { return [head, ...tail]; }
expression = ifthenelse / ternary / logicalAdditive expression = ifthenelse / ternary / logicalAdditive
@ -177,11 +177,11 @@ chainFunctionCall
}, head)} }, head)}
chainedFunction chainedFunction
= fn:identifier '(' _nl args:array_functionArguments _nl ')' = fn:dollarIdentifier '(' _nl args:array_functionArguments _nl ')'
{ return {fnName: fn.value, args: args}} { return {fnName: fn.value, args: args}}
/ fn:identifier '(' _nl ')' / fn:dollarIdentifier '(' _nl ')'
{ return {fnName: fn.value, args: []}} { return {fnName: fn.value, args: []}}
/ fn:identifier / fn:dollarIdentifier
{ return {fnName: fn.value, args: []}} { return {fnName: fn.value, args: []}}
// end of binary operators // end of binary operators
@ -219,8 +219,8 @@ maybeRecordElement
/ atom / atom
recordElement recordElement
= head:identifier &'.' = head:dollarIdentifier &'.'
tail:(_ '.' _nl arg:$identifier {return {fn: postOperatorToFunction['.'], args: [nodeString(arg)]}})* tail:(_ '.' _nl arg:$dollarIdentifier {return {fn: postOperatorToFunction['.'], args: [nodeString(arg)]}})*
{ return tail.reduce(function(result, element) { { return tail.reduce(function(result, element) {
return makeFunctionCall(element.fn, [result, ...element.args]) return makeFunctionCall(element.fn, [result, ...element.args])
}, head)} }, head)}
@ -236,10 +236,13 @@ basicLiteral
/ float / float
/ integer / integer
/ boolean / boolean
/ identifier / dollarIdentifier
identifier 'identifier' identifier 'identifier'
= identifier:([_a-z]+[_a-z0-9]i*) {return nodeIdentifier(text())} = ([_a-z]+[_a-z0-9]i*) {return nodeIdentifier(text())}
dollarIdentifier '$identifier'
= ([\$_a-z]+[\$_a-z0-9]i*) {return nodeIdentifier(text())}
string 'string' string 'string'
= characters:("'" @([^'])* "'") {return nodeString(characters.join(''))} = characters:("'" @([^'])* "'") {return nodeString(characters.join(''))}