%x HEREDOC
%%
-\" { yyextra->m_LexBuffer.str(""); yyextra->m_LexBuffer.clear(); BEGIN(STRING); }
+\" {
+ yyextra->m_LexBuffer.str("");
+ yyextra->m_LexBuffer.clear();
+
+ yyextra->m_LocationBegin = *yylloc;
+
+ BEGIN(STRING);
+ }
<STRING>\" {
BEGIN(INITIAL);
+ yylloc->FirstLine = yyextra->m_LocationBegin.FirstLine;
+ yylloc->FirstColumn = yyextra->m_LocationBegin.FirstColumn;
+
std::string str = yyextra->m_LexBuffer.str();
yylval->text = strdup(str.c_str());
}
<STRING>\n {
- BOOST_THROW_EXCEPTION(ScriptError("Unterminated string literal", *yylloc));
+ BOOST_THROW_EXCEPTION(ScriptError("Unterminated string literal", DebugInfoRange(yyextra->m_LocationBegin, *yylloc)));
}
<STRING>\\[0-7]{1,3} {
if (result > 0xff) {
/* error, constant is out-of-bounds */
- BOOST_THROW_EXCEPTION(ScriptError("Constant is out of bounds: " + String(yytext), *yylloc));
+ BOOST_THROW_EXCEPTION(ScriptError("Constant is out of bounds: " + String(yytext), DebugInfoRange(yyextra->m_LocationBegin, *yylloc)));
}
yyextra->m_LexBuffer << static_cast<char>(result);
/* generate error - bad escape sequence; something
* like '\48' or '\0777777'
*/
- BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), *yylloc));
+ BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), DebugInfoRange(yyextra->m_LocationBegin, *yylloc)));
}
<STRING>\\n { yyextra->m_LexBuffer << "\n"; }
yyextra->m_LexBuffer << *yptr++;
}
-<STRING><<EOF>> { BOOST_THROW_EXCEPTION(ScriptError("End-of-file while in string literal", *yylloc)); }
+<STRING><<EOF>> {
+ BOOST_THROW_EXCEPTION(ScriptError("End-of-file while in string literal", DebugInfoRange(yyextra->m_LocationBegin, *yylloc)));
+ }
-\{\{\{ { yyextra->m_LexBuffer.str(""); yyextra->m_LexBuffer.clear(); BEGIN(HEREDOC); }
+\{\{\{ {
+ yyextra->m_LexBuffer.str("");
+ yyextra->m_LexBuffer.clear();
+
+ yyextra->m_LocationBegin = *yylloc;
+
+ BEGIN(HEREDOC);
+ }
<HEREDOC>\}\}\} {
BEGIN(INITIAL);
+ yylloc->FirstLine = yyextra->m_LocationBegin.FirstLine;
+ yylloc->FirstColumn = yyextra->m_LocationBegin.FirstColumn;
+
std::string str = yyextra->m_LexBuffer.str();
yylval->text = strdup(str.c_str());
%left T_SHIFT_LEFT T_SHIFT_RIGHT
%left T_PLUS T_MINUS
%left T_MULTIPLY T_DIVIDE_OP
-%left UNARY_MINUS
+%left UNARY_MINUS UNARY_PLUS
%right '!' '~'
%left '.' '(' '['
%left T_VAR T_THIS
{
$$ = new NegateExpression($2, DebugInfoRange(@1, @2));
}
+ | T_PLUS rterm %prec UNARY_PLUS
+ {
+ $$ = $2;
+ }
| T_MINUS rterm %prec UNARY_MINUS
{
$$ = new SubtractExpression(MakeLiteral(0), $2, DebugInfoRange(@1, @2));
int m_IgnoreNewlines;
std::ostringstream m_LexBuffer;
+ CompilerDebugInfo m_LocationBegin;
std::stack<TypeRuleList::Ptr> m_RuleLists;
ConfigType::Ptr m_Type;
std::stack<String> m_FKVar;
std::stack<String> m_FVVar;
std::stack<Expression *> m_FTerm;
-
-
};
class I2_CONFIG_API ConfigFragmentRegistry : public Registry<ConfigFragmentRegistry, String>