@@ -316,6 +316,9 @@ private static Unit UnitStart(StringSource source)
316316 return null ;
317317 }
318318
319+ private static Boolean IsDimension ( StringSource source , Char current ) =>
320+ current != 'e' && current != 'E' && ( current . IsNameStart ( ) || source . IsValidEscape ( ) ) ;
321+
319322 private static Unit UnitRest ( StringSource source , StringBuilder buffer )
320323 {
321324 var current = source . Next ( ) ;
@@ -326,7 +329,7 @@ private static Unit UnitRest(StringSource source, StringBuilder buffer)
326329 {
327330 buffer . Append ( current ) ;
328331 }
329- else if ( current . IsNameStart ( ) || source . IsValidEscape ( ) )
332+ else if ( IsDimension ( source , current ) )
330333 {
331334 var number = buffer . ToString ( ) ;
332335 return Dimension ( source , number , buffer . Clear ( ) ) ;
@@ -378,7 +381,7 @@ private static Unit UnitFraction(StringSource source, StringBuilder buffer)
378381 {
379382 buffer . Append ( current ) ;
380383 }
381- else if ( current . IsNameStart ( ) || source . IsValidEscape ( ) )
384+ else if ( IsDimension ( source , current ) )
382385 {
383386 var number = buffer . ToString ( ) ;
384387 return Dimension ( source , number , buffer . Clear ( ) ) ;
@@ -421,7 +424,7 @@ private static Unit Dimension(StringSource source, String number, StringBuilder
421424 }
422425 else if ( source . IsValidEscape ( ) )
423426 {
424- current = source . Next ( ) ;
427+ source . Next ( ) ;
425428 buffer . Append ( source . ConsumeEscape ( ) ) ;
426429 }
427430 else
@@ -443,6 +446,11 @@ private static Unit SciNotation(StringSource source, StringBuilder buffer)
443446 {
444447 buffer . Append ( current ) ;
445448 }
449+ else if ( current . IsNameStart ( ) || source . IsValidEscape ( ) )
450+ {
451+ var number = buffer . ToString ( ) ;
452+ return Dimension ( source , number , buffer . Clear ( ) ) ;
453+ }
446454 else
447455 {
448456 return new Unit ( buffer . ToPool ( ) , String . Empty ) ;
0 commit comments