[reader] Foundation of latex handling

This commit is contained in:
Laury
2021-10-22 21:23:35 +02:00
parent 9c9758fcb6
commit 73f2a7ecac
6 changed files with 225 additions and 25 deletions

View File

@@ -117,7 +117,7 @@ const char * EndOfPrintableWord(const char * word, const char * end) {
UTF8Decoder decoder(word);
CodePoint codePoint = decoder.nextCodePoint();
const char * result = word;
while (codePoint != '\n' && codePoint != ' ' && codePoint != '%') {
while (codePoint != '\n' && codePoint != ' ' && codePoint != '%' && codePoint != '$') {
result = decoder.stringPosition();
if (result >= end) {
break;
@@ -127,4 +127,21 @@ const char * EndOfPrintableWord(const char * word, const char * end) {
return result;
}
const char * StartOfPrintableWord(const char * word, const char * start) {
if (word == start) {
return word;
}
UTF8Decoder decoder(word);
CodePoint codePoint = decoder.previousCodePoint();
const char * result = word;
while (codePoint != '\n' && codePoint != ' ' && codePoint != '%' && codePoint != '$') {
result = decoder.stringPosition();
if (result >= start) {
break;
}
codePoint = decoder.previousCodePoint();
}
return result;
}
}