%token <identifier_> Identifier_
%token <number_> NumericLiteral
%token <string_> StringLiteral
-%token <literal_> RegularExpressionLiteral
+%token <literal_> RegularExpressionLiteral_
%token <string_> NoSubstitutionTemplate
%token <string_> TemplateHead
%type <property_> PropertyDefinitionList
%type <property_> PropertyDefinitionListOpt
%type <declaration_> PropertySetParameterList
+%type <literal_> RegularExpressionLiteral
+%type <bool_> RegularExpressionSlash
%type <expression_> RelationalExpression
%type <statement_> ReturnStatement
%type <rubyProc_> RubyProcExpression
;
LexSetRegExp
- : { CYLEX(); if (yyla.type == yytranslate_(token::Slash)) { yyla.clear(); driver.SetRegEx(false); } else if (yyla.type == yytranslate_(token::SlashEqual)) { yyla.clear(); driver.SetRegEx(true); } } LexOf
+ : LexOf
;
LexNewLine
| "false" { $$ = CYNew CYFalse(); }
;
/* }}} */
+/* 11.8.5 Regular Expression Literals {{{ */
+RegularExpressionSlash
+ : "/" { $$ = false; }
+ | "/=" { $$ = true; }
+ ;
+
+RegularExpressionLiteral
+ : RegularExpressionSlash { CYMPT(@$); driver.SetRegEx($1); } RegularExpressionLiteral_ { $$ = $3; }
+ ;
+/* }}} */
/* 11.9 Automatic Semicolon Insertion {{{ */
StrictSemi
/* RegEx {{{ */
<RegularExpression>{
- \/{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);