Spreadsheet-UX op een echte relationele engine

main

Deze repository wordt als momentopname gepubliceerd: een clone bevat de volledige inhoud, maar geen commitgeschiedenis.

703 B Ruw bestand
export type Node =
  | { k: 'num'; v: number }
  | { k: 'str'; v: string }
  | { k: 'bool'; v: boolean }
  | { k: 'null' }
  | { k: 'path'; v: string[] }
  | { k: 'unary'; op: '-' | 'NOT'; v: Node }
  | { k: 'binary'; op: BinaryOp; l: Node; r: Node }
  | { k: 'call'; name: string; args: Node[] };

export type BinaryOp =
  | '+'
  | '-'
  | '*'
  | '/'
  | '&'
  | '='
  | '!='
  | '>'
  | '<'
  | '>='
  | '<='
  | 'AND'
  | 'OR';

export class FormulaError extends Error {
  readonly position: number;
  constructor(message: string, position = -1) {
    super(position >= 0 ? `${message} (at character ${position + 1})` : message);
    this.name = 'FormulaError';
    this.position = position;
  }
}