[antlr-interest] Re: MSVC 7.0

Arnar Birgisson arnarb at oddi.is
Fri Oct 3 04:00:55 PDT 2003


I'm sorry for sending my last post three times, stupid webmail interface
:o)

Arnar

>>> klaren at cs.utwente.nl 10/03/03 10:06 AM >>>
Hi,

While I have the attention of MSVC user ;)

At the moment there's a lot of these kind off blocks spread through the
header files only for MSVC:

#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++
  template class  ANTLR_API ANTLR_USE_NAMESPACE(std)allocator<
ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, int > >;
  template class  ANTLR_API ANTLR_USE_NAMESPACE(std)allocator<
ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int
> >;
...../* etc */.....
  template class  ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_val<
ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string,
int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator<
ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int
> >,false > >;
  template class  ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree<
ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string,
int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator<
ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int
> >,false > >;
  template class  ANTLR_API ANTLR_USE_NAMESPACE(std)map<
ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess >;
#endif

Is it possible to move these all in one file like dll.cpp ? Or are these
explicit template instantiations needed in their header files ? I'd be
inclined to think they can be moved. Which would allow moving all the
MSVC
cruft in one file.

Question aside:

To fix the quoting change the method textOrChar in CppCodeGenerator.java
to:

private String textOrChar(String text) {
	// check to see if the text is a single character
	if (text.startsWith("'")) {
		// assume it also ends with '
		return
charFormatter.literalChar(ANTLRLexer.tokenTypeForCharLiteral(text));
	}
	else
	{
		// must be string literal strip of the quotes so
		// they won't get quoted
		return
"\""+charFormatter.escapeString(StringUtils.stripFrontBack(text,"\"","\""))+"\"";
	}
}

Did you by any chance see where the invalid sign extension happened? Or
do
you have a small example lexer+input file that triggers this ?

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  Xander: "Buffy, we need to do something *now*"
  Angel: "We need a distraction."
  Buffy: "Right."
  Angel: "What are you going to do?"
  Buffy: "I'm going to kill them all. That oughtta distract 'em..."


 

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list