public Parser(Scanner scanner, IErrorLogger errorLogger) { this.scanner = Utilities.ThrowIfNull(scanner, "scanner"); this.errorLogger = Utilities.ThrowIfNull(errorLogger, "errorLogger"); Consume(); }
public Scanner(string input, IErrorLogger errorLogger) { this.input = Utilities.ThrowIfNull(input, "input"); this.errorLogger = Utilities.ThrowIfNull(errorLogger, "errorLogger"); State = ScannerState.ScanningText; }
public string Evaluate(IFormatProvider formatProvider, ArgumentCollection arguments) { return (new Interpreter( formatProvider, Utilities.ThrowIfNull(arguments, "arguments"), SimpleErrorLogger.Instance).Evaluate( ast)); }
public ArgumentCollection(IEnumerable <Argument> arguments) { foreach (Argument argument in Utilities.ThrowIfNull(arguments, "arguments")) { Add(argument); } }
public static Format Parse(string format) { return (new Format( new Parser( new Scanner(Utilities.ThrowIfNull(format, "format"), SimpleErrorLogger.Instance), SimpleErrorLogger.Instance).Parse())); }
public int Compare(Location x, Location y) { Utilities.ThrowIfNull(x, "x"); Utilities.ThrowIfNull(y, "y"); if (x.Start < y.Start) { return(-1); } if (x.Start > y.Start) { return(1); } if (x.End < y.End) { return(-1); } return(x.End > y.End ? 1 : 0); }
public static bool IsValidIdentifier(string text) { Utilities.ThrowIfNull(text, "text"); if (text.Length == 0) { return(false); } if (!IsValidIdentifierStartCharacter(text[0])) { return(false); } for (int i = 1; i < text.Length; ++i) { if (!IsValidIdentifierCharacter(text, i)) { return(false); } } return(true); }
public static Location FromRange(IEnumerable <ILocated> items) { // ReSharper disable PossibleMultipleEnumeration Utilities.ThrowIfNull(items, "items"); // ReSharper restore PossibleMultipleEnumeration bool hasSomeItem = false; int start = int.MaxValue; int end = int.MinValue; // ReSharper disable PossibleMultipleEnumeration // ReSharper disable PossibleUnintendedReferenceComparison foreach (ILocated item in items.Where(x => x != null && x.Location != Unknown)) { hasSomeItem = true; start = Math.Min(start, item.Location.Start); end = Math.Max(end, item.Location.End); } // ReSharper restore PossibleUnintendedReferenceComparison // ReSharper restore PossibleMultipleEnumeration return(hasSomeItem ? new Location(start, end) : Unknown); }
public FormattingException(IEnumerable <Error> errors) : base("Format is invalid.") { Errors = new ReadOnlyCollection <Error>(new List <Error>(Utilities.ThrowIfNull(errors, "errors"))); }
public FormattingException(Error error) : this(Enumerable.Repeat(Utilities.ThrowIfNull(error, "error"), 1)) { }
public FormattingException(Location location, string description) : this( new Error( Utilities.ThrowIfNull(location, "location"), Utilities.ThrowIfNull(description, "description"))) { }
public int Compare(ILocated x, ILocated y) { return(Compare(Utilities.ThrowIfNull(x, "x").Location, Utilities.ThrowIfNull(y, "y").Location)); }
public void Add(string name, object value) { base.Add(new Argument(Utilities.ThrowIfNull(name, "name"), value)); }
public bool Remove(string name) { return(Remove(this[Utilities.ThrowIfNull(name, "name")])); }
public bool Contains(string name) { return(this[Utilities.ThrowIfNull(name, "name")] != null); }
public TokenInfo(Location location, int token, string text) { Location = Utilities.ThrowIfNull(location, "location"); Token = token; Text = Utilities.ThrowIfNull(text, "text"); }
public Interpreter(IFormatProvider formatProvider, ArgumentCollection arguments, IErrorLogger errorLogger) { this.formatProvider = formatProvider; this.arguments = Utilities.ThrowIfNull(arguments, "arguments"); this.errorLogger = Utilities.ThrowIfNull(errorLogger, "errorLogger"); }