File tree Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -34,20 +34,17 @@ function lex<T>(parser: Parser<T>): Parser<T> {
34
34
const comment = checkedSequence (
35
35
matchString ( "#" , "hash sign" ) ,
36
36
match ( / [ ^ \n ] * ?(? = \r ? \n ) / , "comment content" ) ,
37
- )
38
- . map ( ( ) => null ) ;
37
+ ) ;
39
38
const spaces = checkedSequence (
40
39
match ( / \s / , "space" ) ,
41
40
match ( / \s * / , "space" ) ,
42
- )
43
- . map ( ( ) => null ) ;
41
+ ) ;
44
42
const ignore = allWithCheck (
45
43
new CheckedParser (
46
44
choiceOnlyOne ( comment . check , spaces . check ) ,
47
45
choiceWithCheck ( spaces , comment ) ,
48
46
) ,
49
- )
50
- . map ( ( ) => null ) ;
47
+ ) ;
51
48
const backtick = matchString ( "`" , "backtick" ) ;
52
49
const colon = matchString ( ":" , "colon" ) ;
53
50
const character = match ( / ./ u, "character" ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import {
15
15
nothing ,
16
16
optionalAll ,
17
17
sequence ,
18
- sourceOnly ,
19
18
UnexpectedError ,
20
19
UnrecognizedError ,
21
20
} from "./parser_lib.ts" ;
@@ -43,9 +42,7 @@ import {
43
42
44
43
const spacesWithoutNewline = match ( / [ ^ \S \n ] * ?(? = \S | \r ? \n | $ ) / , "spaces" ) ;
45
44
const newline = match ( / \r ? \n \s * / , "newline" ) ;
46
- const spaces = sourceOnly (
47
- sequence ( spacesWithoutNewline , choice ( nothing , newline ) ) ,
48
- ) ;
45
+ const spaces = sequence ( spacesWithoutNewline , choice ( nothing , newline ) ) ;
49
46
const latinWord = match ( / [ a - z ] [ a - z A - Z ] * / , "word" ) . skip ( spaces ) ;
50
47
const variationSelector = match ( / [ \uFE00 - \uFE0F ] / , "variation selector" ) ;
51
48
const ucsur = match ( UCSUR_CHARACTER_REGEX , "UCSUR glyph" )
Original file line number Diff line number Diff line change @@ -276,9 +276,6 @@ export function withSource<T>(
276
276
} ) )
277
277
) ;
278
278
}
279
- export function sourceOnly ( parser : Parser < unknown > ) : Parser < string > {
280
- return withSource ( parser ) . map ( ( [ _ , source ] ) => source ) ;
281
- }
282
279
export class CheckedParser < T > {
283
280
constructor ( public check : Parser < unknown > , public parser : Parser < T > ) { }
284
281
map < U > ( mapper : ( value : T ) => U ) : CheckedParser < U > {
You can’t perform that action at this time.
0 commit comments