@@ -84,12 +84,12 @@ public static class NumberParser
8484 /// <summary>
8585 /// Parses the natural integer (int) value.
8686 /// </summary>
87- public static Int32 ? ParseNaturalInteger ( this StringSource source )
87+ public static CssIntegerValue ? ParseNaturalInteger ( this StringSource source )
8888 {
8989 var pos = source . Index ;
9090 var element = source . ParseInteger ( ) ;
9191
92- if ( element . HasValue && element . Value >= 0 )
92+ if ( element . HasValue && element . Value . IntValue >= 0 )
9393 {
9494 return element ;
9595 }
@@ -101,12 +101,12 @@ public static class NumberParser
101101 /// <summary>
102102 /// Parses the positive integer (int) value.
103103 /// </summary>
104- public static Int32 ? ParsePositiveInteger ( this StringSource source )
104+ public static CssIntegerValue ? ParsePositiveInteger ( this StringSource source )
105105 {
106106 var pos = source . Index ;
107107 var element = source . ParseInteger ( ) ;
108108
109- if ( element . HasValue && element . Value > 0 )
109+ if ( element . HasValue && element . Value . IntValue > 0 )
110110 {
111111 return element ;
112112 }
@@ -118,12 +118,12 @@ public static class NumberParser
118118 /// <summary>
119119 /// Parses the weight (int) value.
120120 /// </summary>
121- public static Int32 ? ParseWeightInteger ( this StringSource source )
121+ public static CssIntegerValue ? ParseWeightInteger ( this StringSource source )
122122 {
123123 var pos = source . Index ;
124124 var element = source . ParsePositiveInteger ( ) ;
125125
126- if ( element . HasValue && IsWeight ( element . Value ) )
126+ if ( element . HasValue && IsWeight ( element . Value . IntValue ) )
127127 {
128128 return element ;
129129 }
@@ -135,14 +135,19 @@ public static class NumberParser
135135 /// <summary>
136136 /// Parses the binary (int) value.
137137 /// </summary>
138- public static Int32 ? ParseBinary ( this StringSource source )
138+ public static CssIntegerValue ? ParseBinary ( this StringSource source )
139139 {
140140 var pos = source . Index ;
141141 var element = source . ParseInteger ( ) ;
142142
143- if ( element . HasValue && ( element . Value == 0 || element . Value == 1 ) )
143+ if ( element . HasValue )
144144 {
145- return element ;
145+ var val = element . Value . IntValue ;
146+
147+ if ( val == 0 || val == 1 )
148+ {
149+ return element ;
150+ }
146151 }
147152
148153 source . BackTo ( pos ) ;
@@ -152,7 +157,7 @@ public static class NumberParser
152157 /// <summary>
153158 /// Parses the integer (int) value.
154159 /// </summary>
155- public static Int32 ? ParseInteger ( this StringSource source )
160+ public static CssIntegerValue ? ParseInteger ( this StringSource source )
156161 {
157162 var unit = source . ParseUnit ( ) ;
158163
@@ -162,15 +167,15 @@ public static class NumberParser
162167
163168 if ( Int32 . TryParse ( value , NumberStyles . Integer , CultureInfo . InvariantCulture , out var result ) )
164169 {
165- return result ;
170+ return new CssIntegerValue ( result ) ;
166171 }
167172
168173 var negative = value . StartsWith ( "-" ) ;
169174 var allNumbers = ( negative ? value . Substring ( 1 ) : value ) . All ( m => m . IsDigit ( ) ) ;
170175
171176 if ( allNumbers )
172177 {
173- return negative ? Int32 . MinValue : Int32 . MaxValue ;
178+ return new CssIntegerValue ( negative ? Int32 . MinValue : Int32 . MaxValue ) ;
174179 }
175180 }
176181
0 commit comments