You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/08/19 20:27:47 UTC
svn commit: r1159733 - /thrift/trunk/compiler/cpp/src/thriftl.ll
Author: bryanduxbury
Date: Fri Aug 19 18:27:47 2011
New Revision: 1159733
URL: http://svn.apache.org/viewvc?rev=1159733&view=rev
Log:
THRIFT-1274. compiler: fail compilation if an unexpected token is encountered
This patch makes the lexer throw an exception when an unexpected token is encountered, as opposed to the standard behavior of just printing it out and doing nothing.
Patch: Adam Simpkins
Modified:
thrift/trunk/compiler/cpp/src/thriftl.ll
Modified: thrift/trunk/compiler/cpp/src/thriftl.ll
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/thriftl.ll?rev=1159733&r1=1159732&r2=1159733&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/thriftl.ll (original)
+++ thrift/trunk/compiler/cpp/src/thriftl.ll Fri Aug 19 18:27:47 2011
@@ -59,6 +59,11 @@ void integer_overflow(char* text) {
exit(1);
}
+void unexpected_token(char* text) {
+ yyerror("Unexpected token in input: \"%s\"\n", text);
+ exit(1);
+}
+
%}
/**
@@ -357,6 +362,10 @@ literal_begin (['\"])
}
}
+. {
+ unexpected_token(yytext);
+}
+
. {
/* Catch-all to let us catch "*" in the parser. */