module access to expression

This commit is contained in:
Umur Ozkul 2022-06-09 14:57:25 +02:00
parent 5f6feb26ba
commit 02c06b638e
3 changed files with 8 additions and 0 deletions

View File

@ -181,4 +181,8 @@ describe("Peggy to Expression", () => {
(),
)
})
describe("module", () => {
testToExpression("Math.pi", "{(:$_atIndex_$ :Math 'pi')}", ())
})
})

View File

@ -65,5 +65,7 @@ let eBindExpression = (bindingExpr: expression, expression: expression): express
let eBindExpressionDefault = (expression: expression): expression =>
eFunction("$$_bindExpression_$$", list{expression})
let eIdentifier = (name: string): expression => name->BExpressionValue.EvSymbol->BExpressionT.EValue
let eTypeIdentifier = (name: string): expression =>
name->BExpressionValue.EvTypeIdentifier->BExpressionT.EValue

View File

@ -34,6 +34,8 @@ let rec fromNode = (node: Parse.node): expression => {
nodeLetStatement["variable"]["value"],
fromNode(nodeLetStatement["value"]),
)
| PgNodeModuleIdentifier(nodeModuleIdentifier) =>
ExpressionBuilder.eIdentifier(nodeModuleIdentifier["value"])
| PgNodeString(nodeString) => ExpressionBuilder.eString(nodeString["value"])
| PgNodeTernary(nodeTernary) =>
ExpressionBuilder.eFunction(