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> {
3434const comment = checkedSequence (
3535 matchString ( "#" , "hash sign" ) ,
3636 match ( / [ ^ \n ] * ?(? = \r ? \n ) / , "comment content" ) ,
37- )
38- . map ( ( ) => null ) ;
37+ ) ;
3938const spaces = checkedSequence (
4039 match ( / \s / , "space" ) ,
4140 match ( / \s * / , "space" ) ,
42- )
43- . map ( ( ) => null ) ;
41+ ) ;
4442const ignore = allWithCheck (
4543 new CheckedParser (
4644 choiceOnlyOne ( comment . check , spaces . check ) ,
4745 choiceWithCheck ( spaces , comment ) ,
4846 ) ,
49- )
50- . map ( ( ) => null ) ;
47+ ) ;
5148const backtick = matchString ( "`" , "backtick" ) ;
5249const colon = matchString ( ":" , "colon" ) ;
5350const character = match ( / ./ u, "character" ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import {
1515 nothing ,
1616 optionalAll ,
1717 sequence ,
18- sourceOnly ,
1918 UnexpectedError ,
2019 UnrecognizedError ,
2120} from "./parser_lib.ts" ;
@@ -43,9 +42,7 @@ import {
4342
4443const spacesWithoutNewline = match ( / [ ^ \S \n ] * ?(? = \S | \r ? \n | $ ) / , "spaces" ) ;
4544const 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 ) ) ;
4946const latinWord = match ( / [ a - z ] [ a - z A - Z ] * / , "word" ) . skip ( spaces ) ;
5047const variationSelector = match ( / [ \uFE00 - \uFE0F ] / , "variation selector" ) ;
5148const 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>(
276276 } ) )
277277 ) ;
278278}
279- export function sourceOnly ( parser : Parser < unknown > ) : Parser < string > {
280- return withSource ( parser ) . map ( ( [ _ , source ] ) => source ) ;
281- }
282279export class CheckedParser < T > {
283280 constructor ( public check : Parser < unknown > , public parser : Parser < T > ) { }
284281 map < U > ( mapper : ( value : T ) => U ) : CheckedParser < U > {
You can’t perform that action at this time.
0 commit comments