-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformatter-ada_like-plain_text.bdy
178 lines (127 loc) · 5.18 KB
/
formatter-ada_like-plain_text.bdy
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
--------------------------------------------------------------------------
-- ASnip Source Code Decorator
-- Copyright (C) 2006, Georg Bauhaus
--
-- 1. Permission is hereby granted to use, copy, modify and/or distribute
-- this package, provided that:
-- * copyright notices are retained unchanged,
-- * any distribution of this package, whether modified or not,
-- includes this license text.
-- 2. Permission is hereby also granted to distribute binary programs which
-- depend on this package. If the binary program depends on a modified
-- version of this package, you are encouraged to publicly release the
-- modified version of this package.
--
-- THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR
-- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE.
--------------------------------------------------------------------------
-- eMail: bauhaus@arcor.de
package body Formatter.Ada_Like.Plain_Text is
function default_image(t: ADA_LIKE_OBJ) return ASnip.STR;
-- identity
pragma inline(default_image);
function default_prefix(t: ADA_LIKE_OBJ) return ASnip.STR;
-- nothing
pragma inline(default_prefix);
function default_suffix(t: ADA_LIKE_OBJ) return ASnip.STR;
-- nothing
pragma inline(default_suffix);
function default_image(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return token_text(t);
end default_image;
function default_prefix(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return "";
end;
function default_suffix(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return "";
end;
---
function prefix_of_attr(t: ATTR_TOKEN) return ASnip.STR is
begin
return default_prefix(ADA_LIKE_OBJ(t));
end;
function image_of_attr(t: ATTR_TOKEN) return ASnip.STR is
begin
return token_text(t);
end;
function suffix_of_attr(t: ATTR_TOKEN) return ASnip.STR is
begin
return default_suffix(ADA_LIKE_OBJ(t));
end;
function prefix_of_chr(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_chr(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_image;
function suffix_of_chr(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_cmt(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return "--";
end;
function image_of_cmt(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
-- this is where comment parsing could be done
return default_image(t);
end;
function suffix_of_cmt(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_del(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_del(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_image;
function suffix_of_del(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_id(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_id(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return token_text(t);
end;
function suffix_of_id(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_op(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_op(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_image;
function suffix_of_op(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_num(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_num(t: ADA_LIKE_OBJ) return ASnip.STR is
begin
return token_text(t);
end;
function suffix_of_num(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_res(t: RES_TOKEN) return ASnip.STR is
begin
return default_prefix(ADA_LIKE_OBJ(t));
end;
function image_of_res(t: RES_TOKEN) return ASnip.STR is
begin
return token_text(t);
end;
function suffix_of_res(t: RES_TOKEN) return ASnip.STR is
begin
return default_suffix(ADA_LIKE_OBJ(t));
end;
function prefix_of_sep(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_sep(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_image;
function suffix_of_sep(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
function prefix_of_strng(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_prefix;
function image_of_strng(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_image;
function suffix_of_strng(t: ADA_LIKE_OBJ) return ASnip.STR
renames default_suffix;
end Formatter.Ada_Like.Plain_Text;