blob: a5c51ffc679180062a9a6fa6e199a22f69529841 (
plain)
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
|
#ifndef sc2__position_h
#define sc2__position_h
#include <iostream>
#include <stdio.h>
class Position {
public:
const char *filename;
int linenum;
int colnum;
Position(const char *_f, int l, int c) : filename(_f), linenum(l), colnum(c)
{}
void print(std::ostream &os) {
os << filename;
if (colnum == -1) {
char tmp[1024];
sprintf(tmp, ", line %d, end of column: ", linenum);
os << tmp;
}
else {
char tmp[1024];
sprintf(tmp, ", line %d, column %d: ", linenum, colnum);
os << tmp;
}
}
};
#endif
|