public static Info Parse(CharStream stream, Info expected = null) { string output; int pos = stream.Position; if (!stream.ReadReg("(\'|\")", out output)) { throw new Exceptions.ParseException( String.Format( "expected to read a <quote> (starting at {0}), but no characters were left", stream.ComputeDetailedPosition(pos))); } Info info; if (output[0] == '"') { info = new Info(Type.Double); } else { info = new Info(Type.Single); } if (expected != null && expected.CompareTo(info) != 0) { throw new Exceptions.ParseException( String.Format( "expected to read {0} (starting at {1}), but found {2}", expected.ToString(), stream.ComputeDetailedPosition(pos), info.ToString())); } return info; }