【发布时间】:2011-01-19 17:33:55
【问题描述】:
我正在为编译器编写一个简单的预处理器。下面是我的代码的编辑 sn-p:
%{
#include <string.h>
#include <hash_map>
#include "scanner.h"
#include "errors.h"
struct eqstr {
bool operator()(const char* s1, const char* s2) const {
return strcmp(s1, s2) == 0;
}
};
std::hash_map<const char*, char*, hash<const char*>, eqstr> defs; // LINE 28
%}
// Definitions here
%%
// Patterns and actions here
%%
编译时出现以下错误:
dpp.l:28:错误:预期的构造函数, 析构函数,或之前的类型转换 ‘
任何想法可能有什么问题?我几乎从 sgi 文档中复制并粘贴了这一行。
【问题讨论】: