UNPKG

@adamsy/bhai-lang

Version:

<h1 align="center">Bhai Lang</h1> <p align="center"> <a href="https://lgtm.com/projects/g/DulLabs/bhai-lang/alerts/"><img alt="Total alerts" src="https://img.shields.io/lgtm/alerts/g/DulLabs/bhai-lang.svg?logo=lgtm&logoWidth=18"/></a> <a href="https://lgt

22 lines (16 loc) 637 B
import Visitor from "."; import { ASTNode } from "bhai-lang-parser"; import InvalidStateException from "../../exceptions/invalidStateException"; import InterpreterModule from "../../module/interpreterModule"; export default class IdentifierExpression implements Visitor { visitNode(node: ASTNode) { if (!node.name) { throw new InvalidStateException(`Invalid node name for: ${node.type}`); } let value = InterpreterModule.getCurrentScope().get(node.name); if (value === null) value = "nalla"; else if (value === true) value = "sahi"; else if (value === false) value = "galat"; return value; } }