nl = reinterpret_cast<const char *>(memchr(nl + 1, '\n', left)); \
} while (nl != NULL); \
yylloc->step(); \
- yylloc->end.lines(lines); \
- yylloc->end.columns(left); \
+ yylloc->end.Lines(lines); \
+ yylloc->end.Columns(left); \
more \
} else L \
}
-#define R yylloc->end.columns(yyleng);
+#define R yylloc->end.Columns(yyleng);
#define L yylloc->step(); R
#define H(value, highlight) do { \
%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")
<MultiLine>{
\**\*\/ R yy_pop_state(yyscanner); M N
- \**{LineTerminatorSequence} yylloc->end.lines(); yyextra->last_ = true;
+ \**{LineTerminatorSequence} yylloc->end.Lines(); yyextra->last_ = true;
\**{CommentCharacter}|\/ R
\**({UnicodeFail}|\*) R E("invalid comment");
<<EOF>> R E("invalid comment")
"*=" 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);
/* }}} */
/* 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);
CYLexBufferPoint(point);
}
- \\{LineTerminatorSequence} yylloc->end.lines();
+ \\{LineTerminatorSequence} yylloc->end.Lines();
\\(.|{NotLineTerminator}) R CYLexBufferUnits(yytext + 1, yyleng - 1);
\\(x{HexDigit}{0,1}|u({HexDigit}{0,3}|\{{HexDigit}*)|{UnicodeFail})? R E("invalid escape");
}
/* }}} */
-{LineTerminatorSequence} yylloc->step(); yylloc->end.lines(); yyextra->last_ = true; N
+{LineTerminatorSequence} yylloc->step(); yylloc->end.Lines(); yyextra->last_ = true; N
{WhiteSpace} L
<<EOF>> if (yyextra->auto_) { yyextra->auto_ = false; F(tk::AutoComplete, hi::Nothing); } L yyterminate();
%%
+#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_);