Files
swift-mirror/lib/ReST/Detail.h
Dmitri Hrybenko e9f06eee68 Comment parsing: implement basic parsing of inline markup
This change adds infrastructure to represent inline markup in the AST,
implements parsing of some of the inline markup (*emphasis*, **strong
emphasis**, `interpreted text`, ``inline literal``), and XML generation
for these constructs for SourceKit clients to consume.

The parsing itself is incomplete for constructs not mentioned above.
Most notably, we don't parse hyperlinks, and we don't parse the
double-colon that changes the next paragraph into a literal block.

Swift SVN r22752
2014-10-15 13:50:48 +00:00

44 lines
1.4 KiB
C++

//===--- Detail.h - ReST parsing implementation details -------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_REST_DETAIL_H
#define LLVM_REST_DETAIL_H
#include "clang/Basic/CharInfo.h"
namespace llvm {
namespace rest {
namespace detail {
/// According to [ReST/Syntax Details/Whitespace], only four ASCII characters
/// are considered whitespace.
///
/// REST-FIXME: Unicode supports a lot of different whitespace characeters, so
/// limiting processing just to these four ASCII characeters seems wrong.
/// Audit all users of this functions if it is changed to allow other
/// whitespace, also check that those new characters are allowed in
/// indentation.
static inline bool isReSTWhitespace(char C) {
return clang::isHorizontalWhitespace(C);
}
static inline bool isReSTWhitespace(unsigned C) {
return C <= 0x7f && isReSTWhitespace(static_cast<char>(C));
}
} // namespace detail
} // namespace rest
} // namespace llvm
#endif // LLVM_REST_DETAIL_H