redsnow 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/ext/snowcrash/Makefile +1 -1
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/configure +9 -9
- data/ext/snowcrash/ext/markdown-parser/Makefile +87 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/CONTRIBUTING.md +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/Makefile +2 -1
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/Makefile.win +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/examples/smartypants.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/examples/sundown.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini_href_e.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini_html_e.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html_smartypants.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html_block_names.txt +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/autolink.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/autolink.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/buffer.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/buffer.h +1 -1
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/html_blocks.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/markdown.c +9 -3
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/markdown.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/src_map.c +11 -7
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/src_map.h +1 -1
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/stack.c +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/stack.h +0 -0
- data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/sundown.def +0 -0
- data/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
- data/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
- data/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
- data/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +92 -0
- data/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +82 -0
- data/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
- data/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
- data/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
- data/ext/snowcrash/{src → ext/markdown-parser/src}/MarkdownParser.h +43 -33
- data/ext/snowcrash/snowcrash.gyp +114 -63
- data/ext/snowcrash/src/ActionParser.h +334 -398
- data/ext/snowcrash/src/AssetParser.h +82 -171
- data/ext/snowcrash/src/Blueprint.h +7 -2
- data/ext/snowcrash/src/BlueprintParser.h +212 -286
- data/ext/snowcrash/src/BlueprintUtility.h +2 -2
- data/ext/snowcrash/src/CBlueprint.h +1 -1
- data/ext/snowcrash/src/CSourceAnnotation.cc +11 -11
- data/ext/snowcrash/src/CSourceAnnotation.h +9 -9
- data/ext/snowcrash/src/CodeBlockUtility.h +199 -149
- data/ext/snowcrash/src/HeadersParser.h +197 -0
- data/ext/snowcrash/src/ParameterParser.h +429 -0
- data/ext/snowcrash/src/ParametersParser.h +136 -211
- data/ext/snowcrash/src/PayloadParser.h +458 -562
- data/ext/snowcrash/src/Platform.h +0 -3
- data/ext/snowcrash/src/ResourceGroupParser.h +183 -164
- data/ext/snowcrash/src/ResourceParser.h +325 -493
- data/ext/snowcrash/src/Section.cc +42 -0
- data/ext/snowcrash/src/Section.h +47 -0
- data/ext/snowcrash/src/SectionParser.h +229 -0
- data/ext/snowcrash/src/SectionParserData.h +81 -0
- data/ext/snowcrash/src/SectionProcessor.h +211 -0
- data/ext/snowcrash/src/Signature.cc +74 -0
- data/ext/snowcrash/src/Signature.h +32 -0
- data/ext/snowcrash/src/SourceAnnotation.h +7 -20
- data/ext/snowcrash/src/StringUtility.h +30 -10
- data/ext/snowcrash/src/SymbolTable.h +7 -7
- data/ext/snowcrash/src/UriTemplateParser.cc +10 -10
- data/ext/snowcrash/src/UriTemplateParser.h +11 -14
- data/ext/snowcrash/src/ValuesParser.h +122 -0
- data/ext/snowcrash/src/Version.h +2 -2
- data/ext/snowcrash/src/csnowcrash.cc +5 -5
- data/ext/snowcrash/src/csnowcrash.h +3 -3
- data/ext/snowcrash/src/snowcrash.cc +74 -4
- data/ext/snowcrash/src/snowcrash.h +9 -4
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +16 -16
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +3 -2
- data/ext/snowcrash/vcbuild.bat +13 -4
- data/lib/redsnow.rb +5 -5
- data/lib/redsnow/binding.rb +1 -1
- data/lib/redsnow/blueprint.rb +33 -2
- data/lib/redsnow/parseresult.rb +7 -4
- data/lib/redsnow/version.rb +1 -1
- data/test/redsnow_binding_test.rb +6 -6
- data/test/redsnow_parseresult_test.rb +1 -1
- metadata +62 -42
- data/ext/snowcrash/src/BlockUtility.h +0 -186
- data/ext/snowcrash/src/BlueprintParserCore.h +0 -190
- data/ext/snowcrash/src/BlueprintSection.h +0 -140
- data/ext/snowcrash/src/DescriptionSectionUtility.h +0 -156
- data/ext/snowcrash/src/HeaderParser.h +0 -289
- data/ext/snowcrash/src/ListBlockUtility.h +0 -273
- data/ext/snowcrash/src/ListUtility.h +0 -95
- data/ext/snowcrash/src/MarkdownBlock.cc +0 -176
- data/ext/snowcrash/src/MarkdownBlock.h +0 -93
- data/ext/snowcrash/src/MarkdownParser.cc +0 -266
- data/ext/snowcrash/src/ParameterDefinitonParser.h +0 -645
- data/ext/snowcrash/src/Parser.cc +0 -71
- data/ext/snowcrash/src/Parser.h +0 -29
- data/ext/snowcrash/src/ParserCore.cc +0 -120
- data/ext/snowcrash/src/ParserCore.h +0 -82
- data/ext/snowcrash/src/SectionUtility.h +0 -142
data/ext/snowcrash/src/Parser.cc
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// Parser.cpp
|
3
|
-
// snowcrash
|
4
|
-
//
|
5
|
-
// Created by Zdenek Nemec on 4/8/13.
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
#include <exception>
|
10
|
-
#include <sstream>
|
11
|
-
#include "Parser.h"
|
12
|
-
#include "MarkdownParser.h"
|
13
|
-
#include "BlueprintParser.h"
|
14
|
-
|
15
|
-
using namespace snowcrash;
|
16
|
-
|
17
|
-
const int SourceAnnotation::OK = 0;
|
18
|
-
|
19
|
-
// Check source for unsupported character \t & \r
|
20
|
-
// Returns true if passed (not found), false otherwise
|
21
|
-
static bool CheckSource(const SourceData& source, Result& result)
|
22
|
-
{
|
23
|
-
std::string::size_type pos = source.find("\t");
|
24
|
-
if (pos != std::string::npos) {
|
25
|
-
result.error = Error("the use of tab(s) '\\t' in source data isn't currently supported, please contact makers",
|
26
|
-
2,
|
27
|
-
MapSourceDataBlock(MakeSourceDataBlock(pos, 1), source));
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
|
31
|
-
pos = source.find("\r");
|
32
|
-
if (pos != std::string::npos) {
|
33
|
-
result.error = Error("the use of carriage return(s) '\\r' in source data isn't currently supported, please contact makers",
|
34
|
-
2,
|
35
|
-
MapSourceDataBlock(MakeSourceDataBlock(pos, 1), source));
|
36
|
-
return false;
|
37
|
-
}
|
38
|
-
|
39
|
-
return true;
|
40
|
-
}
|
41
|
-
|
42
|
-
void Parser::parse(const SourceData& source, BlueprintParserOptions options, Result& result, Blueprint& blueprint)
|
43
|
-
{
|
44
|
-
try {
|
45
|
-
|
46
|
-
// Sanity Check
|
47
|
-
if (!CheckSource(source, result))
|
48
|
-
return;
|
49
|
-
|
50
|
-
// Parse Markdown
|
51
|
-
MarkdownBlock::Stack markdown;
|
52
|
-
MarkdownParser markdownParser;
|
53
|
-
markdownParser.parse(source, result, markdown);
|
54
|
-
|
55
|
-
if (result.error.code != Error::OK)
|
56
|
-
return;
|
57
|
-
|
58
|
-
// Parse Blueprint
|
59
|
-
BlueprintParser::Parse(source, markdown, options, result, blueprint);
|
60
|
-
}
|
61
|
-
catch (const std::exception& e) {
|
62
|
-
|
63
|
-
std::stringstream ss;
|
64
|
-
ss << "parser exception: '" << e.what() << "'";
|
65
|
-
result.error = Error(ss.str(), 1);
|
66
|
-
}
|
67
|
-
catch (...) {
|
68
|
-
|
69
|
-
result.error = Error("parser exception has occured", 1);
|
70
|
-
}
|
71
|
-
}
|
data/ext/snowcrash/src/Parser.h
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// Parser.h
|
3
|
-
// snowcrash
|
4
|
-
//
|
5
|
-
// Created by Zdenek Nemec on 4/8/13.
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef SNOWCRASH_PARSER_H
|
10
|
-
#define SNOWCRASH_PARSER_H
|
11
|
-
|
12
|
-
#include <functional>
|
13
|
-
#include "Blueprint.h"
|
14
|
-
#include "BlueprintParserCore.h"
|
15
|
-
|
16
|
-
namespace snowcrash {
|
17
|
-
|
18
|
-
//
|
19
|
-
// API Blueprint Parser
|
20
|
-
//
|
21
|
-
class Parser {
|
22
|
-
public:
|
23
|
-
|
24
|
-
// Parse source data into Blueprint AST
|
25
|
-
void parse(const SourceData& source, BlueprintParserOptions options, Result& result, Blueprint& blueprint);
|
26
|
-
};
|
27
|
-
}
|
28
|
-
|
29
|
-
#endif
|
@@ -1,120 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// ParserCore.cc
|
3
|
-
// snowcrash
|
4
|
-
//
|
5
|
-
// Created by Zdenek Nemec on 5/4/13.
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
#include "ParserCore.h"
|
10
|
-
|
11
|
-
using namespace snowcrash;
|
12
|
-
|
13
|
-
SourceDataBlock snowcrash::MakeSourceDataBlock(size_t loc, size_t len)
|
14
|
-
{
|
15
|
-
SourceDataRange r;
|
16
|
-
r.location = loc;
|
17
|
-
r.length = len;
|
18
|
-
return SourceDataBlock(1, r);
|
19
|
-
}
|
20
|
-
|
21
|
-
void snowcrash::AppendSourceDataBlock(SourceDataBlock& destination, const SourceDataBlock& append)
|
22
|
-
{
|
23
|
-
if (append.empty())
|
24
|
-
return;
|
25
|
-
|
26
|
-
if (destination.empty() ||
|
27
|
-
append.front().location != destination.back().location + destination.back().length) {
|
28
|
-
destination.insert(destination.end(), append.begin(), append.end());
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
// merge
|
32
|
-
destination.back().length += append.front().length;
|
33
|
-
|
34
|
-
if (append.size() > 1) {
|
35
|
-
destination.insert(destination.end(), ++append.begin(), append.end());
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
SourceDataBlockPair snowcrash::SplitSourceDataBlock(const SourceDataBlock& block, size_t len)
|
41
|
-
{
|
42
|
-
if (block.empty())
|
43
|
-
return std::make_pair(SourceDataBlock(), SourceDataBlock());
|
44
|
-
|
45
|
-
SourceDataBlock first;
|
46
|
-
SourceDataBlock second;
|
47
|
-
|
48
|
-
size_t remain = len;
|
49
|
-
for (SourceDataBlock::const_iterator it = block.begin(); it != block.end(); ++it) {
|
50
|
-
|
51
|
-
if (remain == 0) {
|
52
|
-
second.push_back(*it);
|
53
|
-
continue;
|
54
|
-
}
|
55
|
-
|
56
|
-
if (remain >= it->length) {
|
57
|
-
first.push_back(*it);
|
58
|
-
remain -= it->length;
|
59
|
-
continue;
|
60
|
-
}
|
61
|
-
|
62
|
-
if (remain < it->length) {
|
63
|
-
SourceDataRange left = *it;
|
64
|
-
left.length = remain;
|
65
|
-
first.push_back(left);
|
66
|
-
|
67
|
-
SourceDataRange right = *it;
|
68
|
-
right.location += remain;
|
69
|
-
right.length -= remain;
|
70
|
-
second.push_back(right);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
return std::make_pair(first, second);
|
75
|
-
}
|
76
|
-
|
77
|
-
#define UTF8_CHAR_LEN( byte ) (( 0xE5000000 >> (( byte >> 3 ) & 0x1e )) & 3 ) + 1
|
78
|
-
|
79
|
-
/** \returns Number of UTF8 characters in byte buffer */
|
80
|
-
static size_t strnlen_utf8(const char* s, size_t len)
|
81
|
-
{
|
82
|
-
if (!s || !len)
|
83
|
-
return 0;
|
84
|
-
|
85
|
-
size_t i = 0, j = 0;
|
86
|
-
while (s[i] && i < len) {
|
87
|
-
i += UTF8_CHAR_LEN(s[i]);
|
88
|
-
j++;
|
89
|
-
}
|
90
|
-
return j;
|
91
|
-
}
|
92
|
-
|
93
|
-
SourceCharactersRange snowcrash::MapSourceDataRange(const SourceDataRange& range, const SourceData& data)
|
94
|
-
{
|
95
|
-
if (data.empty())
|
96
|
-
return SourceCharactersRange();
|
97
|
-
|
98
|
-
size_t charLocation = 0;
|
99
|
-
if (range.location > 0)
|
100
|
-
charLocation = strnlen_utf8(data.c_str(), range.location);
|
101
|
-
|
102
|
-
size_t charLength = 0;
|
103
|
-
if (range.length > 0)
|
104
|
-
charLength = strnlen_utf8(data.c_str() + range.location, range.length);
|
105
|
-
|
106
|
-
SourceCharactersRange characterRange = {charLocation, charLength };
|
107
|
-
return characterRange;
|
108
|
-
}
|
109
|
-
|
110
|
-
SourceCharactersBlock snowcrash::MapSourceDataBlock(const SourceDataBlock& block, const SourceData& data)
|
111
|
-
{
|
112
|
-
SourceCharactersBlock characterMap;
|
113
|
-
|
114
|
-
for (SourceDataBlock::const_iterator it = block.begin(); it != block.end(); ++it) {
|
115
|
-
SourceCharactersRange characterRange = MapSourceDataRange(*it, data);
|
116
|
-
characterMap.push_back(characterRange);
|
117
|
-
}
|
118
|
-
|
119
|
-
return characterMap;
|
120
|
-
}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// ParserCore.h
|
3
|
-
// snowcrash
|
4
|
-
//
|
5
|
-
// Created by Zdenek Nemec on 5/4/13.
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef SNOWCRASH_PARSERCORE_H
|
10
|
-
#define SNOWCRASH_PARSERCORE_H
|
11
|
-
|
12
|
-
#include <string>
|
13
|
-
#include <vector>
|
14
|
-
#include "SourceAnnotation.h"
|
15
|
-
#include "Platform.h"
|
16
|
-
|
17
|
-
namespace snowcrash {
|
18
|
-
|
19
|
-
/**
|
20
|
-
* \brief Textual source data byte buffer. A markdown-formatted text.
|
21
|
-
*/
|
22
|
-
typedef std::string SourceData;
|
23
|
-
|
24
|
-
/**
|
25
|
-
* \brief A byte range of data within the source data buffer.
|
26
|
-
*
|
27
|
-
* Important note: All ranges are in bytes not characters.
|
28
|
-
*/
|
29
|
-
struct SourceDataRange {
|
30
|
-
size_t location;
|
31
|
-
size_t length;
|
32
|
-
};
|
33
|
-
|
34
|
-
/**
|
35
|
-
* \brief A block of source data bytes - a byte map.
|
36
|
-
*
|
37
|
-
* NOTE: The block does not have to be continuous.
|
38
|
-
* Data Blocks are in bytes not characters.
|
39
|
-
*/
|
40
|
-
typedef std::vector<SourceDataRange> SourceDataBlock;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* \brief Create a %SourceDataBlock with a range.
|
44
|
-
* \param loc A location in source data buffer.
|
45
|
-
* \param len Length of the range.
|
46
|
-
*/
|
47
|
-
SourceDataBlock MakeSourceDataBlock(size_t loc, size_t len);
|
48
|
-
|
49
|
-
/**
|
50
|
-
* \brief Append %SourceDataBlock to existing block, merging continuous blocks.
|
51
|
-
* \param destination A block to append to.
|
52
|
-
* \param append A block to be appended.
|
53
|
-
*/
|
54
|
-
void AppendSourceDataBlock(SourceDataBlock& destination, const SourceDataBlock& append);
|
55
|
-
|
56
|
-
/**
|
57
|
-
* \brief A generic pair of two blocks
|
58
|
-
*/
|
59
|
-
typedef std::pair<SourceDataBlock, SourceDataBlock> SourceDataBlockPair;
|
60
|
-
|
61
|
-
/**
|
62
|
-
* \brief Splits %SourceDataBlock into two blocks.
|
63
|
-
* \param block A block to be split.
|
64
|
-
* \param len The length of first block after which the split occurs.
|
65
|
-
*/
|
66
|
-
SourceDataBlockPair SplitSourceDataBlock(const SourceDataBlock& block, size_t len);
|
67
|
-
|
68
|
-
/**
|
69
|
-
* \brief Maps range of source data bytes into range of characters
|
70
|
-
*/
|
71
|
-
SourceCharactersRange MapSourceDataRange(const SourceDataRange& range, const SourceData& data);
|
72
|
-
|
73
|
-
/**
|
74
|
-
* \brief Maps block of source data bytes into block of characters.
|
75
|
-
* \param block A %SourceDataBlock to map into %SourceCharactersBlock
|
76
|
-
* \param data A mapped source data.
|
77
|
-
* \returns A character-map constructed from given byte map
|
78
|
-
*/
|
79
|
-
SourceCharactersBlock MapSourceDataBlock(const SourceDataBlock& block, const SourceData& data);
|
80
|
-
}
|
81
|
-
|
82
|
-
#endif
|
@@ -1,142 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// SectionUtility.h
|
3
|
-
// snowcrash
|
4
|
-
//
|
5
|
-
// Created by Zdenek Nemec on 11/11/13.
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef SNOWCRASH_SECTIONUTILITY_H
|
10
|
-
#define SNOWCRASH_SECTIONUTILITY_H
|
11
|
-
|
12
|
-
#include "BlockUtility.h"
|
13
|
-
#include "ListBlockUtility.h"
|
14
|
-
#include "CodeBlockUtility.h"
|
15
|
-
|
16
|
-
namespace snowcrash {
|
17
|
-
|
18
|
-
/**
|
19
|
-
* Compute expected indentation of a section
|
20
|
-
*/
|
21
|
-
FORCEINLINE size_t SectionIndentationLevel(const BlueprintSection& section)
|
22
|
-
{
|
23
|
-
switch (section.type) {
|
24
|
-
case ParameterValuesSectionType:
|
25
|
-
return 2;
|
26
|
-
|
27
|
-
case BodySectionType:
|
28
|
-
case SchemaSectionType:
|
29
|
-
case HeadersSectionType: // NOTE: Headers can be potentially both level 0 and 1
|
30
|
-
return 1;
|
31
|
-
|
32
|
-
default:
|
33
|
-
return 0;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
/**
|
38
|
-
* \brief Report & skip blocks in a foreign section.
|
39
|
-
* \param section Section including the foreign section.
|
40
|
-
* \param cur A cursor pointing to the beigin of the foreign section.
|
41
|
-
* \return Standard section parse result pointing AFTER the last block parsed.
|
42
|
-
*/
|
43
|
-
template <class T>
|
44
|
-
FORCEINLINE ParseSectionResult HandleForeignSection(const BlueprintSection& section,
|
45
|
-
const BlockIterator& cur,
|
46
|
-
const SourceData& sourceData) {
|
47
|
-
|
48
|
-
ParseSectionResult result = std::make_pair(Result(), cur);
|
49
|
-
BlockIterator sectionCur = cur;
|
50
|
-
|
51
|
-
std::stringstream ss;
|
52
|
-
SourceCharactersBlock sourceBlock;
|
53
|
-
|
54
|
-
// Handle list / list item separately
|
55
|
-
if (sectionCur->type == ListItemBlockBeginType ||
|
56
|
-
sectionCur->type == ListBlockBeginType) {
|
57
|
-
|
58
|
-
// Skip the list / list item
|
59
|
-
if (sectionCur->type == ListBlockBeginType) {
|
60
|
-
sectionCur = SkipToClosingBlock(sectionCur, section.bounds.second, ListBlockBeginType, ListBlockEndType);
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
sectionCur = SkipToClosingBlock(sectionCur, section.bounds.second, ListItemBlockBeginType, ListItemBlockEndType);
|
64
|
-
}
|
65
|
-
SectionType type = ClassifyChildrenListBlock<T>(cur, section.bounds.second);
|
66
|
-
|
67
|
-
// Assemble the message
|
68
|
-
ss << "ignoring ";
|
69
|
-
ss << ((type != UndefinedSectionType) ? SectionName(type) : "unrecognized");
|
70
|
-
ss << " list";
|
71
|
-
if (cur->type == ListItemBlockBeginType)
|
72
|
-
ss << " item";
|
73
|
-
|
74
|
-
if (type != UndefinedSectionType &&
|
75
|
-
section.hasParent()) {
|
76
|
-
BlueprintSection recognizedSection(type, std::make_pair(cur, sectionCur), section.parent());
|
77
|
-
size_t level = SectionIndentationLevel(recognizedSection);
|
78
|
-
|
79
|
-
if (level) {
|
80
|
-
ss << ", " << SectionName(type) << " list ";
|
81
|
-
if (cur->type == ListItemBlockBeginType)
|
82
|
-
ss << "item ";
|
83
|
-
ss << "is expected to be indented by ";
|
84
|
-
ss << level * 4 << " spaces or " << level << " tab";
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
sourceBlock = CharacterMapForBlock(sectionCur, cur, section.bounds, sourceData);
|
89
|
-
sectionCur = CloseList(sectionCur, section.bounds.second);
|
90
|
-
}
|
91
|
-
else if (sectionCur->type == QuoteBlockBeginType) {
|
92
|
-
|
93
|
-
// Skip quote or just one block
|
94
|
-
ss << "ignoring unrecognized quote";
|
95
|
-
sectionCur = SkipToClosingBlock(sectionCur, section.bounds.second, QuoteBlockBeginType, QuoteBlockEndType);
|
96
|
-
sourceBlock = CharacterMapForBlock(sectionCur, cur, section.bounds, sourceData);
|
97
|
-
|
98
|
-
if (!CheckCursor(section, sectionCur, sourceData, result.first))
|
99
|
-
return result;
|
100
|
-
|
101
|
-
++sectionCur;
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
// Skip just one block
|
105
|
-
ss << "ignoring unrecognized block";
|
106
|
-
sourceBlock = CharacterMapForBlock(sectionCur, cur, section.bounds, sourceData);
|
107
|
-
|
108
|
-
++sectionCur;
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
if (section.hasParent()) {
|
113
|
-
// Additional hint for some sections
|
114
|
-
switch (section.parent().type) {
|
115
|
-
case ParametersSectionType:
|
116
|
-
ss << ", expected parameter discussion, e.g. '<parameter name> ... lorem ipsum'";
|
117
|
-
break;
|
118
|
-
|
119
|
-
case ParameterDefinitionSectionType:
|
120
|
-
ss << ", expected enumeration of parameter values, e.g. 'Values' followed by a nested list of possbile values";
|
121
|
-
break;
|
122
|
-
|
123
|
-
case ActionSectionType:
|
124
|
-
ss << ", expected request, response, parameters, headers or a defintion of the next action, resource or a group";
|
125
|
-
break;
|
126
|
-
|
127
|
-
default:
|
128
|
-
break;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
// WARN: Ignoring unrecognized block
|
133
|
-
result.first.warnings.push_back(Warning(ss.str(),
|
134
|
-
IgnoringWarning,
|
135
|
-
sourceBlock));
|
136
|
-
|
137
|
-
result.second = sectionCur;
|
138
|
-
return result;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
|
142
|
-
#endif
|