import { Hash } from "@siteimprove/alfa-hash" ; import { Parser } from "@siteimprove/alfa-parser" ; import { Slice } from "@siteimprove/alfa-slice" ; import { Token } from "../syntax/token" ; import { Numeric } from "./numeric" ; const { map } = Parser ; /**
 *  https public export class Integer extends Numeric < "integer" > { public static of ( value ) { return new Integer ( value | 0 ) ; } private constructor ( value ) { super ( value ) ; } public get type ( ) : "integer" { return "integer" ; } public equals ( value ) { return value instanceof Integer && super . equals ( value ) ; } public hash ( hash ) { hash . writeInt32 ( this . _value ) ; } public toJSON ( ) { return { type : "integer" , value : this . _value , } ; } } public export namespace Integer { export interface JSON extends Numeric . JSON < "integer" > { value : number ; } export function isInteger ( value ) { return value instanceof Integer ; } export const parse = map ( Token . parseNumber ( ( number ) => number . isInteger ) , ( integer ) => Integer . of ( integer . value ) ) ; }