File: MismatchedUnicodeCharException.hpp

package info (click to toggle)
antlr 2.7.7%2Bdfsg-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,016 kB
  • sloc: java: 54,649; cs: 12,537; makefile: 8,854; cpp: 7,359; pascal: 5,273; sh: 4,333; python: 4,297; lisp: 1,969; xml: 220; lex: 192; ansic: 127
file content (82 lines) | stat: -rw-r--r-- 1,686 bytes parent folder | download | duplicates (17)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef INC_MismatchedUnicodeCharException_hpp__
#define INC_MismatchedUnicodeCharException_hpp__

/* ANTLR Translator Generator
 * Project led by Terence Parr at http://www.jGuru.com
 * Software rights: http://www.antlr.org/license.html
 *
 * $Id:$
 */

#include <antlr/config.hpp>
#include <antlr/RecognitionException.hpp>
#include <antlr/BitSet.hpp>
#include <antlr/String.hpp>

class UnicodeCharScanner;

class MismatchedUnicodeCharException : public antlr::RecognitionException {
public:
	typedef unsigned int char_type;
	typedef enum {
		CHAR = 1,
		NOT_CHAR = 2,
		RANGE = 3,
		NOT_RANGE = 4,
		SET = 5,
		NOT_SET = 6
	} MATCH_TYPE;

	MismatchedUnicodeCharException();

	// Expected range / not range
	MismatchedUnicodeCharException(
		char_type c,
		char_type lower,
		char_type up,
		bool matchNot,
		UnicodeCharScanner* cs
	);

	// Expected char / not char
	MismatchedUnicodeCharException(
		char_type c,
		char_type expect,
		bool matchNot,
		UnicodeCharScanner* cs
	);

	// Expected BitSet / not BitSet
	MismatchedUnicodeCharException(
		char_type c,
		antlr::BitSet s,
		bool matchNot,
		UnicodeCharScanner* cs
	);

	~MismatchedUnicodeCharException() throw();

	/**
	 * Returns a clean error message (no line number/column information)
	 */
	std::string getMessage() const;
private:
	// One of the above
	MATCH_TYPE mismatchType;

	// what was found on the input stream
	char_type foundChar;

	// For CHAR/NOT_CHAR and RANGE/NOT_RANGE
	char_type expecting;

	// For RANGE/NOT_RANGE (expecting is lower bound of range)
	char_type upper;

	// For SET/NOT_SET
	antlr::BitSet set;
	// who knows...they may want to ask scanner questions
	UnicodeCharScanner* scanner;
};

#endif