}
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);
%token _import_ "import"
%token _in_ "in"
%token _in__ "!in"
+%token _Infinity_ "Infinity"
%token _instanceof_ "instanceof"
%token _new_ "new"
%token _return_ "return"
: Word { $$ = $1; }
| "for" { $$ = CYNew CYWord("for"); }
| "in" { $$ = CYNew CYWord("in"); }
+ | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
| "instanceof" { $$ = CYNew CYWord("instanceof"); }
;
: NullLiteral { $$ = $1; }
| BooleanLiteral { $$ = $1; }
| NumericLiteral { $$ = $1; }
+ | "Infinity" { $$ = CYNew CYNumber(std::numeric_limits<double>::infinity()); }
| StringLiteral { $$ = $1; }
;
/* }}} */
"implements" L /*FSS*/ F(tk::_implements_, hi::Meta);
"import" L /*FFK*/ F(tk::_import_, hi::Meta);
"in" L /*KKK*/ F(yyextra->in_.top() ? tk::_in__ : tk::_in_, hi::Operator);
+"Infinity" L /*III*/ F(tk::_Infinity_, hi::Constant);
"instanceof" L /*KKK*/ F(tk::_instanceof_, hi::Operator);
"int" L /*FII*/ F(tk::_int_, hi::Type);
"interface" L /*FSS*/ F(tk::_interface_, hi::Meta);