redsnow 0.2.1 → 0.3.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/bin/snowcrash +0 -0
- data/ext/snowcrash/snowcrash.xcworkspace/contents.xcworkspacedata +10 -0
- data/ext/snowcrash/src/ActionParser.h +35 -33
- data/ext/snowcrash/src/AssetParser.h +17 -17
- data/ext/snowcrash/src/Blueprint.h +101 -66
- data/ext/snowcrash/src/BlueprintParser.h +219 -10
- data/ext/snowcrash/src/BlueprintSourcemap.h +1 -1
- data/ext/snowcrash/src/BlueprintUtility.h +14 -14
- data/ext/snowcrash/src/CBlueprint.cc +29 -10
- data/ext/snowcrash/src/CBlueprint.h +19 -3
- data/ext/snowcrash/src/CBlueprintSourcemap.cc +20 -10
- data/ext/snowcrash/src/CBlueprintSourcemap.h +12 -3
- data/ext/snowcrash/src/CodeBlockUtility.h +25 -25
- data/ext/snowcrash/src/HTTP.cc +3 -0
- data/ext/snowcrash/src/HTTP.h +9 -6
- data/ext/snowcrash/src/HeadersParser.h +34 -14
- data/ext/snowcrash/src/ParameterParser.h +21 -21
- data/ext/snowcrash/src/ParametersParser.h +6 -5
- data/ext/snowcrash/src/PayloadParser.h +174 -129
- data/ext/snowcrash/src/RegexMatch.h +3 -3
- data/ext/snowcrash/src/ResourceGroupParser.h +5 -4
- data/ext/snowcrash/src/ResourceParser.h +30 -26
- data/ext/snowcrash/src/Section.cc +6 -6
- data/ext/snowcrash/src/Section.h +2 -2
- data/ext/snowcrash/src/SectionParser.h +41 -41
- data/ext/snowcrash/src/SectionParserData.h +10 -10
- data/ext/snowcrash/src/SectionProcessor.h +70 -30
- data/ext/snowcrash/src/Serialize.h +3 -3
- data/ext/snowcrash/src/SerializeJSON.cc +124 -96
- data/ext/snowcrash/src/SerializeJSON.h +1 -1
- data/ext/snowcrash/src/SerializeYAML.cc +71 -53
- data/ext/snowcrash/src/SerializeYAML.h +1 -1
- data/ext/snowcrash/src/Signature.cc +2 -2
- data/ext/snowcrash/src/Signature.h +1 -1
- data/ext/snowcrash/src/SourceAnnotation.h +23 -23
- data/ext/snowcrash/src/StringUtility.h +71 -9
- data/ext/snowcrash/src/SymbolTable.h +17 -17
- data/ext/snowcrash/src/UriTemplateParser.cc +5 -5
- data/ext/snowcrash/src/UriTemplateParser.h +9 -9
- data/ext/snowcrash/src/ValuesParser.h +2 -2
- data/ext/snowcrash/src/Version.h +1 -1
- data/ext/snowcrash/src/csnowcrash.cc +10 -8
- data/ext/snowcrash/src/snowcrash.cc +9 -9
- data/ext/snowcrash/src/snowcrash.h +6 -8
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +14 -14
- data/ext/snowcrash/src/win/RegexMatch.cc +7 -7
- data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +1 -1
- data/lib/redsnow/binding.rb +8 -2
- data/lib/redsnow/blueprint.rb +4 -3
- data/lib/redsnow/sourcemap.rb +6 -4
- data/lib/redsnow/version.rb +1 -1
- metadata +4 -17
@@ -33,18 +33,18 @@ namespace snowcrash {
|
|
33
33
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(isSpace))));
|
34
34
|
return s;
|
35
35
|
}
|
36
|
-
|
36
|
+
|
37
37
|
// Trim string from end
|
38
38
|
inline std::string& TrimStringEnd(std::string &s) {
|
39
39
|
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(isSpace))).base(), s.end());
|
40
40
|
return s;
|
41
41
|
}
|
42
|
-
|
42
|
+
|
43
43
|
// Trim both ends of string
|
44
44
|
inline std::string& TrimString(std::string &s) {
|
45
45
|
return TrimStringStart(TrimStringEnd(s));
|
46
46
|
}
|
47
|
-
|
47
|
+
|
48
48
|
// Split string by delim
|
49
49
|
inline std::vector<std::string>& Split(const std::string& s, char delim, std::vector<std::string>& elems) {
|
50
50
|
std::stringstream ss(s);
|
@@ -54,14 +54,14 @@ namespace snowcrash {
|
|
54
54
|
}
|
55
55
|
return elems;
|
56
56
|
}
|
57
|
-
|
58
|
-
// Split string by delim
|
57
|
+
|
58
|
+
// Split string by delim
|
59
59
|
inline std::vector<std::string> Split(const std::string& s, char delim) {
|
60
60
|
std::vector<std::string> elems;
|
61
61
|
Split(s, delim, elems);
|
62
62
|
return elems;
|
63
63
|
}
|
64
|
-
|
64
|
+
|
65
65
|
// Split string on the first occurrence of delim
|
66
66
|
inline std::vector<std::string> SplitOnFirst(const std::string& s, char delim) {
|
67
67
|
std::string::size_type pos = s.find(delim);
|
@@ -75,7 +75,7 @@ namespace snowcrash {
|
|
75
75
|
}
|
76
76
|
return elems;
|
77
77
|
}
|
78
|
-
|
78
|
+
|
79
79
|
// Make sure last two characters are newlines
|
80
80
|
inline std::string& TwoNewLines(std::string& s) {
|
81
81
|
|
@@ -108,10 +108,10 @@ namespace snowcrash {
|
|
108
108
|
}
|
109
109
|
return target;
|
110
110
|
}
|
111
|
-
|
111
|
+
|
112
112
|
/**
|
113
113
|
* \brief Extract the first line from a string.
|
114
|
-
*
|
114
|
+
*
|
115
115
|
* \param s Subject of the extraction
|
116
116
|
* \param r Remaining content aftert the extraction
|
117
117
|
* \return First line from the subject string
|
@@ -124,6 +124,68 @@ namespace snowcrash {
|
|
124
124
|
r = elem.back();
|
125
125
|
return elem.front();
|
126
126
|
}
|
127
|
+
|
128
|
+
|
129
|
+
/**
|
130
|
+
* \brief compare equality - allow compare diferent types
|
131
|
+
*
|
132
|
+
* \return true if args era equal
|
133
|
+
*/
|
134
|
+
struct IsEqual {
|
135
|
+
template<typename T1, typename T2>
|
136
|
+
bool operator()(const T1& a1, const T2& a2) const {
|
137
|
+
return a1 == a2;
|
138
|
+
}
|
139
|
+
};
|
140
|
+
|
141
|
+
/**
|
142
|
+
* \brief compare equality - character are compare case insensitive
|
143
|
+
*
|
144
|
+
* \return true if args era equal
|
145
|
+
*/
|
146
|
+
struct IsIEqual {
|
147
|
+
template<typename T1, typename T2>
|
148
|
+
bool operator()(const T1& a1, const T2& a2) const {
|
149
|
+
return std::tolower(a1) == std::tolower(a2);
|
150
|
+
}
|
151
|
+
};
|
152
|
+
|
153
|
+
/**
|
154
|
+
* \brief compare containers equality
|
155
|
+
*
|
156
|
+
* \requirements
|
157
|
+
* - both containers must support methods ::length(), ::begin(), ::end()
|
158
|
+
* - both containers must be iterable
|
159
|
+
* - both containers must contain comparable types
|
160
|
+
*
|
161
|
+
* \param arg1, arg2 - containers to compare
|
162
|
+
* \param predicate - testing equality
|
163
|
+
*
|
164
|
+
* \return true if containers contains same content
|
165
|
+
*/
|
166
|
+
|
167
|
+
template <typename T1, typename T2, typename Predicate>
|
168
|
+
inline bool MatchContainers(const T1& arg1, const T2& arg2, const Predicate& predicate) {
|
169
|
+
if (arg1.length() != arg2.length()) {
|
170
|
+
return false;
|
171
|
+
}
|
172
|
+
return std::equal(arg1.begin(), arg1.end(), arg2.begin(), predicate);
|
173
|
+
}
|
174
|
+
|
175
|
+
template <typename T>
|
176
|
+
struct Equal : std::binary_function<T, T, bool> {
|
177
|
+
bool operator()(const T& left, const T& right) const {
|
178
|
+
return MatchContainers(left, right, IsEqual());
|
179
|
+
}
|
180
|
+
};
|
181
|
+
|
182
|
+
template <typename T>
|
183
|
+
struct IEqual : std::binary_function<T, T, bool> {
|
184
|
+
bool operator()(const T& left, const T& right) const {
|
185
|
+
return MatchContainers(left, right, IsIEqual());
|
186
|
+
}
|
187
|
+
};
|
188
|
+
|
127
189
|
}
|
128
190
|
|
129
191
|
#endif
|
@@ -26,42 +26,42 @@
|
|
26
26
|
#define SYMBOL_IDENTIFIER "([^][()]+)"
|
27
27
|
|
28
28
|
namespace snowcrashconst {
|
29
|
-
|
29
|
+
|
30
30
|
/** Symbol reference matching regex */
|
31
31
|
const char* const SymbolReferenceRegex("^[[:blank:]]*\\[" SYMBOL_IDENTIFIER "]\\[][[:blank:]]*$");
|
32
32
|
}
|
33
33
|
|
34
34
|
namespace snowcrash {
|
35
|
-
|
35
|
+
|
36
36
|
// Resource Object Symbol
|
37
|
-
typedef std::pair<
|
37
|
+
typedef std::pair<Identifier, ResourceModel> ResourceModelSymbol;
|
38
38
|
|
39
39
|
// Resource Object Symbol source map
|
40
|
-
typedef std::pair<
|
40
|
+
typedef std::pair<Identifier, SourceMap<ResourceModel> > ResourceModelSymbolSourceMap;
|
41
41
|
|
42
42
|
// Resource Object Symbol Table
|
43
|
-
typedef std::map<
|
44
|
-
|
45
|
-
//
|
46
|
-
typedef std::map<
|
43
|
+
typedef std::map<Identifier, ResourceModel> ResourceModelSymbolTable;
|
44
|
+
|
45
|
+
// Resource Object Symbol Table source map
|
46
|
+
typedef std::map<Identifier, SourceMap<ResourceModel> > ResourceModelSymbolSourceMapTable;
|
47
47
|
|
48
48
|
struct SymbolTable {
|
49
|
-
|
49
|
+
|
50
50
|
// Resource Object Symbol Table
|
51
51
|
ResourceModelSymbolTable resourceModels;
|
52
52
|
};
|
53
|
-
|
53
|
+
|
54
54
|
struct SymbolSourceMapTable {
|
55
55
|
|
56
56
|
// Resource Object Symbol Table source map
|
57
57
|
ResourceModelSymbolSourceMapTable resourceModels;
|
58
58
|
};
|
59
|
-
|
59
|
+
|
60
60
|
// Checks whether given source data represents reference to a symbol returning true if so,
|
61
61
|
// false otherwise. If source data is represent reference referred symbol name is filled in.
|
62
62
|
inline bool GetSymbolReference(const mdp::ByteBuffer& sourceData,
|
63
|
-
|
64
|
-
|
63
|
+
Identifier& referredSymbol) {
|
64
|
+
|
65
65
|
CaptureGroups captureGroups;
|
66
66
|
|
67
67
|
if (RegexCapture(sourceData, snowcrashconst::SymbolReferenceRegex, captureGroups, 3)) {
|
@@ -72,7 +72,7 @@ namespace snowcrash {
|
|
72
72
|
|
73
73
|
return false;
|
74
74
|
}
|
75
|
-
|
75
|
+
|
76
76
|
#ifdef DEBUG
|
77
77
|
// Prints markdown block recursively to stdout
|
78
78
|
inline void PrintSymbolTable(const SymbolTable& symbolTable) {
|
@@ -81,14 +81,14 @@ namespace snowcrash {
|
|
81
81
|
for (ResourceModelSymbolTable::const_iterator it = symbolTable.resourceModels.begin();
|
82
82
|
it != symbolTable.resourceModels.end();
|
83
83
|
++it) {
|
84
|
-
|
84
|
+
|
85
85
|
std::cout << "- " << it->first << " - body: '" << EscapeNewlines(it->second.body) << "'\n";
|
86
86
|
}
|
87
|
-
|
87
|
+
|
88
88
|
std::cout << std::endl;
|
89
89
|
}
|
90
90
|
#endif
|
91
|
-
|
91
|
+
|
92
92
|
}
|
93
93
|
|
94
94
|
#endif
|
@@ -53,7 +53,7 @@ static Expressions GetUriTemplateExpressions(const URITemplate& uriTemplate) {
|
|
53
53
|
Expressions expressions;
|
54
54
|
size_t expressionStartPos = 0;
|
55
55
|
size_t expressionEndPos = 0;
|
56
|
-
|
56
|
+
|
57
57
|
while (expressionStartPos != std::string::npos && expressionEndPos != std::string::npos && expressionStartPos < uriTemplate.length()) {
|
58
58
|
expressionStartPos = uriTemplate.find("{", expressionStartPos);
|
59
59
|
expressionEndPos = uriTemplate.find("}", expressionStartPos);
|
@@ -105,12 +105,12 @@ static ClassifiedExpression ClassifyExpression(const Expression& expression) {
|
|
105
105
|
}
|
106
106
|
|
107
107
|
FormStyleQueryContinuationExpression formStyleQueryContinuationExpression(expression);
|
108
|
-
if (formStyleQueryContinuationExpression.IsExpressionType()) {
|
108
|
+
if (formStyleQueryContinuationExpression.IsExpressionType()) {
|
109
109
|
return formStyleQueryContinuationExpression;
|
110
110
|
}
|
111
111
|
|
112
112
|
UndefinedExpression undefinedExpression(expression);
|
113
|
-
|
113
|
+
|
114
114
|
return undefinedExpression;
|
115
115
|
}
|
116
116
|
|
@@ -131,7 +131,7 @@ void URITemplateParser::parse(const URITemplate& uri, const mdp::CharactersRange
|
|
131
131
|
result.report.warnings.push_back(Warning("The URI template contains mismatched expression brackets", URIWarning, sourceBlock));
|
132
132
|
return;
|
133
133
|
}
|
134
|
-
|
134
|
+
|
135
135
|
if (HasNestedCurlyBrackets(result.path)) {
|
136
136
|
result.report.warnings.push_back(Warning("The URI template contains nested expression brackets", URIWarning, sourceBlock));
|
137
137
|
return;
|
@@ -172,7 +172,7 @@ void URITemplateParser::parse(const URITemplate& uri, const mdp::CharactersRange
|
|
172
172
|
result.report.warnings.push_back(Warning(ss.str(), URIWarning, sourceBlock));
|
173
173
|
hasIllegalCharacters = true;
|
174
174
|
}
|
175
|
-
|
175
|
+
|
176
176
|
if (!hasIllegalCharacters) {
|
177
177
|
if (classifiedExpression.IsInvalidExpressionName()) {
|
178
178
|
std::stringstream ss;
|
@@ -18,7 +18,7 @@
|
|
18
18
|
#define URI_TEMPLATE_EXPRESSION_REGEX "^([?|#|+|&]?(([A-Z|a-z|0-9|_|,])*|(%[A-F|a-f|0-9]{2})*)*\\*?)$"
|
19
19
|
|
20
20
|
namespace snowcrash {
|
21
|
-
|
21
|
+
|
22
22
|
/**
|
23
23
|
* \brief URI template parse result.
|
24
24
|
*/
|
@@ -26,10 +26,10 @@ namespace snowcrash {
|
|
26
26
|
std::string scheme;
|
27
27
|
std::string host;
|
28
28
|
std::string path;
|
29
|
-
|
29
|
+
|
30
30
|
Report report;
|
31
31
|
};
|
32
|
-
|
32
|
+
|
33
33
|
/**
|
34
34
|
* \brief URI template expression.
|
35
35
|
*/
|
@@ -59,13 +59,13 @@ namespace snowcrash {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
std::string unsupportedWarningText;
|
62
|
-
|
62
|
+
|
63
63
|
snowcrash::Expression innerExpression;
|
64
|
-
|
64
|
+
|
65
65
|
virtual bool IsExpressionType() const {
|
66
66
|
return false;
|
67
67
|
}
|
68
|
-
|
68
|
+
|
69
69
|
bool ContainsSpaces() {
|
70
70
|
return innerExpression.find(" ") != std::string::npos;
|
71
71
|
}
|
@@ -81,11 +81,11 @@ namespace snowcrash {
|
|
81
81
|
bool IsInvalidExpressionName() {
|
82
82
|
std::string tmpExpression = innerExpression;
|
83
83
|
if (tmpExpression.find("..") != std::string::npos) return true;
|
84
|
-
|
84
|
+
|
85
85
|
size_t start_pos = 0;
|
86
86
|
while ((start_pos = tmpExpression.find(".", start_pos)) != std::string::npos) {
|
87
87
|
tmpExpression.replace(start_pos, 1, "_");
|
88
|
-
start_pos++;
|
88
|
+
start_pos++;
|
89
89
|
}
|
90
90
|
|
91
91
|
return !RegexMatch(tmpExpression, URI_TEMPLATE_EXPRESSION_REGEX);
|
@@ -193,7 +193,7 @@ namespace snowcrash {
|
|
193
193
|
return innerExpression.substr(0, 1) == ";";
|
194
194
|
}
|
195
195
|
};
|
196
|
-
|
196
|
+
|
197
197
|
/**
|
198
198
|
* \brief level three form style query continuation expansion URI template expression.
|
199
199
|
*/
|
@@ -30,7 +30,7 @@ namespace snowcrash {
|
|
30
30
|
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
31
31
|
const MarkdownNodes& siblings,
|
32
32
|
SectionParserData& pd,
|
33
|
-
|
33
|
+
const ParseResultRef<Values>& out) {
|
34
34
|
|
35
35
|
if (pd.sectionContext() == ValueSectionType) {
|
36
36
|
|
@@ -70,7 +70,7 @@ namespace snowcrash {
|
|
70
70
|
static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,
|
71
71
|
const MarkdownNodes& siblings,
|
72
72
|
SectionParserData& pd,
|
73
|
-
|
73
|
+
const ParseResultRef<Values>& out) {
|
74
74
|
|
75
75
|
return node;
|
76
76
|
}
|
data/ext/snowcrash/src/Version.h
CHANGED
@@ -9,19 +9,21 @@
|
|
9
9
|
#include "csnowcrash.h"
|
10
10
|
#include "snowcrash.h"
|
11
11
|
|
12
|
+
using namespace snowcrash;
|
13
|
+
|
12
14
|
int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint, sc_sm_blueprint_t** sm_blueprint)
|
13
15
|
{
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
Report* resultReport = ::new snowcrash::Report;
|
17
|
+
Blueprint* resultblueprint = ::new snowcrash::Blueprint;
|
18
|
+
SourceMap<snowcrash::Blueprint>* resultSourceMap = ::new SourceMap<snowcrash::Blueprint>;
|
17
19
|
|
18
|
-
|
20
|
+
ParseResultRef<Blueprint> result(*resultReport, *resultblueprint, *resultSourceMap);
|
19
21
|
|
20
|
-
int ret = snowcrash::parse(source, option,
|
22
|
+
int ret = snowcrash::parse(source, option, result);
|
21
23
|
|
22
|
-
*report = AS_TYPE(sc_report_t,
|
23
|
-
*blueprint = AS_TYPE(sc_blueprint_t,
|
24
|
-
*sm_blueprint = AS_TYPE(sc_sm_blueprint_t,
|
24
|
+
*report = AS_TYPE(sc_report_t, resultReport);
|
25
|
+
*blueprint = AS_TYPE(sc_blueprint_t, resultblueprint);
|
26
|
+
*sm_blueprint = AS_TYPE(sc_sm_blueprint_t, resultSourceMap);
|
25
27
|
|
26
28
|
return ret;
|
27
29
|
}
|
@@ -13,7 +13,7 @@ const int snowcrash::SourceAnnotation::OK = 0;
|
|
13
13
|
|
14
14
|
using namespace snowcrash;
|
15
15
|
|
16
|
-
/**
|
16
|
+
/**
|
17
17
|
* \brief Check source for unsupported character \t & \r
|
18
18
|
* \return True if passed (not found), false otherwise
|
19
19
|
*/
|
@@ -23,7 +23,7 @@ static bool CheckSource(const mdp::ByteBuffer& source, Report& report)
|
|
23
23
|
std::string::size_type pos = source.find("\t");
|
24
24
|
|
25
25
|
if (pos != std::string::npos) {
|
26
|
-
|
26
|
+
|
27
27
|
mdp::BytesRangeSet rangeSet;
|
28
28
|
rangeSet.push_back(mdp::BytesRange(pos, 1));
|
29
29
|
report.error = Error("the use of tab(s) '\\t' in source data isn't currently supported, please contact makers",
|
@@ -31,7 +31,7 @@ static bool CheckSource(const mdp::ByteBuffer& source, Report& report)
|
|
31
31
|
mdp::BytesRangeSetToCharactersRangeSet(rangeSet, source));
|
32
32
|
return false;
|
33
33
|
}
|
34
|
-
|
34
|
+
|
35
35
|
pos = source.find("\r");
|
36
36
|
|
37
37
|
if (pos != std::string::npos) {
|
@@ -43,20 +43,20 @@ static bool CheckSource(const mdp::ByteBuffer& source, Report& report)
|
|
43
43
|
mdp::BytesRangeSetToCharactersRangeSet(rangeSet, source));
|
44
44
|
return false;
|
45
45
|
}
|
46
|
-
|
46
|
+
|
47
47
|
return true;
|
48
48
|
}
|
49
49
|
|
50
50
|
int snowcrash::parse(const mdp::ByteBuffer& source,
|
51
51
|
BlueprintParserOptions options,
|
52
|
-
|
52
|
+
const ParseResultRef<Blueprint>& out)
|
53
53
|
{
|
54
54
|
try {
|
55
|
-
|
55
|
+
|
56
56
|
// Sanity Check
|
57
57
|
if (!CheckSource(source, out.report))
|
58
58
|
return out.report.error.code;
|
59
|
-
|
59
|
+
|
60
60
|
// Do nothing if blueprint is empty
|
61
61
|
if (source.empty())
|
62
62
|
return out.report.error.code;
|
@@ -73,13 +73,13 @@ int snowcrash::parse(const mdp::ByteBuffer& source,
|
|
73
73
|
BlueprintParser::parse(markdownAST.children().begin(), markdownAST.children(), pd, out);
|
74
74
|
}
|
75
75
|
catch (const std::exception& e) {
|
76
|
-
|
76
|
+
|
77
77
|
std::stringstream ss;
|
78
78
|
ss << "parser exception: '" << e.what() << "'";
|
79
79
|
out.report.error = Error(ss.str(), 1);
|
80
80
|
}
|
81
81
|
catch (...) {
|
82
|
-
|
82
|
+
|
83
83
|
out.report.error = Error("parser exception has occured", 1);
|
84
84
|
}
|
85
85
|
|
@@ -22,25 +22,23 @@
|
|
22
22
|
* For Snow Crash users, this is the only interface to use.
|
23
23
|
*
|
24
24
|
* For binding writers, this is the point to start wrapping.
|
25
|
-
* Refer to https://github.com/apiaryio/snowcrash/wiki/Writing-a-binding
|
25
|
+
* Refer to https://github.com/apiaryio/snowcrash/wiki/Writing-a-binding
|
26
26
|
* for details on how to write a Snow Crash binding.
|
27
27
|
*/
|
28
28
|
|
29
29
|
namespace snowcrash {
|
30
|
-
|
30
|
+
|
31
31
|
/**
|
32
32
|
* \brief Parse the source data into a blueprint abstract source tree (AST).
|
33
33
|
*
|
34
|
-
* \param source
|
35
|
-
* \param options
|
36
|
-
* \param
|
37
|
-
* \param blueprint Parsed blueprint AST.
|
38
|
-
* \param blueprintSM Blueprint sourcemap AST
|
34
|
+
* \param source A textual source data to be parsed.
|
35
|
+
* \param options Parser options. Use 0 for no additional options.
|
36
|
+
* \param out Output buffer to store parsing result into.
|
39
37
|
* \return Error status code. Zero represents success, non-zero a failure.
|
40
38
|
*/
|
41
39
|
int parse(const mdp::ByteBuffer& source,
|
42
40
|
BlueprintParserOptions options,
|
43
|
-
|
41
|
+
const ParseResultRef<Blueprint>& out);
|
44
42
|
}
|
45
43
|
|
46
44
|
#endif
|