Thrift compiler code cleanup, comments, php inline generation, etc
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664822 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrift.l b/compiler/cpp/src/thrift.l
index 484e43b..64a2bf8 100644
--- a/compiler/cpp/src/thrift.l
+++ b/compiler/cpp/src/thrift.l
@@ -4,20 +4,29 @@
* Tokenizes a thrift definition file.
* @author Mark Slee <mcslee@facebook.com>
*/
+
%{
#include "main.h"
#include "parse/t_program.h"
-/** Must be included AFTER parse/t_program.h */
+/**
+ * Must be included AFTER parse/t_program.h, but I can't remember why anymore
+ * because I wrote this a while ago.
+ */
#include "thrift.tab.hh"
%}
-/** Provides yylineno global */
+/**
+ * Provides the yylineno global, useful for debugging output
+ */
%option lex-compat
-/** Helper definitions */
+/**
+ * Helper definitions, comments, constants, and whatnot
+ */
+
intconstant ([0-9]+)
identifier ([a-zA-Z_][\.a-zA-Z_0-9]*)
whitespace ([ \t\r\n]*)
@@ -36,31 +45,27 @@
{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; }
-
+"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; }
{intconstant} { yylval.iconst = atoi(yytext); return tok_int_constant; }
+
{identifier} { yylval.id = strdup(yytext); return tok_identifier; }
%%