-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Apply lazy loading for UK patterns
- Loading branch information
Wanasit Tanakitrungruang
committed
Nov 19, 2023
1 parent
30128bc
commit 4c4d6d1
Showing
10 changed files
with
98 additions
and
142 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/locales/uk/parsers/AbstractParserWithWordBoundaryChecking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// noinspection DuplicatedCode | ||
|
||
import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary"; | ||
import { REGEX_PARTS } from "../constants"; | ||
import { ParsingContext } from "../../../chrono"; | ||
|
||
export abstract class AbstractParserWithLeftBoundaryChecking extends AbstractParserWithWordBoundaryChecking { | ||
abstract innerPatternString(context: ParsingContext): string; | ||
|
||
patternLeftBoundary(): string { | ||
return REGEX_PARTS.leftBoundary; | ||
} | ||
|
||
innerPattern(context: ParsingContext): RegExp { | ||
return new RegExp(this.innerPatternString(context), REGEX_PARTS.flags); | ||
} | ||
|
||
innerPatternHasChange(context: ParsingContext, currentInnerPattern: RegExp): boolean { | ||
return false; | ||
} | ||
} | ||
|
||
export abstract class AbstractParserWithLeftRightBoundaryChecking extends AbstractParserWithLeftBoundaryChecking { | ||
innerPattern(context: ParsingContext): RegExp { | ||
return new RegExp(`${this.innerPatternString(context)}${REGEX_PARTS.rightBoundary}`, REGEX_PARTS.flags); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
src/locales/uk/parsers/UKTimeUnitCasualRelativeFormatParser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters