================
@@ -0,0 +1,229 @@
+#include "MDParser.h"
+#include "clang/Basic/CharInfo.h"
+#include "llvm/ADT/AllocatorList.h"
+
+namespace clang {
+namespace doc {
+namespace {
+bool isEmphasisDelimiter(char &Token) {
+ // TODO: support '_'
+ if (Token == '*')
+ return true;
+ return false;
+}
+} // namespace
+
+std::pair<std::optional<DelimiterContext>, size_t>
+MarkdownParser::processDelimiters(SmallString<64> &Line, const size_t &Origin)
{
+ size_t Idx = Origin;
+ while (Idx < Line.size() && Line[Idx] == Line[Origin]) {
+ ++Idx;
+ }
+
+ char Preceeding = (Origin == 0) ? ' ' : Line[Origin - 1];
+ char Proceeding = (Idx >= Line.size()) ? ' ' : Line[Idx];
+
+ bool LeftFlanking = !isWhitespace(Proceeding) &&
+ (!isPunctuation(Proceeding) || isWhitespace(Preceeding)
||
+ isPunctuation(Preceeding));
+ bool RightFlanking = !isWhitespace(Preceeding) &&
+ (!isPunctuation(Preceeding) || isWhitespace(Proceeding)
||
+ isPunctuation(Proceeding));
+
+ if (LeftFlanking && RightFlanking)
+ return {DelimiterContext{LeftFlanking, RightFlanking, true, true}, Idx};
+ if (LeftFlanking)
+ return {DelimiterContext{LeftFlanking, RightFlanking, true, false}, Idx};
+ if (RightFlanking)
+ return {DelimiterContext{LeftFlanking, RightFlanking, false, true}, Idx};
+ return {std::nullopt, 0};
+}
+
+Node *MarkdownParser::createTextNode(const std::list<LineNode *> &Text) {
----------------
ilovepi wrote:
why `std::list`? We have some list data structures in ADT, like `simple_ilist`,
but there are other choices of data structure that I think I see used more
often.
https://github.com/llvm/llvm-project/pull/155887
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits