-/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2015 Jay Freeman (saurik)
+/* Cycript - The Truly Universal Scripting Language
+ * Copyright (C) 2009-2016 Jay Freeman (saurik)
#define YY_EXTRA_TYPE CYDriver *
#define F(value, highlight) do { \
#define YY_EXTRA_TYPE CYDriver *
#define F(value, highlight) do { \
yyextra->last_ = false; \
F(tk::NewLine, hi::Nothing); \
}
yyextra->last_ = false; \
F(tk::NewLine, hi::Nothing); \
}
I(type, Type(P.strmemdup(yyextra->buffer_.data(), yyextra->buffer_.size()), yyextra->buffer_.size()), value, highlight); \
} while (false)
I(type, Type(P.strmemdup(yyextra->buffer_.data(), yyextra->buffer_.size()), yyextra->buffer_.size()), value, highlight); \
} while (false)
-#define YY_INPUT(data, value, size) { \
- if (yyextra->data_.eof()) \
- value = YY_NULL; \
- else { \
- yyextra->data_.read(data, size); \
- size_t copy(yyextra->data_.gcount()); \
- value = copy == 0 ? YY_NULL : copy; \
- } \
-}
+#define YY_INPUT(data, value, size) do { \
+ value = yyextra->data_.sgetn(data, size) ?: YY_NULL; \
+} while (false)
- \/{UnicodePart}* R CYLexBufferUnits(yytext, yyleng); CYLexBufferEnd(literal, RegEx, tk::RegularExpressionLiteral, hi::Constant);
+ \/{UnicodePart}* R CYLexBufferUnits(yytext, yyleng); CYLexBufferEnd(literal, RegEx, tk::RegularExpressionLiteral_, hi::Constant);
\/{UnicodePart}*{UnicodeError} R E("invalid character");
{RegExCharacter}+ R CYLexBufferUnits(yytext, yyleng);
\/{UnicodePart}*{UnicodeError} R E("invalid character");
{RegExCharacter}+ R CYLexBufferUnits(yytext, yyleng);
".." L F(tk::PeriodPeriod, hi::Operator);
@end
@begin E4X ObjectiveC
"@" L F(tk::At, hi::Operator);
".." L F(tk::PeriodPeriod, hi::Operator);
@end
@begin E4X ObjectiveC
"@" L F(tk::At, hi::Operator);
"=" L F(tk::Equal, hi::Operator);
"==" L F(tk::EqualEqual, hi::Operator);
"===" L F(tk::EqualEqualEqual, hi::Operator);
"=" L F(tk::Equal, hi::Operator);
"==" L F(tk::EqualEqual, hi::Operator);
"===" L F(tk::EqualEqualEqual, hi::Operator);
"!" L F(tk::Exclamation, hi::Operator);
"!=" L F(tk::ExclamationEqual, hi::Operator);
"!==" L F(tk::ExclamationEqualEqual, hi::Operator);
"-" L F(tk::Hyphen, hi::Operator);
"-=" L F(tk::HyphenEqual, hi::Operator);
"!" L F(tk::Exclamation, hi::Operator);
"!=" L F(tk::ExclamationEqual, hi::Operator);
"!==" L F(tk::ExclamationEqualEqual, hi::Operator);
"-" L F(tk::Hyphen, hi::Operator);
"-=" L F(tk::HyphenEqual, hi::Operator);
"->" L F(tk::HyphenRight, hi::Operator);
"<" L F(tk::Left, hi::Operator);
"<=" L F(tk::LeftEqual, hi::Operator);
"->" L F(tk::HyphenRight, hi::Operator);
"<" L F(tk::Left, hi::Operator);
"<=" L F(tk::LeftEqual, hi::Operator);
"%" L F(tk::Percent, hi::Operator);
"%=" L F(tk::PercentEqual, hi::Operator);
"." L F(tk::Period, hi::Operator);
"%" L F(tk::Percent, hi::Operator);
"%=" L F(tk::PercentEqual, hi::Operator);
"." L F(tk::Period, hi::Operator);
"|" L F(tk::Pipe, hi::Operator);
"|=" L F(tk::PipeEqual, hi::Operator);
"||" L F(tk::PipePipe, hi::Operator);
"+" L F(tk::Plus, hi::Operator);
"+=" L F(tk::PlusEqual, hi::Operator);
"|" L F(tk::Pipe, hi::Operator);
"|=" L F(tk::PipeEqual, hi::Operator);
"||" L F(tk::PipePipe, hi::Operator);
"+" L F(tk::Plus, hi::Operator);
"+=" L F(tk::PlusEqual, hi::Operator);
">" L F(tk::Right, hi::Operator);
">=" L F(tk::RightEqual, hi::Operator);
">>" L F(tk::RightRight, hi::Operator);
">" L F(tk::Right, hi::Operator);
">=" L F(tk::RightEqual, hi::Operator);
">>" L F(tk::RightRight, hi::Operator);
"/=" L F(tk::SlashEqual, hi::Operator);
":" L F(tk::Colon, hi::Structure);
"/=" L F(tk::SlashEqual, hi::Operator);
":" L F(tk::Colon, hi::Structure);
"," L F(tk::Comma, hi::Structure);
"?" L F(tk::Question, hi::Structure);
";" L F(tk::SemiColon, hi::Structure);
"," L F(tk::Comma, hi::Structure);
"?" L F(tk::Question, hi::Structure);
";" L F(tk::SemiColon, hi::Structure);
"(" L F(tk::OpenParen, hi::Structure);
")" L F(tk::CloseParen, hi::Structure);
"(" L F(tk::OpenParen, hi::Structure);
")" L F(tk::CloseParen, hi::Structure);
<Div>"}" L S(template_); F(tk::CloseBrace, hi::Structure);
"[" L F(tk::OpenBracket, hi::Structure);
<Div>"}" L S(template_); F(tk::CloseBrace, hi::Structure);
"[" L F(tk::OpenBracket, hi::Structure);
"await" L /*II?*/ F(tk::_await_, hi::Meta);
"boolean" L /*FII*/ F(tk::_boolean_, hi::Type);
"break" L /*KKK*/ F(tk::_break_, hi::Control);
"await" L /*II?*/ F(tk::_await_, hi::Meta);
"boolean" L /*FII*/ F(tk::_boolean_, hi::Type);
"break" L /*KKK*/ F(tk::_break_, hi::Control);
"if" L /*KKK*/ F(tk::_if_, hi::Control);
"implements" L /*FSS*/ F(tk::_implements_, hi::Meta);
"import" L /*FFK*/ F(tk::_import_, hi::Meta);
"if" L /*KKK*/ F(tk::_if_, hi::Control);
"implements" L /*FSS*/ F(tk::_implements_, hi::Meta);
"import" L /*FFK*/ F(tk::_import_, hi::Meta);
"Infinity" L /*III*/ F(tk::_Infinity_, hi::Constant);
"instanceof" L /*KKK*/ F(tk::_instanceof_, hi::Operator);
"int" L /*FII*/ F(tk::_int_, hi::Type);
"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);
"let" L /*IS?*/ F(tk::_let_, hi::Meta);
"long" L /*FII*/ F(tk::_long_, hi::Type);
"interface" L /*FSS*/ F(tk::_interface_, hi::Meta);
"let" L /*IS?*/ F(tk::_let_, hi::Meta);
"long" L /*FII*/ F(tk::_long_, hi::Type);
"package" L /*FSS*/ F(tk::_package_, hi::Meta);
"private" L /*FSS*/ F(tk::_private_, hi::Meta);
"protected" L /*FSS*/ F(tk::_protected_, hi::Meta);
"package" L /*FSS*/ F(tk::_package_, hi::Meta);
"private" L /*FSS*/ F(tk::_private_, hi::Meta);
"protected" L /*FSS*/ F(tk::_protected_, hi::Meta);
"prototype" L /*III*/ F(tk::_prototype_, hi::Special);
"public" L /*FSS*/ F(tk::_public_, hi::Meta);
"prototype" L /*III*/ F(tk::_prototype_, hi::Special);
"public" L /*FSS*/ F(tk::_public_, hi::Meta);
"set" L /*III*/ F(tk::_set_, hi::Meta);
"short" L /*FII*/ F(tk::_short_, hi::Type);
"static" L /*FS?*/ F(tk::_static_, hi::Meta);
"set" L /*III*/ F(tk::_set_, hi::Meta);
"short" L /*FII*/ F(tk::_short_, hi::Type);
"static" L /*FS?*/ F(tk::_static_, hi::Meta);
"switch" L /*KKK*/ F(tk::_switch_, hi::Control);
"synchronized" L /*FII*/ F(tk::_synchronized_, hi::Meta);
"switch" L /*KKK*/ F(tk::_switch_, hi::Control);
"synchronized" L /*FII*/ F(tk::_synchronized_, hi::Meta);
"this" L /*KKK*/ F(tk::_this_, hi::Constant);
"throw" L /*KKK*/ F(tk::_throw_, hi::Control);
"throws" L /*FII*/ F(tk::_throws_, hi::Meta);
"transient" L /*FII*/ F(tk::_transient_, hi::Meta);
"true" L /*LLL*/ F(tk::_true_, hi::Constant);
"try" L /*KKK*/ F(tk::_try_, hi::Control);
"this" L /*KKK*/ F(tk::_this_, hi::Constant);
"throw" L /*KKK*/ F(tk::_throw_, hi::Control);
"throws" L /*FII*/ F(tk::_throws_, hi::Meta);
"transient" L /*FII*/ F(tk::_transient_, hi::Meta);
"true" L /*LLL*/ F(tk::_true_, hi::Constant);
"try" L /*KKK*/ F(tk::_try_, hi::Control);
"typeof" L /*KKK*/ F(tk::_typeof_, hi::Operator);
"var" L /*KKK*/ F(tk::_var_, hi::Meta);
"void" L /*KKK*/ F(tk::_void_, hi::Operator);
"volatile" L /*FII*/ F(tk::_volatile_, hi::Meta);
"while" L /*KKK*/ F(tk::_while_, hi::Control);
"with" L /*KKK*/ F(tk::_with_, hi::Control);
"typeof" L /*KKK*/ F(tk::_typeof_, hi::Operator);
"var" L /*KKK*/ F(tk::_var_, hi::Meta);
"void" L /*KKK*/ F(tk::_void_, hi::Operator);
"volatile" L /*FII*/ F(tk::_volatile_, hi::Meta);
"while" L /*KKK*/ F(tk::_while_, hi::Control);
"with" L /*KKK*/ F(tk::_with_, hi::Control);
"each" L F(tk::_each_, hi::Control);
"of" L F(tk::_of_, hi::Operator);
@begin C
"extern" L F(tk::_extern_, hi::Type);
"signed" L F(tk::_signed_, hi::Type);
"each" L F(tk::_each_, hi::Control);
"of" L F(tk::_of_, hi::Operator);
@begin C
"extern" L F(tk::_extern_, hi::Type);
"signed" L F(tk::_signed_, hi::Type);
"typedef" L F(tk::_typedef_, hi::Meta);
"unsigned" L F(tk::_unsigned_, hi::Type);
@end
"typedef" L F(tk::_typedef_, hi::Meta);
"unsigned" L F(tk::_unsigned_, hi::Type);
@end
"$" R CYLexBufferUnit('$');
{PlateCharacter}+ R CYLexBufferUnits(yytext, yyleng);
"$" R CYLexBufferUnit('$');
{PlateCharacter}+ R CYLexBufferUnits(yytext, yyleng);