summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-13 16:56:43 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-13 16:58:49 +0200
commit266fd9bb368bf80b80809b364543d788efc334dd (patch)
tree947f3a44a79de94e12004fcb7fe24b2f5a312538 /src/lib/eolian
parentbc8c432841c50278bca2a7d118fbb3f14a800cab (diff)
eolian: support complex monospace syntax $[...]
This is to allow monospace bits with periods, commas and other non-alphabetical characters. Newlines are not supported (they end the block) and escapes are supported (for ]). Fixes T8213.
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/eolian_database.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 5553616903..9aa6b8f87b 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -314,7 +314,6 @@ eolian_documentation_tokenize(const char *doc, Eolian_Doc_Token *ret)
314#undef CMP_MARK_NOTE 314#undef CMP_MARK_NOTE
315 315
316mloop: 316mloop:
317
318 /* monospace markup ($foo) */ 317 /* monospace markup ($foo) */
319 if ((doc[0] == '$') && ((doc[1] == '_') || isalpha(doc[1]))) 318 if ((doc[0] == '$') && ((doc[1] == '_') || isalpha(doc[1])))
320 { 319 {
@@ -326,6 +325,28 @@ mloop:
326 return ret->text_end; 325 return ret->text_end;
327 } 326 }
328 327
328 /* complex monospace markup ($[...]) */
329 if ((doc[0] == '$') && (doc[1] == '['))
330 {
331 doc += 2;
332 ret->text = doc;
333 ret->text_end = ret->text;
334 while ((ret->text_end[0] != '\0') && (ret->text_end[0] != ']') &&
335 (ret->text_end[0] != '\n'))
336 {
337 /* escape: skip backslash */
338 if ((ret->text_end[0] == '\\') && (ret->text_end[1] != '\0') &&
339 (ret->text_end[1] != '\n'))
340 ++ret->text_end;
341 ++ret->text_end;
342 }
343 ret->type = EOLIAN_DOC_TOKEN_MARKUP_MONOSPACE;
344 /* return past the ending bracket as that's markup syntax */
345 if (ret->text_end[0] == ']')
346 return ret->text_end + 1;
347 return ret->text_end;
348 }
349
329 /* references */ 350 /* references */
330 Eolian_Doc_Token_Type rtp = _get_ref_token(doc, &ret->text_end); 351 Eolian_Doc_Token_Type rtp = _get_ref_token(doc, &ret->text_end);
331 if (rtp != EOLIAN_DOC_TOKEN_UNKNOWN) 352 if (rtp != EOLIAN_DOC_TOKEN_UNKNOWN)
@@ -349,7 +370,8 @@ mloop:
349 continue; 370 continue;
350 } 371 }
351 /* monospace markup */ 372 /* monospace markup */
352 if ((schr[0] == '$') && ((schr[1] == '_') || isalpha(schr[1]))) 373 if ((schr[0] == '$') && (
374 (schr[1] == '_') || (schr[1] == '[') || isalpha(schr[1])))
353 { 375 {
354 pschr = schr; 376 pschr = schr;
355 break; 377 break;