File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,8 @@ export function parse(input: string) {
292292 } else {
293293 ast . push ( declaration )
294294 }
295+ } else {
296+ throw new Error ( `Invalid custom property, expected a value` )
295297 }
296298
297299 buffer = ''
@@ -345,6 +347,20 @@ export function parse(input: string) {
345347 } else {
346348 ast . push ( declaration )
347349 }
350+ } else if ( input . charCodeAt ( i - 1 ) === SEMICOLON || input . charCodeAt ( i + 1 ) === SEMICOLON ) {
351+ let startSemiColonIdx = i
352+ while ( input . charCodeAt ( startSemiColonIdx - 1 ) === SEMICOLON ) {
353+ startSemiColonIdx --
354+ }
355+ let endSemiColonIdx = i
356+ while ( input . charCodeAt ( endSemiColonIdx ) === SEMICOLON ) {
357+ endSemiColonIdx ++
358+ }
359+ throw new Error ( `Unexpected: \`${ input . slice ( startSemiColonIdx , endSemiColonIdx ) } \`` )
360+ } else if ( buffer . length == 0 ) {
361+ throw new Error ( 'Unexpected semicolon' )
362+ } else {
363+ throw new Error ( `Invalid declaration: \`${ buffer . trim ( ) } \`` )
348364 }
349365
350366 buffer = ''
@@ -442,6 +458,8 @@ export function parse(input: string) {
442458 let node = parseDeclaration ( buffer , colonIdx )
443459 if ( node ) {
444460 parent . nodes . push ( node )
461+ } else {
462+ throw new Error ( `Invalid declaration: \`${ buffer . trim ( ) } \`` )
445463 }
446464 }
447465 }
You can’t perform that action at this time.
0 commit comments