redsnow 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -37,15 +37,15 @@ enum SerializationFormat {
|
|
37
37
|
void PrintAnnotation(const std::string& prefix, const snowcrash::SourceAnnotation& annotation)
|
38
38
|
{
|
39
39
|
std::cerr << prefix;
|
40
|
-
|
40
|
+
|
41
41
|
if (annotation.code != SourceAnnotation::OK) {
|
42
42
|
std::cerr << " (" << annotation.code << ") ";
|
43
43
|
}
|
44
|
-
|
44
|
+
|
45
45
|
if (!annotation.message.empty()) {
|
46
46
|
std::cerr << " " << annotation.message;
|
47
47
|
}
|
48
|
-
|
48
|
+
|
49
49
|
if (!annotation.location.empty()) {
|
50
50
|
for (mdp::CharactersRangeSet::const_iterator it = annotation.location.begin();
|
51
51
|
it != annotation.location.end();
|
@@ -54,7 +54,7 @@ void PrintAnnotation(const std::string& prefix, const snowcrash::SourceAnnotatio
|
|
54
54
|
std::cerr << it->location << ":" << it->length;
|
55
55
|
}
|
56
56
|
}
|
57
|
-
|
57
|
+
|
58
58
|
std::cerr << std::endl;
|
59
59
|
}
|
60
60
|
|
@@ -96,15 +96,15 @@ int main(int argc, const char *argv[])
|
|
96
96
|
argumentParser.add("help", 'h', "display this help message");
|
97
97
|
argumentParser.add(VersionArgument, 'v', "print Snow Crash version");
|
98
98
|
argumentParser.add(ValidateArgument, 'l', "validate input only, do not print AST");
|
99
|
-
|
99
|
+
|
100
100
|
argumentParser.parse_check(argc, argv);
|
101
|
-
|
101
|
+
|
102
102
|
// Check arguments
|
103
103
|
if (argumentParser.rest().size() > 1) {
|
104
104
|
std::cerr << "one input file expected, got " << argumentParser.rest().size() << std::endl;
|
105
105
|
exit(EXIT_FAILURE);
|
106
106
|
}
|
107
|
-
|
107
|
+
|
108
108
|
// Version query
|
109
109
|
if (argumentParser.exist(VersionArgument)) {
|
110
110
|
std::cout << SNOWCRASH_VERSION_STRING << std::endl;
|
@@ -127,7 +127,7 @@ int main(int argc, const char *argv[])
|
|
127
127
|
std::cerr << "fatal: unable to open input file '" << inputFileName << "'\n";
|
128
128
|
exit(EXIT_FAILURE);
|
129
129
|
}
|
130
|
-
|
130
|
+
|
131
131
|
inputStream << inputFileStream.rdbuf();
|
132
132
|
inputFileStream.close();
|
133
133
|
}
|
@@ -145,7 +145,7 @@ int main(int argc, const char *argv[])
|
|
145
145
|
|
146
146
|
// Output
|
147
147
|
if (!argumentParser.exist(ValidateArgument)) {
|
148
|
-
|
148
|
+
|
149
149
|
std::stringstream outputStream;
|
150
150
|
std::stringstream sourcemapOutputStream;
|
151
151
|
|
@@ -157,7 +157,7 @@ int main(int argc, const char *argv[])
|
|
157
157
|
SerializeYAML(blueprint.node, outputStream);
|
158
158
|
SerializeSourceMapYAML(blueprint.sourceMap, sourcemapOutputStream);
|
159
159
|
}
|
160
|
-
|
160
|
+
|
161
161
|
std::string outputFileName = argumentParser.get<std::string>(OutputArgument);
|
162
162
|
std::string sourcemapOutputFileName = argumentParser.get<std::string>(SourcemapArgument);
|
163
163
|
|
@@ -170,7 +170,7 @@ int main(int argc, const char *argv[])
|
|
170
170
|
std::cerr << "fatal: unable to write to file '" << outputFileName << "'\n";
|
171
171
|
exit(EXIT_FAILURE);
|
172
172
|
}
|
173
|
-
|
173
|
+
|
174
174
|
outputFileStream << outputStream.rdbuf();
|
175
175
|
outputFileStream.close();
|
176
176
|
}
|
@@ -178,17 +178,17 @@ int main(int argc, const char *argv[])
|
|
178
178
|
// Serialize to stdout
|
179
179
|
std::cout << outputStream.rdbuf();
|
180
180
|
}
|
181
|
-
|
181
|
+
|
182
182
|
if (!sourcemapOutputFileName.empty()) {
|
183
183
|
// Serialize to file
|
184
184
|
std::ofstream sourcemapOutputFileStream;
|
185
185
|
sourcemapOutputFileStream.open(sourcemapOutputFileName.c_str());
|
186
|
-
|
186
|
+
|
187
187
|
if (!sourcemapOutputFileStream.is_open()) {
|
188
188
|
std::cerr << "fatal: unable to write to file '" << sourcemapOutputFileName << "'\n";
|
189
189
|
exit(EXIT_FAILURE);
|
190
190
|
}
|
191
|
-
|
191
|
+
|
192
192
|
sourcemapOutputFileStream << sourcemapOutputStream.rdbuf();
|
193
193
|
sourcemapOutputFileStream.close();
|
194
194
|
}
|
@@ -23,7 +23,7 @@ bool snowcrash::RegexMatch(const string& target, const string& expression)
|
|
23
23
|
{
|
24
24
|
if (target.empty() || expression.empty())
|
25
25
|
return false;
|
26
|
-
|
26
|
+
|
27
27
|
try {
|
28
28
|
regex pattern(expression, regex_constants::extended);
|
29
29
|
return regex_search(target, pattern);
|
@@ -32,7 +32,7 @@ bool snowcrash::RegexMatch(const string& target, const string& expression)
|
|
32
32
|
}
|
33
33
|
catch (...) {
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
return false;
|
37
37
|
}
|
38
38
|
|
@@ -42,7 +42,7 @@ string snowcrash::RegexCaptureFirst(const string& target, const string& expressi
|
|
42
42
|
if (!RegexCapture(target, expression, groups) ||
|
43
43
|
groups.size() < 2)
|
44
44
|
return string();
|
45
|
-
|
45
|
+
|
46
46
|
return groups[1];
|
47
47
|
}
|
48
48
|
|
@@ -50,16 +50,16 @@ bool snowcrash::RegexCapture(const string& target, const string& expression, Cap
|
|
50
50
|
{
|
51
51
|
if (target.empty() || expression.empty())
|
52
52
|
return false;
|
53
|
-
|
53
|
+
|
54
54
|
captureGroups.clear();
|
55
55
|
|
56
56
|
try {
|
57
|
-
|
57
|
+
|
58
58
|
regex pattern(expression, regex_constants::extended);
|
59
59
|
match_results<string::const_iterator> result;
|
60
60
|
if (!regex_search(target, result, pattern))
|
61
61
|
return false;
|
62
|
-
|
62
|
+
|
63
63
|
for (match_results<string::const_iterator>::const_iterator it = result.begin();
|
64
64
|
it != result.end();
|
65
65
|
++it) {
|
@@ -73,6 +73,6 @@ bool snowcrash::RegexCapture(const string& target, const string& expression, Cap
|
|
73
73
|
}
|
74
74
|
catch (...) {
|
75
75
|
}
|
76
|
-
|
76
|
+
|
77
77
|
return false;
|
78
78
|
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/redsnow/binding.rb
CHANGED
@@ -55,11 +55,14 @@ module RedSnow
|
|
55
55
|
attach_function("sc_payload_handle", "sc_payload_handle", [ :pointer, :int ], :pointer)
|
56
56
|
attach_function("sc_payload_handle_resource", "sc_payload_handle_resource", [ :pointer ], :pointer)
|
57
57
|
attach_function("sc_payload_name", "sc_payload_name", [ :pointer ], :string)
|
58
|
-
attach_function("sc_payload_symbol", "sc_payload_symbol", [ :pointer ], :string)
|
59
58
|
attach_function("sc_payload_description", "sc_payload_description", [ :pointer ], :string)
|
60
59
|
attach_function("sc_payload_body", "sc_payload_body", [ :pointer ], :string)
|
61
60
|
attach_function("sc_payload_schema", "sc_payload_schema", [ :pointer ], :string)
|
62
61
|
|
62
|
+
# Payload Reference
|
63
|
+
attach_function("sc_reference_handle_payload", "sc_reference_handle_payload", [ :pointer ], :pointer)
|
64
|
+
attach_function("sc_reference_id", "sc_reference_id", [ :pointer ], :string)
|
65
|
+
|
63
66
|
attach_function("sc_parameter_collection_handle_payload", "sc_parameter_collection_handle_payload", [ :pointer ], :pointer)
|
64
67
|
attach_function("sc_parameter_collection_handle_resource", "sc_parameter_collection_handle_resource", [ :pointer ], :pointer)
|
65
68
|
attach_function("sc_parameter_collection_handle_action", "sc_parameter_collection_handle_action", [ :pointer ], :pointer)
|
@@ -165,11 +168,14 @@ module RedSnow
|
|
165
168
|
attach_function("sc_sm_payload_handle", "sc_sm_payload_handle", [ :pointer, :int ], :pointer)
|
166
169
|
attach_function("sc_sm_payload_handle_resource", "sc_sm_payload_handle_resource", [ :pointer ], :pointer)
|
167
170
|
attach_function("sc_sm_payload_name", "sc_sm_payload_name", [ :pointer ], :pointer)
|
168
|
-
attach_function("sc_sm_payload_symbol", "sc_sm_payload_symbol", [ :pointer ], :pointer)
|
169
171
|
attach_function("sc_sm_payload_description", "sc_sm_payload_description", [ :pointer ], :pointer)
|
170
172
|
attach_function("sc_sm_payload_body", "sc_sm_payload_body", [ :pointer ], :pointer)
|
171
173
|
attach_function("sc_sm_payload_schema", "sc_sm_payload_schema", [ :pointer ], :pointer)
|
172
174
|
|
175
|
+
# Payload Reference Soure Map
|
176
|
+
attach_function("sc_sm_reference_handle", "sc_sm_reference_handle", [ :pointer ], :pointer)
|
177
|
+
attach_function("sc_sm_reference", "sc_sm_reference", [ :pointer ], :pointer)
|
178
|
+
|
173
179
|
attach_function("sc_sm_parameter_collection_handle_payload", "sc_sm_parameter_collection_handle_payload", [ :pointer ], :pointer)
|
174
180
|
attach_function("sc_sm_parameter_collection_handle_resource", "sc_sm_parameter_collection_handle_resource", [ :pointer ], :pointer)
|
175
181
|
attach_function("sc_sm_parameter_collection_handle_action", "sc_sm_parameter_collection_handle_action", [ :pointer ], :pointer)
|
data/lib/redsnow/blueprint.rb
CHANGED
@@ -226,10 +226,11 @@ module RedSnow
|
|
226
226
|
@body = RedSnow::Binding.sc_payload_body(sc_payload_handle_resource)
|
227
227
|
@schema = RedSnow::Binding.sc_payload_schema(sc_payload_handle_resource)
|
228
228
|
|
229
|
-
|
229
|
+
sc_reference_handle_payload = RedSnow::Binding.sc_reference_handle_payload(sc_payload_handle_resource)
|
230
|
+
sc_reference_id = RedSnow::Binding.sc_reference_id(sc_reference_handle_payload)
|
230
231
|
|
231
|
-
if not
|
232
|
-
@reference = ReferenceNode.new(
|
232
|
+
if not sc_reference_id.empty?
|
233
|
+
@reference = ReferenceNode.new(sc_reference_id)
|
233
234
|
end
|
234
235
|
|
235
236
|
sc_header_collection_handle_payload = RedSnow::Binding.sc_header_collection_handle_payload(sc_payload_handle_resource)
|
data/lib/redsnow/sourcemap.rb
CHANGED
@@ -168,11 +168,13 @@ module RedSnow
|
|
168
168
|
@body = SourceMap.new(RedSnow::Binding.sc_sm_payload_body(sc_sm_payload_handle_resource))
|
169
169
|
@schema = SourceMap.new(RedSnow::Binding.sc_sm_payload_schema(sc_sm_payload_handle_resource))
|
170
170
|
|
171
|
-
|
172
|
-
|
171
|
+
# Handle to reference source map
|
172
|
+
sc_sm_reference_handle = RedSnow::Binding.sc_sm_reference_handle(sc_sm_payload_handle_resource)
|
173
|
+
sc_sm_reference = RedSnow::Binding.sc_sm_reference(sc_sm_reference_handle)
|
174
|
+
reference_source_map_size = RedSnow::Binding.sc_source_map_size(sc_sm_reference)
|
173
175
|
|
174
|
-
if
|
175
|
-
@reference = SourceMap.new(
|
176
|
+
if reference_source_map_size != 0
|
177
|
+
@reference = SourceMap.new(sc_sm_reference)
|
176
178
|
end
|
177
179
|
|
178
180
|
sc_sm_header_collection_handle_payload = RedSnow::Binding.sc_sm_header_collection_handle_payload(sc_sm_payload_handle_resource)
|
data/lib/redsnow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redsnow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ladislav Prskavec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -158,10 +158,6 @@ files:
|
|
158
158
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o
|
159
159
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o
|
160
160
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o
|
161
|
-
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/MarkdownBlock.o
|
162
|
-
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/MarkdownParser.o
|
163
|
-
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Parser.o
|
164
|
-
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/ParserCore.o
|
165
161
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o
|
166
162
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o
|
167
163
|
- ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o
|
@@ -181,20 +177,10 @@ files:
|
|
181
177
|
- ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/src_map.o
|
182
178
|
- ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o
|
183
179
|
- ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o
|
184
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/houdini_href_e.o
|
185
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/houdini_html_e.o
|
186
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/html.o
|
187
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/html_smartypants.o
|
188
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/src/autolink.o
|
189
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/src/buffer.o
|
190
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/src/markdown.o
|
191
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/src/src_map.o
|
192
|
-
- ext/snowcrash/build/out/Release/obj.target/sundown/sundown/src/stack.o
|
193
180
|
- ext/snowcrash/build/out/Release/snowcrash
|
194
181
|
- ext/snowcrash/build/perf-libsnowcrash.target.mk
|
195
182
|
- ext/snowcrash/build/snowcrash.Makefile
|
196
183
|
- ext/snowcrash/build/snowcrash.target.mk
|
197
|
-
- ext/snowcrash/build/sundown.target.mk
|
198
184
|
- ext/snowcrash/common.gypi
|
199
185
|
- ext/snowcrash/config.gypi
|
200
186
|
- ext/snowcrash/config.mk
|
@@ -235,6 +221,7 @@ files:
|
|
235
221
|
- ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h
|
236
222
|
- ext/snowcrash/provisioning.sh
|
237
223
|
- ext/snowcrash/snowcrash.gyp
|
224
|
+
- ext/snowcrash/snowcrash.xcworkspace/contents.xcworkspacedata
|
238
225
|
- ext/snowcrash/src/ActionParser.h
|
239
226
|
- ext/snowcrash/src/AssetParser.h
|
240
227
|
- ext/snowcrash/src/Blueprint.h
|
@@ -385,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
385
372
|
version: '0'
|
386
373
|
requirements: []
|
387
374
|
rubyforge_project:
|
388
|
-
rubygems_version: 2.2.
|
375
|
+
rubygems_version: 2.2.0
|
389
376
|
signing_key:
|
390
377
|
specification_version: 4
|
391
378
|
summary: Ruby bindings for Snow Crash
|