summaryrefslogtreecommitdiff
path: root/colm/exports.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-05-20 10:44:20 -0400
committerAdrian Thurston <thurston@complang.org>2013-05-20 10:44:20 -0400
commita8aed14a06bd9373968148f7b72ccbef43b746a7 (patch)
tree5dc4b8fc424e82dd8a81323799965a06bad38bfb /colm/exports.cc
parent51b5957878dd5689476529fcc4e44e5d01815574 (diff)
downloadcolm-a8aed14a06bd9373968148f7b72ccbef43b746a7.tar.gz
prefix prod names with '_', use prodName to retrieve num
Name collisions between labels and production names are inconvenient. Force separation by prefixing prod names with an underscore. This will also allow us to derive production names from labels.
Diffstat (limited to 'colm/exports.cc')
-rw-r--r--colm/exports.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/colm/exports.cc b/colm/exports.cc
index e10c76fb..07cb5b03 100644
--- a/colm/exports.cc
+++ b/colm/exports.cc
@@ -147,13 +147,14 @@ void Compiler::generateExports()
}
if ( prodNames ) {
- out << " enum Prod {\n";
+ out << " enum ProdName {\n";
for ( LelDefList::Iter prod = lel->defList; prod.lte(); prod++ ) {
if ( prod->name.length() > 0 )
- out << "\t\t" << prod->name << " = " << prod->prodNum << ",\n";
+ out << "\t\t_" << prod->name << " = " << prod->prodNum << ",\n";
}
out << " };\n";
- out << " enum Prod prodType() { return (enum Prod)__tree->prodNum; }\n";
+ out << " enum ProdName prodName() " <<
+ "{ return (enum ProdName)__tree->prodNum; }\n";
}