Skip to content

Commit 21bea41

Browse files
committed
added TODOs
1 parent d764cb2 commit 21bea41

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

simplecpp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,7 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
28552855
// UTF-8 encodes code points above 0x7f in multiple code units
28562856
// code points above 0x10ffff are not allowed
28572857
if (((narrow || utf8) && value > 0x7f) || (utf16 && value > 0xffff) || value > 0x10ffff)
2858-
throw std::runtime_error("code point too large");
2858+
throw std::runtime_error("code point too large"); // TODO: make unique
28592859

28602860
if (value >= 0xd800 && value <= 0xdfff)
28612861
throw std::runtime_error("surrogate code points not allowed in universal character names");
@@ -2876,15 +2876,15 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
28762876

28772877
int additional_bytes;
28782878
if (value >= 0xf5) // higher values would result in code points above 0x10ffff
2879-
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid");
2879+
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid"); // TODO: make unique
28802880
if (value >= 0xf0)
28812881
additional_bytes = 3;
28822882
else if (value >= 0xe0)
28832883
additional_bytes = 2;
28842884
else if (value >= 0xc2) // 0xc0 and 0xc1 are always overlong 2-bytes encodings
28852885
additional_bytes = 1;
28862886
else
2887-
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid");
2887+
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid"); // TODO: make unique
28882888

28892889
value &= (1 << (6 - additional_bytes)) - 1;
28902890

@@ -2897,16 +2897,16 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
28972897
if (((c >> 6) != 2) // ensure c has form 0xb10xxxxxx
28982898
|| (!value && additional_bytes == 1 && c < 0xa0) // overlong 3-bytes encoding
28992899
|| (!value && additional_bytes == 2 && c < 0x90)) // overlong 4-bytes encoding
2900-
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid");
2900+
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid"); // TODO: make unique
29012901

29022902
value = (value << 6) | (c & ((1 << 7) - 1));
29032903
}
29042904

29052905
if (value >= 0xd800 && value <= 0xdfff)
2906-
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid");
2906+
throw std::runtime_error("assumed UTF-8 encoded source, but sequence is invalid"); // TODO: make unique
29072907

29082908
if ((utf8 && value > 0x7f) || (utf16 && value > 0xffff) || value > 0x10ffff)
2909-
throw std::runtime_error("code point too large");
2909+
throw std::runtime_error("code point too large"); // TODO: make unique
29102910
}
29112911
}
29122912

test.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,16 @@ static void characterLiteral()
372372

373373
ASSERT_THROW_EQUALS(simplecpp::characterLiteralToLL("U'\xed\xa0\x80'"), std::runtime_error, "assumed UTF-8 encoded source, but sequence is invalid");
374374
ASSERT_THROW_EQUALS(simplecpp::characterLiteralToLL("U'\xed\xbf\xbf'"), std::runtime_error, "assumed UTF-8 encoded source, but sequence is invalid");
375+
376+
// TODO: throw std::runtime_error("expected a character literal");
377+
// TODO: throw std::runtime_error("raw single quotes and newlines not allowed in character literals");
378+
// TODO: throw std::runtime_error("multiple characters only supported in narrow character literals");
379+
// TODO: throw std::runtime_error("unexpected end of character literal");
380+
// TODO: throw std::runtime_error("surrogate code points not allowed in universal character names");
381+
// TODO: throw std::runtime_error("assumed UTF-8 encoded source, but character literal ends unexpectedly");
382+
// TODO: throw std::runtime_error("numeric escape sequence too large");
383+
// TODO: throw std::runtime_error("missing closing quote in character literal");
384+
// TODO: throw std::runtime_error("empty character literal");
375385
}
376386

377387
static void combineOperators_floatliteral()

0 commit comments

Comments
 (0)