import { Value , Path , assert } from "./exports" ; /** Base items contain no other items */ export abstract class Base extends Value { eval ( ) { } uneval ( ) { } dump ( ) { } isCopyOf ( ancestor ) { if ( super . isCopyOf ( ancestor ) ) { assert ( this . equals ( ancestor ) ) ; return true ; } else { return false ; } } } /**
 * A JS number.
 * NaN is the blank number `###` which is equal to itself.
 */ export class _Number extends Base { value : number = NaN ; isBlank ( ) { return Number . isNaN ( this . value ) ; } copy ( srcPath , dstPath ) { let to = super . copy ( srcPath , dstPath ) ; to . value = this . value ; return to ; } equals ( other ) { return ( other instanceof _Number && ( this . value === other . value || this . isBlank ( ) && other . isBlank ( ) ) ) ; } dump ( ) { return this . value ; } ; } /** a JS character */ export class Character extends Base { /** value is a single-character string. could be a charCode instead */ value : string = ' ' ; isBlank ( ) { return this . value === ' ' ; } copy ( srcPath , dstPath ) { let to = super . copy ( srcPath , dstPath ) ; to . value = this . value ; return to ; } equals ( other ) { return other instanceof Character && this . value === other . value ; } dump ( ) { return this . value ; } ; } /** Nil is the unit type with one value */ export class Nil extends Base { isBlank ( ) { return true ; } get value ( ) { return null ; } ; equals ( other ) { return other instanceof Nil ; } dump ( ) { return null ; } ; } /** Anything is the top type used in generics */ export class Anything extends Base { isBlank ( ) { return true ; } equals ( other ) { return other instanceof Anything ; } get isGeneric ( ) { return true ; } updatableFrom ( from , fromPath ? , thisPath ? ) { return true ; } dump ( ) { return undefined ; } ; }