File: common.hpp

package info (click to toggle)
libcompiler-lexer-perl 0.23-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 612 kB
  • sloc: cpp: 5,127; perl: 1,167; makefile: 3
file content (53 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stdint.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <new>
#include <unistd.h>
#include <algorithm>
#include <assert.h>

#define EOL '\0'
#define MAX_TOKEN_SIZE 4096

#define cstr(s) s.c_str()

#ifdef DEBUG_MODE
#define DBG_P(fmt, ...) {\
	fprintf(stderr, fmt, ## __VA_ARGS__);	\
	}
#define DBG_PL(fmt, ...) {\
	fprintf(stderr, fmt, ## __VA_ARGS__);	\
	fprintf(stderr, "\n");						\
	}
#else
#define DBG_P(fmt, ...) {}
#define DBG_PL(fmt, ...) {}
#endif
#define DECL(T, S) {T, #T, S}
#define PTR_SIZE sizeof(void*)

class TokenInfo;
class Token;
class Tokens;
class Module;
class Annotator;
class AnnotateMethods;
class AnnotateMethodIterator;
typedef std::vector<Module *> Modules;
typedef std::map<std::string, std::string> StringMap;
typedef std::vector<Token *>::iterator TokenPos;
extern void *safe_malloc(size_t size);
extern void safe_free(void *ptr, size_t size);

#include <gen_token.hpp>
#include <token.hpp>

typedef std::map<Enum::Token::Type::Type, TokenInfo> TypeMap;
typedef std::map<std::string, TokenInfo> TypeDataMap;
typedef std::queue<std::string> StringsQueue;