module grammar type correction
This commit is contained in:
parent
b41e32805c
commit
cfcf3cb144
|
@ -64,6 +64,7 @@
|
||||||
return {type: 'KeyValue', key: key, value: value}}
|
return {type: 'KeyValue', key: key, value: value}}
|
||||||
function nodeLambda(args, body) {return {type: 'Lambda', args: args, body: body}}
|
function nodeLambda(args, body) {return {type: 'Lambda', args: args, body: body}}
|
||||||
function nodeLetStatment(variable, value) {return {type: 'LetStatement', variable: variable, value: value}}
|
function nodeLetStatment(variable, value) {return {type: 'LetStatement', variable: variable, value: value}}
|
||||||
|
function nodeModuleIdentifier(value) {return {type: 'ModuleIdentifier', value: value}}
|
||||||
function nodeString(value) {return {type: 'String', value: value}}
|
function nodeString(value) {return {type: 'String', value: value}}
|
||||||
function nodeTernary(condition, trueExpression, falseExpression) {return {type: 'Ternary', condition: condition, trueExpression: trueExpression, falseExpression: falseExpression}}
|
function nodeTernary(condition, trueExpression, falseExpression) {return {type: 'Ternary', condition: condition, trueExpression: trueExpression, falseExpression: falseExpression}}
|
||||||
|
|
||||||
|
@ -256,11 +257,11 @@ basicLiteral
|
||||||
|
|
||||||
dollarIdentifierWithModule 'identifier'
|
dollarIdentifierWithModule 'identifier'
|
||||||
= head:moduleIdentifier
|
= head:moduleIdentifier
|
||||||
tail:('.' _nl @moduleIdentifier)* '.' _nl
|
tail:('.' _nl @$moduleIdentifier)* '.' _nl
|
||||||
final:dollarIdentifier
|
final:$dollarIdentifier
|
||||||
{ tail.push(final);
|
{ tail.push(final);
|
||||||
return tail.reduce(function(result, element) {
|
return tail.reduce(function(result, element) {
|
||||||
return makeFunctionCall(postOperatorToFunction['[]'], [result, element])
|
return makeFunctionCall(postOperatorToFunction['[]'], [result, nodeString(element)])
|
||||||
}, head)}
|
}, head)}
|
||||||
|
|
||||||
identifier 'identifier'
|
identifier 'identifier'
|
||||||
|
@ -273,7 +274,7 @@ dollarIdentifier '$identifier'
|
||||||
= ([\$_a-z]+[\$_a-z0-9]i*) {return nodeIdentifier(text())}
|
= ([\$_a-z]+[\$_a-z0-9]i*) {return nodeIdentifier(text())}
|
||||||
|
|
||||||
moduleIdentifier 'identifier'
|
moduleIdentifier 'identifier'
|
||||||
= ([A-Z]+[_a-z0-9]i*) {return nodeIdentifier(text())}
|
= ([A-Z]+[_a-z0-9]i*) {return nodeModuleIdentifier(text())}
|
||||||
|
|
||||||
|
|
||||||
string 'string'
|
string 'string'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user