File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change 1- using SER . Helpers . ResultSystem ;
2- using SER . ScriptSystem ;
1+ using SER . ScriptSystem ;
32using SER . ValueSystem ;
43
54namespace SER . TokenSystem . Tokens ;
@@ -8,27 +7,18 @@ public class NumberToken : LiteralValueToken<NumberValue>
87{
98 protected override IParseResult InternalParse ( Script scr )
109 {
11- if ( TryParse ( RawRep ) . WasSuccessful ( out var value ) )
10+ if ( decimal . TryParse ( RawRep , out var value ) )
1211 {
1312 Value = value ;
1413 return new Success ( ) ;
1514 }
1615
17- return new Ignore ( ) ;
18- }
19-
20- public static TryGet < decimal > TryParse ( string stringRep )
21- {
22- if ( decimal . TryParse ( stringRep , out var value ) )
16+ if ( RawRep . EndsWith ( "%" ) && decimal . TryParse ( RawRep . TrimEnd ( '%' ) , out value ) )
2317 {
24- return value ;
25- }
26-
27- if ( stringRep . EndsWith ( "%" ) && decimal . TryParse ( stringRep . TrimEnd ( '%' ) , out value ) )
28- {
29- return value / 100 ;
18+ Value = value / 100 ;
19+ return new Success ( ) ;
3020 }
3121
32- return $ "Value ' { stringRep } ' is not a valid number" ;
22+ return new Ignore ( ) ;
3323 }
3424}
You can’t perform that action at this time.
0 commit comments