@@ -14,7 +14,7 @@ public class BaseToken
1414 protected Slice Slice { get ; private set ; } = null ! ;
1515 public Script Script { get ; private set ; } = null ! ;
1616 protected uint ? LineNum { get ; private set ; } = null ;
17-
17+
1818 public IParseResult TryInit ( Slice slice , Script script , uint ? lineNum )
1919 {
2020 RawRep = slice . RawRep ;
@@ -25,17 +25,17 @@ public IParseResult TryInit(Slice slice, Script script, uint? lineNum)
2525 }
2626
2727 public interface IParseResult ;
28-
28+
2929 /// <summary>
3030 /// Used when the token is successfully parsed.
3131 /// </summary>
3232 public record struct Success : IParseResult ;
33-
33+
3434 /// <summary>
3535 /// Used when the input was never intended to be this token. This will allow a different token to be parsed.
3636 /// </summary>
3737 public record struct Ignore : IParseResult ;
38-
38+
3939 /// <summary>
4040 /// Used when there was a clear intent of using this token, but parsing still failed. This will cause a compile error.
4141 /// </summary>
@@ -45,11 +45,11 @@ protected virtual IParseResult InternalParse(Script scr)
4545 {
4646 return new Success ( ) ;
4747 }
48-
48+
4949 public string BestStaticTextRepr ( ) => InternalBestTextExpr ( ) . Value ;
50-
50+
5151 public DynamicGet < string > BestTextRepr ( ) => InternalBestTextExpr ( ) ;
52-
52+
5353 public DynamicGet < string > InternalBestTextExpr ( )
5454 {
5555 // ReSharper disable once ConvertIfStatementToSwitchStatement
@@ -59,7 +59,7 @@ public DynamicGet<string> InternalBestTextExpr()
5959 {
6060 return new ( ( ) => textToken . Value ) ;
6161 }
62-
62+
6363 return textToken . Value . Value ;
6464 }
6565
@@ -72,7 +72,7 @@ public DynamicGet<string> InternalBestTextExpr()
7272 {
7373 return func ( ) . WasSuccessful ( out var value ) ? value . StringRep : RawRep ;
7474 }
75-
75+
7676 return new ( ( ) => func ( ) . WasSuccessful ( out var value ) ? value . StringRep : RawRep ) ;
7777 }
7878
@@ -92,12 +92,12 @@ public static TryGet<T> TryParse<T>(string rawRep, Script? scr) where T : BaseTo
9292 {
9393 return $ "Value '{ rawRep } ' cannot represent a single { typeof ( T ) . FriendlyTypeName ( ) } ";
9494 }
95-
96- if ( tokens . First ( ) . TryCast < T > ( rawRep ) . HasErrored ( out error , out var tToken ) )
95+
96+ if ( tokens [ 0 ] . TryCast < T > ( rawRep ) . HasErrored ( out error , out var tToken ) )
9797 {
9898 return error ;
9999 }
100100
101101 return tToken ;
102102 }
103- }
103+ }
0 commit comments