@@ -52,13 +52,16 @@ export function parseCST(
5252) : CST . Message {
5353 const ctx = new ParseContext ( source , opt ) ;
5454
55- if ( source . startsWith ( '.' ) ) {
56- const { declarations, end : pos } = parseDeclarations ( ctx ) ;
57- return source . startsWith ( '.match' , pos )
58- ? parseSelectMessage ( ctx , pos , declarations )
59- : parsePatternMessage ( ctx , pos , declarations , true ) ;
55+ const pos = whitespaces ( source , 0 ) ;
56+ if ( source . startsWith ( '.' , pos ) ) {
57+ const { declarations, end } = parseDeclarations ( ctx , pos ) ;
58+ return source . startsWith ( '.match' , end )
59+ ? parseSelectMessage ( ctx , end , declarations )
60+ : parsePatternMessage ( ctx , end , declarations , true ) ;
6061 } else {
61- return parsePatternMessage ( ctx , 0 , [ ] , source . startsWith ( '{{' ) ) ;
62+ return source . startsWith ( '{{' , pos )
63+ ? parsePatternMessage ( ctx , pos , [ ] , true )
64+ : parsePatternMessage ( ctx , 0 , [ ] , false ) ;
6265 }
6366}
6467
@@ -95,7 +98,7 @@ function parseSelectMessage(
9598 const sel = parseExpression ( ctx , pos ) ;
9699 const body = sel . markup ?? sel . annotation ;
97100 if ( body && body . type !== 'function' ) {
98- ctx . onError ( 'bad-selector ' , body . start , body . end ) ;
101+ ctx . onError ( 'parse-error ' , body . start , body . end ) ;
99102 }
100103 selectors . push ( sel ) ;
101104 pos = sel . end ;
0 commit comments