internal string GetJunction(TokenBounds bounds) { if (bounds.End - bounds.Start == 3) { var substring = UnparsedFormula.Substring(bounds.Start, 3); if (substring.Equals(Junctions.Imp)) { return(Junctions.Imp); } if (substring.Equals(Junctions.And)) { return(Junctions.And); } if (substring.Equals(Junctions.Ekv)) { return(Junctions.Ekv); } if (substring.Equals(Junctions.Not)) { return(Junctions.Not); } } if (bounds.End - bounds.Start == 2) { var substring = UnparsedFormula.Substring(bounds.Start, 2); if (substring.Equals(Junctions.Or)) { return(Junctions.Or); } } throw new ParseException($"Token starting with uppercase symbol at index {bounds.Start} of {UnparsedFormula} was not recognized as junction."); }
internal TokenFactory(string unparsedFormula, TokenBounds bounds) { UnparsedFormula = unparsedFormula; Bounds = bounds; }
internal char GetChar(TokenBounds bounds) { return(UnparsedFormula[bounds.Start]); }
internal TokenFactory GetNewBounds(TokenBounds bounds) { return(new TokenFactory(UnparsedFormula, bounds)); }
internal TokenFactory(string unparsedFormula) { UnparsedFormula = unparsedFormula; Bounds = new TokenBounds(0, unparsedFormula.Length); }