Skip to content

Commit d7e7c4c

Browse files
idodeclareVladimir Kotal
authored andcommitted
Support Eiffel Special Characters. Limit Character_constant.
Fixes problem noticed by nd-krieg in issue #2577.
1 parent 2d7e47c commit d7e7c4c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

opengrok-indexer/src/main/resources/analysis/eiffel/EiffelProductions.lexh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, Chris Fraire <[email protected]>.
21+
* Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
2222
*/
2323

2424
/*
@@ -96,7 +96,9 @@ Real = ({Decimal_integer}? "." {Decimal_integer} |
9696
/*
9797
* Character_constant = Δ "'" Character "'"
9898
*/
99-
Character_constant = \' [^\']+ \'
99+
Character_constant = \' ([^\'\n\r] | {Special_character}) \'
100+
101+
Special_character = % ([A-Da-dFfHhLlNnQqRrSsT-Vt-v%\'\"\(\)\<\>] | "/" [0-9]+ "/")
100102

101103
/*
102104
* SCOMMENT : single-line comment
@@ -166,7 +168,8 @@ Character_constant = \' [^\']+ \'
166168
* Eiffel defines "Line_wrapping_part" as a sequence of characters
167169
* consisting of the following, in order: % (percent character); zero or
168170
* more blanks or tabs; New_line; zero or more blanks or tabs; % again. For
169-
* OpenGrok purposes, just recognizing LFs in STRING is good enough.
171+
* OpenGrok purposes, just recognizing LFs in STRING is good enough; though
172+
* see also the {Special_character} handling for STRING,VSTRING.
170173
*/
171174
}
172175

@@ -178,6 +181,11 @@ Character_constant = \' [^\']+ \'
178181
}
179182

180183
<STRING, VSTRING> {
184+
{Special_character} {
185+
h.chkLOC();
186+
offer(yytext());
187+
}
188+
181189
{WhspChar}*{EOL} {
182190
onDisjointSpanChanged(null, yychar);
183191
onEndOfLineMatched(yytext(), yychar);
@@ -188,7 +196,10 @@ Character_constant = \' [^\']+ \'
188196
<YYINITIAL, SCOMMENT, STRING, VSTRING> {
189197
{WhspChar}*{EOL} { onEndOfLineMatched(yytext(), yychar); }
190198
\s { offer(yytext()); }
191-
[^] { h.chkLOC(); offer(yytext()); }
199+
[^] {
200+
h.chkLOC();
201+
offer(yytext());
202+
}
192203
}
193204

194205
<SCOMMENT, STRING, VSTRING> {

0 commit comments

Comments
 (0)