/// <summary> /// A parser which parses a floating point number without a sign. /// The resulting <c>double</c> is not checked for overflow. /// </summary> /// <returns>A parser which parses a floating point number without a sign.</returns> public static Parser <char, double> UnsignedReal() => Map( (integerPart, _, decimalPart) => integerPart.HasValue ? integerPart.Value + decimalPart : decimalPart, UnsignedInt(10).Optional(), Char('.'), DigitCharDouble().ChainAtLeastOnceL( () => { var sb = new PooledList <char>(); sb.Add('.'); return(sb); }, (sb, c) => { sb.Add(c); return(sb); } ).Select(sb => { ReadOnlySpan <char> csp = sb.AsSpan(); double x = 0.0; x = Double.Parse(csp.ToString(), System.Globalization.NumberStyles.Float); sb.Clear(); return(x); } ) );
public void AddExpected(Expected <TToken> expected) { _expecteds.Add(expected); }
public void BeginExpectedTran() { _expectedBookmarks.Add(_expecteds.Count); }
public void Apply(T value) { _list.Add(value); }
public void PushBookmark() { _bookmarks.Add(Location); }