THRIFT-1995: IDL can generate uncompilable ocde
Patch: Carl Yeksigian
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index 0a04840..8accf4c 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -89,7 +89,7 @@
intconstant ([+-]?[0-9]+)
hexconstant ("0x"[0-9A-Fa-f]+)
dubconstant ([+-]?[0-9]*(\.[0-9]+)?([eE][+-]?[0-9]+)?)
-identifier ([a-zA-Z_][\.a-zA-Z_0-9]*)
+identifier ([a-zA-Z_](\.[a-zA-Z_0-9]|[a-zA-Z_0-9])*)
whitespace ([ \t\r\n]*)
sillycomm ("/*""*"*"*/")
multicomm ("/*"[^*]"/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/")
@@ -97,7 +97,7 @@
comment ("//"[^\n]*)
unixcomment ("#"[^\n]*)
symbol ([:;\,\{\}\(\)\=<>\[\]])
-st_identifier ([a-zA-Z-][\.a-zA-Z_0-9-]*)
+st_identifier ([a-zA-Z-](\.[a-zA-Z_0-9-]|[a-zA-Z_0-9-])*)
literal_begin (['\"])
%%
diff --git a/test/Include.thrift b/test/Include.thrift
new file mode 100644
index 0000000..562319b
--- /dev/null
+++ b/test/Include.thrift
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+include "ThriftTest.thrift"
+
+struct IncludeTest {
+ 1: required ThriftTest.Bools bools
+}
\ No newline at end of file