File tree 1 file changed +3
-10
lines changed
1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -6,21 +6,14 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
6
6
const PATTERN = `(?:(?:около|примерно)\\s*(?:~\\s*)?)?(${ TIME_UNITS_PATTERN } )${ REGEX_PARTS . rightBoundary } ` ;
7
7
8
8
export default class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
9
- private readonly patternWithPrefix : RegExp ;
10
- private readonly patternWithoutPrefix : RegExp ;
11
-
12
- constructor ( ) {
13
- super ( ) ;
14
- this . patternWithPrefix = new RegExp ( `(?:в течение|в течении)\\s*${ PATTERN } ` , REGEX_PARTS . flags ) ;
15
- this . patternWithoutPrefix = new RegExp ( PATTERN , REGEX_PARTS . flags ) ;
16
- }
17
-
18
9
patternLeftBoundary ( ) : string {
19
10
return REGEX_PARTS . leftBoundary ;
20
11
}
21
12
22
13
innerPattern ( context : ParsingContext ) : RegExp {
23
- return context . option . forwardDate ? this . patternWithoutPrefix : this . patternWithPrefix ;
14
+ return context . option . forwardDate
15
+ ? new RegExp ( PATTERN , REGEX_PARTS . flags )
16
+ : new RegExp ( `(?:в течение|в течении)\\s*${ PATTERN } ` , REGEX_PARTS . flags ) ;
24
17
}
25
18
26
19
innerExtract ( context : ParsingContext , match : RegExpMatchArray ) : ParsingComponents {
You can’t perform that action at this time.
0 commit comments