@@ -31,21 +31,17 @@ export function parseExpression(
3131 | CST . ReservedAnnotation
3232 | CST . Junk
3333 | undefined ;
34- let markup : CST . Markup | CST . MarkupClose | undefined ;
34+ let markup : CST . Markup | undefined ;
3535 let junkError : MessageSyntaxError | undefined ;
3636 switch ( source [ pos ] ) {
3737 case ':' :
3838 annotation = parseFunctionRefOrMarkup ( ctx , pos , 'function' ) ;
3939 pos = annotation . end ;
4040 break ;
4141 case '#' :
42- if ( arg ) ctx . onError ( 'extra-content' , arg . start , arg . end ) ;
43- markup = parseFunctionRefOrMarkup ( ctx , pos , 'markup' ) ;
44- pos = markup . end ;
45- break ;
4642 case '/' :
4743 if ( arg ) ctx . onError ( 'extra-content' , arg . start , arg . end ) ;
48- markup = parseMarkupClose ( ctx , pos ) ;
44+ markup = parseFunctionRefOrMarkup ( ctx , pos , 'markup' ) ;
4945 pos = markup . end ;
5046 break ;
5147 case '!' :
@@ -140,7 +136,7 @@ function parseFunctionRefOrMarkup(
140136 let ws = whitespaces ( source , pos ) ;
141137 const next = source [ pos + ws ] ;
142138 if ( next === '@' || next === '}' ) break ;
143- if ( type === 'markup ' && next === '/ ' ) {
139+ if ( next === '/ ' && source [ start ] === '# ' ) {
144140 pos += ws + 1 ;
145141 close = { start : pos - 1 , end : pos , value : '/' } ;
146142 ws = whitespaces ( source , pos ) ;
@@ -158,17 +154,11 @@ function parseFunctionRefOrMarkup(
158154 const open = { start, end : start + 1 , value : ':' as const } ;
159155 return { type, start, end : pos , open, name : id . parts , options } ;
160156 } else {
161- const open = { start, end : start + 1 , value : '#' as const } ;
157+ const open = { start, end : start + 1 , value : source [ start ] as '#' | '/' } ;
162158 return { type, start, end : pos , open, name : id . parts , options, close } ;
163159 }
164160}
165161
166- function parseMarkupClose ( ctx : ParseContext , start : number ) : CST . MarkupClose {
167- const id = parseIdentifier ( ctx , start + 1 ) ;
168- const open = { start, end : start + 1 , value : '/' as const } ;
169- return { type : 'markup-close' , start, end : id . end , open, name : id . parts } ;
170- }
171-
172162function parseOption ( ctx : ParseContext , start : number ) : CST . Option {
173163 const id = parseIdentifier ( ctx , start ) ;
174164 let pos = id . end ;
0 commit comments