private static ICharacterSource ResolveSource(Resolver resolver, string parent, ICharacterSource source) { try { return(new StringSource("&<resolved>", resolver(parent, source.Build()))); } catch (KeyNotFoundException) { throw new SourceError(source, "Name could not be resolved."); } }
public LiteralExpression(ICharacterSource value) { var str = value.Build(); if (str.Length > 2 && str.ToLower().StartsWith("0x") && long.TryParse(str.Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out long hexValue)) { Value = hexValue; } else if (long.TryParse(str, out long decimalValue)) { Value = decimalValue; } else { throw new SourceError(value, "Invalid literal."); } }