forked from MoganLab/mogan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimpl_language.hpp
More file actions
120 lines (105 loc) · 4.59 KB
/
impl_language.hpp
File metadata and controls
120 lines (105 loc) · 4.59 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/******************************************************************************
* MODULE : impl_language.hpp
* COPYRIGHT : (C) 1999-2020 Joris van der Hoeven, Darcy Shen
*******************************************************************************
* This software falls under the GNU general public license version 3 or later.
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/
#ifndef IMPL_LANGUAGE_H
#define IMPL_LANGUAGE_H
#include "blanks_parser.hpp"
#include "escaped_char_parser.hpp"
#include "identifier_parser.hpp"
#include "inline_comment_parser.hpp"
#include "keyword_parser.hpp"
#include "language.hpp"
#include "number_parser.hpp"
#include "operator_parser.hpp"
#include "preprocessor_parser.hpp"
#include "string_parser.hpp"
extern text_property_rep tp_normal_rep;
extern text_property_rep tp_hyph_rep;
extern text_property_rep tp_thin_space_rep;
extern text_property_rep tp_space_rep;
extern text_property_rep tp_space_before_rep;
extern text_property_rep tp_dspace_rep;
extern text_property_rep tp_nb_thin_space_rep;
extern text_property_rep tp_nb_space_rep;
extern text_property_rep tp_nb_dspace_rep;
extern text_property_rep tp_period_rep;
extern text_property_rep tp_cjk_normal_rep;
extern text_property_rep tp_cjk_no_break_rep;
extern text_property_rep tp_cjk_period_rep;
extern text_property_rep tp_cjk_wide_period_rep;
extern text_property_rep tp_cjk_no_break_period_rep;
extern text_property_rep tp_half_rep;
extern text_property_rep tp_operator_rep;
extern text_property_rep tp_short_apply_rep;
extern text_property_rep tp_apply_rep;
int line_number (tree t);
int number_of_lines (tree t);
tree line_inc (tree t, int i);
bool in_comment (int pos, tree t);
struct abstract_language_rep : language_rep {
hashmap<string, string> colored;
string current_parser;
blanks_parser_rep blanks_parser;
inline_comment_parser_rep inline_comment_parser;
number_parser_rep number_parser;
escaped_char_parser_rep escaped_char_parser;
keyword_parser_rep keyword_parser;
operator_parser_rep operator_parser;
identifier_parser_rep identifier_parser;
string_parser_rep string_parser;
preprocessor_parser_rep preprocessor_parser;
abstract_language_rep (string s) : language_rep (s) {};
virtual bool belongs_to_identifier (char c);
void parse_identifier (hashmap<string, string>& t, string s, int& pos);
void parse_type (hashmap<string, string>& t, string s, int& pos);
void parse_keyword (hashmap<string, string>& t, string s, int& pos);
void parse_constant (hashmap<string, string>& t, string s, int& pos);
};
struct verb_language_rep : language_rep {
verb_language_rep (string name);
text_property advance (tree t, int& pos);
array<int> get_hyphens (string s);
void hyphenate (string s, int after, string& left, string& right);
string get_color (tree t, int start, int end);
};
struct prog_language_rep : abstract_language_rep {
prog_language_rep (string name);
text_property advance (tree t, int& pos);
array<int> get_hyphens (string s);
void hyphenate (string s, int after, string& left, string& right);
string get_color (tree t, int start, int end);
void customize_keyword (keyword_parser_rep parser, tree config);
void customize_identifier (identifier_parser_rep parser, tree config);
void customize_operator (tree config);
void customize_number (tree config);
void customize_string (tree config);
void customize_preprocessor (tree config);
void customize_comment (tree config);
void customize_path (tree config);
tree get_parser_config (string lan, string key);
bool inline_comment_requires_space;
bool path_parser_enabled;
};
struct scheme_language_rep : language_rep {
hashmap<string, string> colored;
scheme_language_rep (string name);
text_property advance (tree t, int& pos);
array<int> get_hyphens (string s);
void hyphenate (string s, int after, string& left, string& right);
string get_color (tree t, int start, int end);
};
struct cpp_language_rep : abstract_language_rep {
cpp_language_rep (string name);
text_property advance (tree t, int& pos);
array<int> get_hyphens (string s);
void hyphenate (string s, int after, string& left, string& right);
string get_color (tree t, int start, int end);
void parse_preprocessing (string s, int& pos);
string get_identifier_type (string s, int& pos);
};
#endif // defined IMPL_LANGUAGE_H