Update thrift compiler for new syntax, generate new form of C++ code

Reviewed By: wayne, he loves less warnings


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664840 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrift.l b/compiler/cpp/src/thrift.l
index e72565e..839060e 100644
--- a/compiler/cpp/src/thrift.l
+++ b/compiler/cpp/src/thrift.l
@@ -33,8 +33,8 @@
 multicomm    ("/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
 comment      ("//"[^\n]*)
 unixcomment  ("#"[^\n]*)
-symbol       ([\,\{\}\(\)\=<>])
-cpptype      ("[cpp:".*"]")
+symbol       ([:\,\{\}\(\)\=<>\[\]])
+literal      ("\""[^"]*"\"")
 
 %%
 
@@ -45,41 +45,47 @@
 
 {symbol}      { return yytext[0]; }
 
-"namespace"   { return tok_namespace; }
-"void"        { return tok_void;      }
-"bool"        { return tok_bool;      }
-"byte"        { return tok_byte;      }
-"i16"         { return tok_i16;       }
-"i32"         { return tok_i32;       }
-"i64"         { return tok_i64;       }
-"double"      { return tok_double;    }
-"string"      { return tok_string;    }
-"map"         { return tok_map;       }
-"list"        { return tok_list;      }
-"set"         { return tok_set;       }
-"async"       { return tok_async;     }
-"typedef"     { return tok_typedef;   }
-"struct"      { return tok_struct;    }
-"exception"   { return tok_xception;  }
-"throws"      { return tok_throws;    }
-"service"     { return tok_service;   }
-"enum"        { return tok_enum;      }
+"namespace"     { return tok_namespace;     }
+"cpp_namespace" { return tok_cpp_namespace; }
+"cpp_include"   { return tok_cpp_include;   }
+"cpp_type"      { return tok_cpp_type;      }
+"java_package"  { return tok_java_package;  }
+"include"       { return tok_include;       }
+
+"void"          { return tok_void;          }
+"bool"          { return tok_bool;          }
+"byte"          { return tok_byte;          }
+"i16"           { return tok_i16;           }
+"i32"           { return tok_i32;           }
+"i64"           { return tok_i64;           }
+"double"        { return tok_double;        }
+"string"        { return tok_string;        }
+"map"           { return tok_map;           }
+"list"          { return tok_list;          }
+"set"           { return tok_set;           }
+"async"         { return tok_async;         }
+"typedef"       { return tok_typedef;       }
+"struct"        { return tok_struct;        }
+"exception"     { return tok_xception;      }
+"extends"       { return tok_extends;       }
+"throws"        { return tok_throws;        }
+"service"       { return tok_service;       }
+"enum"          { return tok_enum;          }
 
 {intconstant} {
   yylval.iconst = atoi(yytext);
   return tok_int_constant;
 }
 
-{cpptype} {
-  yylval.id = strdup(yytext+5);
-  yylval.id[strlen(yylval.id)-1] = '\0';
-  return tok_cpptype;
-}
-
 {identifier} {
   yylval.id = strdup(yytext);
   return tok_identifier;
 }
 
+{literal} {
+  yylval.id = strdup(yytext+1);
+  yylval.id[strlen(yylval.id)-1] = '\0';
+  return tok_literal;
+}
 
 %%