[antlr-interest] CppCodeGen patch
Brad Schick
schick at robotbattle.com
Tue May 4 23:55:25 PDT 2004
I'm not sure if people normally submit patches here, but I have a
simple one :) Under VC7.1 antlr's generatd C++ code causes *many*
warnings because the type returned by std::string::lengh() is larger
than type int.
This patch changes CppCodeGen to use the typedef from the
basic_string class. I believe this should work on other compilers
with compliant stl. Patch was created against 2.7.4rc1
-Brad
--- CppCodeGenerator.java Sat May 01 02:12:12 2004
+++ c:\temp\antlr-2.7.4rc1\antlr\CppCodeGenerator.java Wed Apr 14
11:51:22 2004
@@ -3535,5 +3535,5 @@
else
println("_ttype = "+ s.getId
().substring(1)+";");
- println("ANTLR_USE_NAMESPACE(std)
string::size_type _saveIndex;"); // used for element!
(so we can kill text matched for element)
+ println("int _saveIndex;"); //
used for element! (so we can kill text matched for element)
/*
println("boolean
old_saveConsumedInput=saveConsumedInput;");
@@ -4706,5 +4706,5 @@
commonExtraArgs = "";
commonExtraParams = "bool _createToken";
- commonLocalVars = "int
_ttype; "+namespaceAntlr+"RefToken _token; ANTLR_USE_NAMESPACE(std)
string::size_type _begin=text.length();";
+ commonLocalVars = "int
_ttype; "+namespaceAntlr+"RefToken _token; int _begin=text.length
();";
lt1Value = "LA(1)";
exceptionThrown =
namespaceAntlr+"RecognitionException";
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list