X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/72b2086fb92dfcc524adc4749395c1e06b2594ac..37dadc219da7f34c243c5c76c2eff2d3fa1f1051:/Scanner.lpp.in diff --git a/Scanner.lpp.in b/Scanner.lpp.in index 518b6b4..d9614df 100644 --- a/Scanner.lpp.in +++ b/Scanner.lpp.in @@ -1,5 +1,5 @@ -/* 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) */ /* GNU Affero General Public License, Version 3 {{{ */ @@ -184,15 +184,9 @@ static unsigned U(char *&local, const char *text, yy_size_t &i) { 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) %} @@ -346,13 +340,11 @@ XMLName {XMLNameStart}{XMLNamePart}* ".." L E("invalid operator") @begin E4X -"::" L F(tk::ColonColon, hi::Operator); ".." L F(tk::PeriodPeriod, hi::Operator); @end @begin E4X ObjectiveC "@" L F(tk::At, hi::Operator); -"#" L F(tk::Pound, hi::Operator); @end "&" L F(tk::Ampersand, hi::Operator); @@ -398,9 +390,11 @@ XMLName {XMLNameStart}{XMLNamePart}* "/=" L F(tk::SlashEqual, hi::Operator); ":" L F(tk::Colon, hi::Structure); +"::" L F(tk::ColonColon, hi::Structure); "," L F(tk::Comma, hi::Structure); "?" L F(tk::Question, hi::Structure); ";" L F(tk::SemiColon, hi::Structure); +"#" L F(tk::Pound, hi::Operator); "(" L F(tk::OpenParen, hi::Structure); ")" L F(tk::CloseParen, hi::Structure); @@ -450,6 +444,7 @@ XMLName {XMLNameStart}{XMLNamePart}* /* }}} */ /* Reserved {{{ */ "abstract" L /*FII*/ F(tk::_abstract_, hi::Meta); +"as" L /*III*/ F(tk::_as_, hi::Meta); "await" L /*II?*/ F(tk::_await_, hi::Meta); "boolean" L /*FII*/ F(tk::_boolean_, hi::Type); "break" L /*KKK*/ F(tk::_break_, hi::Control); @@ -487,6 +482,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "Infinity" L /*III*/ F(tk::_Infinity_, hi::Constant); "instanceof" L /*KKK*/ F(tk::_instanceof_, hi::Operator); "int" L /*FII*/ F(tk::_int_, hi::Type); +"__int128" L /*III*/ F(tk::___int128_, 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); @@ -496,8 +492,11 @@ XMLName {XMLNameStart}{XMLNamePart}* "package" L /*FSS*/ F(tk::_package_, hi::Meta); "private" L /*FSS*/ F(tk::_private_, hi::Meta); "protected" L /*FSS*/ F(tk::_protected_, hi::Meta); +"__proto__" L /*III*/ F(tk::___proto___, hi::Special); "prototype" L /*III*/ F(tk::_prototype_, hi::Special); "public" L /*FSS*/ F(tk::_public_, hi::Meta); +"__restrict" L /*III*/ F(tk::___restrict_, hi::Meta); +"restrict" L /*III*/ F(tk::_restrict_, hi::Meta); "return" L /*KKK*/ F(tk::_return_, hi::Control); "set" L /*III*/ F(tk::_set_, hi::Meta); "short" L /*FII*/ F(tk::_short_, hi::Type); @@ -512,6 +511,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "transient" L /*FII*/ F(tk::_transient_, hi::Meta); "true" L /*LLL*/ F(tk::_true_, hi::Constant); "try" L /*KKK*/ F(tk::_try_, hi::Control); +"typeid" L /*III*/ F(tk::_typeid_, hi::Operator); "typeof" L /*KKK*/ F(tk::_typeof_, hi::Operator); "var" L /*KKK*/ F(tk::_var_, hi::Meta); "void" L /*KKK*/ F(tk::_void_, hi::Operator); @@ -526,6 +526,7 @@ XMLName {XMLNameStart}{XMLNamePart}* @begin C "extern" L F(tk::_extern_, hi::Type); "signed" L F(tk::_signed_, hi::Type); +"struct" L F(tk::_struct_, hi::Meta); "typedef" L F(tk::_typedef_, hi::Meta); "unsigned" L F(tk::_unsigned_, hi::Type); @end @@ -605,8 +606,10 @@ XMLName {XMLNameStart}{XMLNamePart}* "$" R CYLexBufferUnit('$'); {PlateCharacter}+ R CYLexBufferUnits(yytext, yyleng); - {PlateCharacter}*{LineTerminatorSequence} R E("invalid newline"); {PlateCharacter}*{UnicodeScrap} R E("invalid character"); + + {PlateCharacter}*{LineTerminatorSequence} yylloc->end.Lines(); CYLexBufferUnits(yytext, yyleng); + \\{LineTerminatorSequence} yylloc->end.Lines(); } /* }}} */ /* Escapes {{{ */