import { Node } from "./node" ; import { Operand } from "./operand" ; export type Expression = BinaryExpression | UnaryExpression | Postfix | Operand ; export interface BinaryExpression extends Node { operator : string ; left : Expression ; right : Expression ; } export function isBinaryExpression ( node ) { return node . type === "Binary" ; } export interface UnaryExpression extends Node { operator : string ; right : Expression ; } export function isUnaryExpression ( node ) { return node . type === "Unary" ; } export interface Postfix extends Node { base : Operand ; operationList : PostfixOperation [ ] ; } export function isPostfix ( node ) { return node . type === "Postfix" ; } export type PostfixOperation = FunctionCall | RecordAccess | ArrayAccess ; export interface FunctionCall extends Node { arguments : Expression [ ] ; } export function isFunctionCall ( node ) { return node . type === "FunctionCall" ; } export interface RecordAccess extends Node { field : string ; } export function isRecordAccess ( node ) { return node . type === "RecordAccess" ; } export interface ArrayAccess extends Node { index : Expression ; } export function isArrayAccess ( node ) { return node . type === "ArrayAccess" ; }