16 lines
585 B
TypeScript
16 lines
585 B
TypeScript
|
import { Position } from '../position.class.js';
|
||
|
|
||
|
export class NumberState {
|
||
|
private constructor(public value: string, public decimal: boolean, public active: boolean, public start: Position) {
|
||
|
}
|
||
|
|
||
|
public duplicate(): NumberState {
|
||
|
return new NumberState(this.value, this.decimal, this.active, this.start.duplicate());
|
||
|
}
|
||
|
|
||
|
public static start(position: Position): NumberState {
|
||
|
return new NumberState('', false, true, position.duplicate());
|
||
|
}
|
||
|
|
||
|
public static none: NumberState = new NumberState(null, false, false, Position.none.duplicate());
|
||
|
}
|