%s Div
%s DivOrTemplateTail
-%s RegExp
-%s RegExpOrTemplateTail
@begin E4X
%x XMLContent
%%
/* RegEx {{{ */
-<RegExp,RegExpOrTemplateTail>\/ L CYLexBufferStart(RegularExpression); CYLexBufferUnit('/');
-
<RegularExpression>{
\/{UnicodePart}* R CYLexBufferUnits(yytext, yyleng); CYLexBufferEnd(literal, RegEx, tk::RegularExpressionLiteral, hi::Constant);
\/{UnicodePart}*{UnicodeFail} R E("invalid flags")
"*=" L F(tk::StarEqual, hi::Operator);
"~" L F(tk::Tilde, hi::Operator);
-<Div,DivOrTemplateTail>"/" L F(tk::Slash, hi::Operator);
-<Div,DivOrTemplateTail>"/=" L F(tk::SlashEqual, hi::Operator);
+"/" L F(tk::Slash, hi::Operator);
+"/=" L F(tk::SlashEqual, hi::Operator);
":" L F(tk::Colon, hi::Structure);
"," L F(tk::Comma, hi::Structure);
")" L F(tk::CloseParen, hi::Structure);
"{" L yyextra->template_.push(false); F(yyextra->newline_ ? tk::OpenBrace_ : tk::OpenBrace, hi::Structure);
-<Div,RegExp>"}" L S(template_); F(tk::CloseBrace, hi::Structure);
+<Div>"}" L S(template_); F(tk::CloseBrace, hi::Structure);
"[" L F(tk::OpenBracket, hi::Structure);
"]" L F(tk::CloseBracket, hi::Structure);
"char" L /*FII*/ F(tk::_char_, hi::Type);
"class" L /*FFK*/ F(tk::_class_, hi::Meta);
"const" L /*FFK*/ F(tk::_const_, hi::Meta);
+"constructor" L /*III*/ F(tk::_constructor_, hi::Special);
"continue" L /*KKK*/ F(tk::_continue_, hi::Control);
"debugger" L /*FKK*/ F(tk::_debugger_, hi::Meta);
"default" L /*KKK*/ F(tk::_default_, hi::Control);
"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);
"return" L /*KKK*/ F(yyextra->return_.top() ? tk::_return__ : tk::_return_, hi::Control);
"set" L /*III*/ F(tk::_set_, hi::Meta);
"short" L /*FII*/ F(tk::_short_, hi::Type);
"static" L /*FS?*/ F(tk::_static_, hi::Meta);
-"super" L /*FFK*/ F(tk::_super_, hi::Constant);
+"super" L /*FFK*/ F(yyextra->super_.top() ? tk::_super__ : tk::_super_, hi::Constant);
"switch" L /*KKK*/ F(tk::_switch_, hi::Control);
"synchronized" L /*FII*/ F(tk::_synchronized_, hi::Meta);
"this" L /*KKK*/ F(tk::_this_, hi::Constant);
/* }}} */
/* Template {{{ */
"`" L yyextra->tail_ = false; CYLexBufferStart(StrictAccentString);
-<DivOrTemplateTail,RegExpOrTemplateTail>"}" L yyextra->tail_ = true; S(template_); CYLexBufferStart(StrictAccentString);
+<DivOrTemplateTail>"}" L yyextra->tail_ = true; S(template_); CYLexBufferStart(StrictAccentString);
<StrictAccentString>{
"`" R CYLexBufferEnd(string, String, yyextra->tail_ ? tk::TemplateTail : tk::NoSubstitutionTemplate, hi::Constant);
%%
+#undef yyextra
+#define yyextra this
+#define yyscanner scanner_
+
void CYDriver::ScannerInit() {
cylex_init(&scanner_);
cyset_extra(this, scanner_);
cylex_destroy(scanner_);
}
+void CYDriver::SetRegEx(bool equal) {
+ CYLexBufferStart(RegularExpression);
+ CYLexBufferUnit('/');
+ if (equal)
+ CYLexBufferUnit('=');
+}
+
void CYDriver::SetCondition(Condition condition) {
struct yyguts_t *yyg(reinterpret_cast<struct yyguts_t *>(scanner_));
switch (condition) {
- case RegExpCondition:
- BEGIN(template_.top() ? RegExpOrTemplateTail : RegExp);
- break;
@begin E4X
case XMLContentCondition:
BEGIN(XMLContent);
void CYDriver::PushCondition(Condition condition) {
switch (condition) {
- case RegExpCondition:
- yy_push_state(RegExp, scanner_);
- break;
@begin E4X
case XMLContentCondition:
yy_push_state(XMLContent, scanner_);