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