**/
/* }}} */
-#include <dlfcn.h>
-
#include "cycript.hpp"
-#include "Pooling.hpp"
-
-#include <sys/mman.h>
-
#include <iostream>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
-#include "Error.hpp"
-#include "Execute.hpp"
-#include "Parser.hpp"
-#include "String.hpp"
+#include <dlfcn.h>
-#include "Cycript.tab.hh"
-#include "Driver.hpp"
+#include <sys/mman.h>
#include "ConvertUTF.h"
+#include "Driver.hpp"
+#include "Error.hpp"
+#include "Execute.hpp"
+#include "Pooling.hpp"
+#include "String.hpp"
+#include "Syntax.hpp"
template <>
::pthread_key_t CYLocal<CYPool>::key_ = Key_();
}
void CYNumerify(std::ostringstream &str, double value) {
+ if (std::isinf(value)) {
+ if (value < 0)
+ str << '-';
+ str << "Infinity";
+ return;
+ }
+
char string[32];
// XXX: I want this to print 1e3 rather than 1000
sprintf(string, "%.17g", value);
return CYCastDouble(value, strlen(value));
}
+_visible bool CYStartsWith(const CYUTF8String &haystack, const CYUTF8String &needle) {
+ return haystack.size >= needle.size && strncmp(haystack.data, needle.data, needle.size) == 0;
+}
+
CYUTF8String CYPoolCode(CYPool &pool, std::istream &stream) {
CYLocalPool local;
CYDriver driver(local, stream);
-
- cy::parser parser(driver);
- _assert(parser.parse() == 0);
+ _assert(!driver.Parse());
_assert(driver.errors_.empty());
CYOptions options;