@@ -29,7 +29,7 @@ export function parse(content: string) {
2929
3030 const options : Option [ ] = [ ] ;
3131 const succeeds = new Set < number > ( ) ;
32- const errors : Array < { name : string ; start : number } > = [ ] ;
32+ const errors : Array < { name : string ; start : number ; block : string } > = [ ] ;
3333 let last = - 1 ;
3434 for ( const match of content . matchAll ( / \* ' ( \w + ) ' \* / g) ) {
3535 const name = match [ 1 ] ;
@@ -45,17 +45,20 @@ export function parse(content: string) {
4545 succeeds . add ( start ) ;
4646 last = end ;
4747 } else {
48- errors . push ( { name, start } ) ;
48+ errors . push ( { name, start, block } ) ;
4949 }
5050 }
5151
5252 if ( errors . length ) {
53- for ( const { name, start } of errors ) {
53+ for ( const { name, start, block } of errors ) {
5454 if ( ! succeeds . has ( start ) ) {
5555 const line = content . substring ( 0 , start + 1 ) . split ( "\n" ) . length ;
5656 console . error (
57- `Failed to parse option definition for ${ name } at line ${ line } ` ,
57+ `Failed to parse option definition for ' ${ name } ' at line ${ line } : ` ,
5858 ) ;
59+ console . error ( "----- block start -----" ) ;
60+ console . error ( block ) ;
61+ console . error ( "----- block end -----" ) ;
5962 }
6063 }
6164 }
@@ -107,7 +110,8 @@ function parseBlock(name: string, body: string): Option | undefined {
107110 const reTags = / (?: [ \t ] + \* [ ^ * \s ] + \* ) + [ \t ] * $ / . source ;
108111 const reShortNames = / (?: [ \t ] + ' \w + ' ) * / . source ;
109112 const reType = / [ \t ] + (?< type > \w + ) / . source ;
110- const reDefaults = / [ \t ] + (?< defaults > \( .* ?(?: \n \t { 3 , } [ \t ] .* ?) * ?\) ) / . source ;
113+ const reDefaults =
114+ / [ \t ] + (?< defaults > \( .* ?(?: \n (?: \t { 3 , } | { 24 , } ) [ \t ] .* ?) * ?\) ) / . source ;
111115 const reDefinition =
112116 `^'${ name } '${ reShortNames } (?:${ reType } (?:${ reDefaults } )?)?(?:${ reTags } )?$` ;
113117 const m1 = body . match ( new RegExp ( reDefinition , "dm" ) ) ;
0 commit comments