redsnow 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/ext/snowcrash/Makefile +1 -1
  4. data/ext/snowcrash/bin/snowcrash +0 -0
  5. data/ext/snowcrash/configure +9 -9
  6. data/ext/snowcrash/ext/markdown-parser/Makefile +87 -0
  7. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/CONTRIBUTING.md +0 -0
  8. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/Makefile +2 -1
  9. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/Makefile.win +0 -0
  10. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/examples/smartypants.c +0 -0
  11. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/examples/sundown.c +0 -0
  12. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini.h +0 -0
  13. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini_href_e.c +0 -0
  14. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/houdini_html_e.c +0 -0
  15. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html.c +0 -0
  16. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html.h +0 -0
  17. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html/html_smartypants.c +0 -0
  18. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/html_block_names.txt +0 -0
  19. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/autolink.c +0 -0
  20. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/autolink.h +0 -0
  21. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/buffer.c +0 -0
  22. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/buffer.h +1 -1
  23. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/html_blocks.h +0 -0
  24. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/markdown.c +9 -3
  25. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/markdown.h +0 -0
  26. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/src_map.c +11 -7
  27. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/src_map.h +1 -1
  28. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/stack.c +0 -0
  29. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/src/stack.h +0 -0
  30. data/ext/snowcrash/{sundown → ext/markdown-parser/ext/sundown}/sundown.def +0 -0
  31. data/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
  32. data/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
  33. data/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
  34. data/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +92 -0
  35. data/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +82 -0
  36. data/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
  37. data/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
  38. data/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
  39. data/ext/snowcrash/{src → ext/markdown-parser/src}/MarkdownParser.h +43 -33
  40. data/ext/snowcrash/snowcrash.gyp +114 -63
  41. data/ext/snowcrash/src/ActionParser.h +334 -398
  42. data/ext/snowcrash/src/AssetParser.h +82 -171
  43. data/ext/snowcrash/src/Blueprint.h +7 -2
  44. data/ext/snowcrash/src/BlueprintParser.h +212 -286
  45. data/ext/snowcrash/src/BlueprintUtility.h +2 -2
  46. data/ext/snowcrash/src/CBlueprint.h +1 -1
  47. data/ext/snowcrash/src/CSourceAnnotation.cc +11 -11
  48. data/ext/snowcrash/src/CSourceAnnotation.h +9 -9
  49. data/ext/snowcrash/src/CodeBlockUtility.h +199 -149
  50. data/ext/snowcrash/src/HeadersParser.h +197 -0
  51. data/ext/snowcrash/src/ParameterParser.h +429 -0
  52. data/ext/snowcrash/src/ParametersParser.h +136 -211
  53. data/ext/snowcrash/src/PayloadParser.h +458 -562
  54. data/ext/snowcrash/src/Platform.h +0 -3
  55. data/ext/snowcrash/src/ResourceGroupParser.h +183 -164
  56. data/ext/snowcrash/src/ResourceParser.h +325 -493
  57. data/ext/snowcrash/src/Section.cc +42 -0
  58. data/ext/snowcrash/src/Section.h +47 -0
  59. data/ext/snowcrash/src/SectionParser.h +229 -0
  60. data/ext/snowcrash/src/SectionParserData.h +81 -0
  61. data/ext/snowcrash/src/SectionProcessor.h +211 -0
  62. data/ext/snowcrash/src/Signature.cc +74 -0
  63. data/ext/snowcrash/src/Signature.h +32 -0
  64. data/ext/snowcrash/src/SourceAnnotation.h +7 -20
  65. data/ext/snowcrash/src/StringUtility.h +30 -10
  66. data/ext/snowcrash/src/SymbolTable.h +7 -7
  67. data/ext/snowcrash/src/UriTemplateParser.cc +10 -10
  68. data/ext/snowcrash/src/UriTemplateParser.h +11 -14
  69. data/ext/snowcrash/src/ValuesParser.h +122 -0
  70. data/ext/snowcrash/src/Version.h +2 -2
  71. data/ext/snowcrash/src/csnowcrash.cc +5 -5
  72. data/ext/snowcrash/src/csnowcrash.h +3 -3
  73. data/ext/snowcrash/src/snowcrash.cc +74 -4
  74. data/ext/snowcrash/src/snowcrash.h +9 -4
  75. data/ext/snowcrash/src/snowcrash/snowcrash.cc +16 -16
  76. data/ext/snowcrash/tools/homebrew/snowcrash.rb +3 -2
  77. data/ext/snowcrash/vcbuild.bat +13 -4
  78. data/lib/redsnow.rb +5 -5
  79. data/lib/redsnow/binding.rb +1 -1
  80. data/lib/redsnow/blueprint.rb +33 -2
  81. data/lib/redsnow/parseresult.rb +7 -4
  82. data/lib/redsnow/version.rb +1 -1
  83. data/test/redsnow_binding_test.rb +6 -6
  84. data/test/redsnow_parseresult_test.rb +1 -1
  85. metadata +62 -42
  86. data/ext/snowcrash/src/BlockUtility.h +0 -186
  87. data/ext/snowcrash/src/BlueprintParserCore.h +0 -190
  88. data/ext/snowcrash/src/BlueprintSection.h +0 -140
  89. data/ext/snowcrash/src/DescriptionSectionUtility.h +0 -156
  90. data/ext/snowcrash/src/HeaderParser.h +0 -289
  91. data/ext/snowcrash/src/ListBlockUtility.h +0 -273
  92. data/ext/snowcrash/src/ListUtility.h +0 -95
  93. data/ext/snowcrash/src/MarkdownBlock.cc +0 -176
  94. data/ext/snowcrash/src/MarkdownBlock.h +0 -93
  95. data/ext/snowcrash/src/MarkdownParser.cc +0 -266
  96. data/ext/snowcrash/src/ParameterDefinitonParser.h +0 -645
  97. data/ext/snowcrash/src/Parser.cc +0 -71
  98. data/ext/snowcrash/src/Parser.h +0 -29
  99. data/ext/snowcrash/src/ParserCore.cc +0 -120
  100. data/ext/snowcrash/src/ParserCore.h +0 -82
  101. data/ext/snowcrash/src/SectionUtility.h +0 -142
@@ -15,13 +15,14 @@ module RedSnow
15
15
  # Supported version of Api Blueprint
16
16
  SUPPORTED_VERSIONS = ["2.0"]
17
17
 
18
- # @param result_handle [FFI::Pointer]
19
- def initialize(blueprint_handle, result_handle)
18
+ # @param report_handle [FFI::Pointer]
19
+ def initialize(blueprint_handle, report_handle)
20
20
 
21
21
  @ast = Blueprint.new(blueprint_handle)
22
- warnings = RedSnow::Binding.sc_warnings_handler(result_handle)
22
+ warnings = RedSnow::Binding.sc_warnings_handler(report_handle)
23
23
  warningsSize = RedSnow::Binding.sc_warnings_size(warnings)
24
24
  @warnings = Array.new
25
+
25
26
  for index in 0..(warningsSize - 1) do
26
27
  sc_warning_handler = RedSnow::Binding.sc_warning_handler(warnings, index)
27
28
 
@@ -33,6 +34,7 @@ module RedSnow
33
34
  sc_location_handler = RedSnow::Binding.sc_location_handler(sc_warning_handler)
34
35
  sc_location_size = RedSnow::Binding.sc_location_size(sc_location_handler)
35
36
  warning[:location] = Array.new
37
+
36
38
  if sc_location_size > 0
37
39
  for index in 0..(sc_location_size - 1)
38
40
  location = Location.new(sc_location_handler, index)
@@ -42,7 +44,7 @@ module RedSnow
42
44
  @warnings << warning
43
45
  end
44
46
 
45
- error_handler = RedSnow::Binding.sc_error_handler(result_handle)
47
+ error_handler = RedSnow::Binding.sc_error_handler(report_handle)
46
48
  @error = Hash.new
47
49
  @error[:message] = RedSnow::Binding.sc_error_message(error_handler)
48
50
  @error[:code] = RedSnow::Binding.sc_error_code(error_handler)
@@ -51,6 +53,7 @@ module RedSnow
51
53
  sc_location_handler = RedSnow::Binding.sc_location_handler(error_handler)
52
54
  sc_location_size = RedSnow::Binding.sc_location_size(sc_location_handler)
53
55
  @error[:location] = Array.new
56
+
54
57
  if sc_location_size > 0
55
58
  for index in 0..(sc_location_size - 1) do
56
59
  location = Location.new(sc_location_handler, index)
@@ -1,4 +1,4 @@
1
1
  module RedSnow
2
2
  # Gem version
3
- VERSION = "0.1.6"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -6,12 +6,12 @@ class RedSnowBindingTest < Test::Unit::TestCase
6
6
  should "convert API Blueprint to AST" do
7
7
 
8
8
  blueprint = FFI::MemoryPointer.new :pointer
9
- result = FFI::MemoryPointer.new :pointer
9
+ report = FFI::MemoryPointer.new :pointer
10
10
 
11
- ret = RedSnow::Binding.sc_c_parse("meta: data\nfoo:bar\n#XXXX\ndescription for it", 0, result, blueprint)
11
+ ret = RedSnow::Binding.sc_c_parse("meta: data\nfoo:bar\n#XXXX\ndescription for it", 0, report, blueprint)
12
12
 
13
13
  blueprint = blueprint.get_pointer(0)
14
- result = result.get_pointer(0)
14
+ report = report.get_pointer(0)
15
15
  assert_equal "XXXX", RedSnow::Binding.sc_blueprint_name(blueprint)
16
16
 
17
17
  assert_equal "description for it", RedSnow::Binding.sc_blueprint_description(blueprint)
@@ -19,16 +19,16 @@ class RedSnowBindingTest < Test::Unit::TestCase
19
19
  meta_data_col = RedSnow::Binding.sc_metadata_collection_handle(blueprint)
20
20
  assert_equal 2, RedSnow::Binding.sc_metadata_collection_size(meta_data_col)
21
21
 
22
- warnings = RedSnow::Binding.sc_warnings_handler(result)
22
+ warnings = RedSnow::Binding.sc_warnings_handler(report)
23
23
  assert_equal 0, RedSnow::Binding.sc_warnings_size(warnings)
24
24
 
25
- error = RedSnow::Binding.sc_error_handler(result)
25
+ error = RedSnow::Binding.sc_error_handler(report)
26
26
  assert_equal '', RedSnow::Binding.sc_error_message(error)
27
27
  assert_equal 0, RedSnow::Binding.sc_error_code(error)
28
28
  assert_equal 0, RedSnow::Binding.sc_error_ok(error)
29
29
 
30
30
  RedSnow::Binding.sc_blueprint_free(blueprint)
31
- RedSnow::Binding.sc_result_free(result)
31
+ RedSnow::Binding.sc_report_free(report)
32
32
 
33
33
  end
34
34
  end
@@ -37,7 +37,7 @@ class RedSnowParseResultTest < Test::Unit::TestCase
37
37
 
38
38
  should "have some warning" do
39
39
  assert_equal RedSnow::WarningCodes::EmptyDefinitionWarning, @result.warnings[0][:code]
40
- assert_equal "no response defined for 'GET /'", @result.warnings[0][:message]
40
+ assert_equal "action is missing a response", @result.warnings[0][:message]
41
41
 
42
42
  assert_equal 20, @result.warnings[0][:location][0].index
43
43
  assert_equal 9, @result.warnings[0][:location][0].length
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redsnow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ladislav Prskavec
@@ -144,10 +144,16 @@ files:
144
144
  - ext/snowcrash/bin/snowcrash
145
145
  - ext/snowcrash/build/Makefile
146
146
  - ext/snowcrash/build/gyp-mac-tool
147
+ - ext/snowcrash/build/libmarkdownparser.target.mk
147
148
  - ext/snowcrash/build/libsnowcrash.target.mk
149
+ - ext/snowcrash/build/libsundown.target.mk
150
+ - ext/snowcrash/build/out/Release/libmarkdownparser.a
148
151
  - ext/snowcrash/build/out/Release/libsnowcrash.dylib
149
152
  - ext/snowcrash/build/out/Release/libsundown.a
150
153
  - ext/snowcrash/build/out/Release/linker.lock
154
+ - ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o
155
+ - ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o
156
+ - ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o
151
157
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o
152
158
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o
153
159
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o
@@ -155,13 +161,24 @@ files:
155
161
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/MarkdownParser.o
156
162
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Parser.o
157
163
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/ParserCore.o
164
+ - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o
158
165
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o
159
166
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o
160
167
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o
168
+ - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o
161
169
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o
162
170
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o
163
171
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o
164
172
  - ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o
173
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o
174
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o
175
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/html.o
176
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/html_smartypants.o
177
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/autolink.o
178
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/buffer.o
179
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/markdown.o
180
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/src_map.o
181
+ - ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o
165
182
  - ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o
166
183
  - ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/houdini_href_e.o
167
184
  - ext/snowcrash/build/out/Release/obj.target/sundown/sundown/html/houdini_html_e.o
@@ -181,54 +198,81 @@ files:
181
198
  - ext/snowcrash/config.gypi
182
199
  - ext/snowcrash/config.mk
183
200
  - ext/snowcrash/configure
201
+ - ext/snowcrash/ext/markdown-parser/Makefile
202
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/CONTRIBUTING.md
203
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile
204
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile.win
205
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/examples/smartypants.c
206
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/examples/sundown.c
207
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini.h
208
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.c
209
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.c
210
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.c
211
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.h
212
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.c
213
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/html_block_names.txt
214
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.c
215
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.h
216
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.c
217
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.h
218
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/html_blocks.h
219
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c
220
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.h
221
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.c
222
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.h
223
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.c
224
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.h
225
+ - ext/snowcrash/ext/markdown-parser/ext/sundown/sundown.def
226
+ - ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj
227
+ - ext/snowcrash/ext/markdown-parser/msvc/msvc.sln
228
+ - ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj
229
+ - ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc
230
+ - ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h
231
+ - ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc
232
+ - ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h
233
+ - ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc
234
+ - ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h
184
235
  - ext/snowcrash/provisioning.sh
185
236
  - ext/snowcrash/snowcrash.gyp
186
237
  - ext/snowcrash/src/ActionParser.h
187
238
  - ext/snowcrash/src/AssetParser.h
188
- - ext/snowcrash/src/BlockUtility.h
189
239
  - ext/snowcrash/src/Blueprint.h
190
240
  - ext/snowcrash/src/BlueprintParser.h
191
- - ext/snowcrash/src/BlueprintParserCore.h
192
- - ext/snowcrash/src/BlueprintSection.h
193
241
  - ext/snowcrash/src/BlueprintUtility.h
194
242
  - ext/snowcrash/src/CBlueprint.cc
195
243
  - ext/snowcrash/src/CBlueprint.h
196
244
  - ext/snowcrash/src/CSourceAnnotation.cc
197
245
  - ext/snowcrash/src/CSourceAnnotation.h
198
246
  - ext/snowcrash/src/CodeBlockUtility.h
199
- - ext/snowcrash/src/DescriptionSectionUtility.h
200
247
  - ext/snowcrash/src/HTTP.cc
201
248
  - ext/snowcrash/src/HTTP.h
202
- - ext/snowcrash/src/HeaderParser.h
203
- - ext/snowcrash/src/ListBlockUtility.h
204
- - ext/snowcrash/src/ListUtility.h
205
- - ext/snowcrash/src/MarkdownBlock.cc
206
- - ext/snowcrash/src/MarkdownBlock.h
207
- - ext/snowcrash/src/MarkdownParser.cc
208
- - ext/snowcrash/src/MarkdownParser.h
209
- - ext/snowcrash/src/ParameterDefinitonParser.h
249
+ - ext/snowcrash/src/HeadersParser.h
250
+ - ext/snowcrash/src/ParameterParser.h
210
251
  - ext/snowcrash/src/ParametersParser.h
211
- - ext/snowcrash/src/Parser.cc
212
- - ext/snowcrash/src/Parser.h
213
- - ext/snowcrash/src/ParserCore.cc
214
- - ext/snowcrash/src/ParserCore.h
215
252
  - ext/snowcrash/src/PayloadParser.h
216
253
  - ext/snowcrash/src/Platform.h
217
254
  - ext/snowcrash/src/RegexMatch.h
218
255
  - ext/snowcrash/src/ResourceGroupParser.h
219
256
  - ext/snowcrash/src/ResourceParser.h
220
- - ext/snowcrash/src/SectionUtility.h
257
+ - ext/snowcrash/src/Section.cc
258
+ - ext/snowcrash/src/Section.h
259
+ - ext/snowcrash/src/SectionParser.h
260
+ - ext/snowcrash/src/SectionParserData.h
261
+ - ext/snowcrash/src/SectionProcessor.h
221
262
  - ext/snowcrash/src/Serialize.cc
222
263
  - ext/snowcrash/src/Serialize.h
223
264
  - ext/snowcrash/src/SerializeJSON.cc
224
265
  - ext/snowcrash/src/SerializeJSON.h
225
266
  - ext/snowcrash/src/SerializeYAML.cc
226
267
  - ext/snowcrash/src/SerializeYAML.h
268
+ - ext/snowcrash/src/Signature.cc
269
+ - ext/snowcrash/src/Signature.h
227
270
  - ext/snowcrash/src/SourceAnnotation.h
228
271
  - ext/snowcrash/src/StringUtility.h
229
272
  - ext/snowcrash/src/SymbolTable.h
230
273
  - ext/snowcrash/src/UriTemplateParser.cc
231
274
  - ext/snowcrash/src/UriTemplateParser.h
275
+ - ext/snowcrash/src/ValuesParser.h
232
276
  - ext/snowcrash/src/Version.h
233
277
  - ext/snowcrash/src/csnowcrash.cc
234
278
  - ext/snowcrash/src/csnowcrash.h
@@ -237,30 +281,6 @@ files:
237
281
  - ext/snowcrash/src/snowcrash.h
238
282
  - ext/snowcrash/src/snowcrash/snowcrash.cc
239
283
  - ext/snowcrash/src/win/RegexMatch.cc
240
- - ext/snowcrash/sundown/CONTRIBUTING.md
241
- - ext/snowcrash/sundown/Makefile
242
- - ext/snowcrash/sundown/Makefile.win
243
- - ext/snowcrash/sundown/examples/smartypants.c
244
- - ext/snowcrash/sundown/examples/sundown.c
245
- - ext/snowcrash/sundown/html/houdini.h
246
- - ext/snowcrash/sundown/html/houdini_href_e.c
247
- - ext/snowcrash/sundown/html/houdini_html_e.c
248
- - ext/snowcrash/sundown/html/html.c
249
- - ext/snowcrash/sundown/html/html.h
250
- - ext/snowcrash/sundown/html/html_smartypants.c
251
- - ext/snowcrash/sundown/html_block_names.txt
252
- - ext/snowcrash/sundown/src/autolink.c
253
- - ext/snowcrash/sundown/src/autolink.h
254
- - ext/snowcrash/sundown/src/buffer.c
255
- - ext/snowcrash/sundown/src/buffer.h
256
- - ext/snowcrash/sundown/src/html_blocks.h
257
- - ext/snowcrash/sundown/src/markdown.c
258
- - ext/snowcrash/sundown/src/markdown.h
259
- - ext/snowcrash/sundown/src/src_map.c
260
- - ext/snowcrash/sundown/src/src_map.h
261
- - ext/snowcrash/sundown/src/stack.c
262
- - ext/snowcrash/sundown/src/stack.h
263
- - ext/snowcrash/sundown/sundown.def
264
284
  - ext/snowcrash/tools/gyp/AUTHORS
265
285
  - ext/snowcrash/tools/gyp/DEPS
266
286
  - ext/snowcrash/tools/gyp/OWNERS
@@ -1,186 +0,0 @@
1
- //
2
- // BlockUtility.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_BLOCKUTILITY_H
10
- #define SNOWCRASH_BLOCKUTILITY_H
11
-
12
- #include "BlueprintSection.h"
13
- #include "StringUtility.h"
14
-
15
- namespace snowcrash {
16
-
17
- /**
18
- * \brief Skip to the matching closing block.
19
- * \param begin Begin of the section inside a block buffer.
20
- * \param end End of the block buffer.
21
- * \param sectionBegin A %MarkdownBlockType of the beginning.
22
- * \param sectionEnd A %MarkdownBlockType of the end.
23
- * \return An iterator pointing to the end of the section.
24
- *
25
- * Advances iterator from the begin of a section to the end
26
- * of a section at the same nesting level.
27
- */
28
- FORCEINLINE BlockIterator SkipToClosingBlock(const BlockIterator& begin,
29
- const BlockIterator& end,
30
- MarkdownBlockType sectionBegin,
31
- MarkdownBlockType sectionEnd) {
32
-
33
- BlockIterator currentBlock = begin;
34
- if (currentBlock->type == sectionBegin) {
35
- int level = 1;
36
- ++currentBlock;
37
- while (currentBlock != end && level) {
38
- if (currentBlock->type == sectionBegin)
39
- ++level;
40
-
41
- if (currentBlock->type == sectionEnd)
42
- --level;
43
-
44
- if (level)
45
- ++currentBlock;
46
- }
47
- }
48
-
49
- return currentBlock;
50
- }
51
-
52
- /**
53
- * \brief Parse one line of raw `key:value` data.
54
- * \param line A line to parse.
55
- * \param keyValuePair The output buffer to place the parsed data into.
56
- * \return True on success, false otherwise.
57
- */
58
- FORCEINLINE bool KeyValueFromLine(const std::string& line,
59
- KeyValuePair& keyValuePair) {
60
-
61
- std::vector<std::string> rawMetadata = SplitOnFirst(line, ':');
62
- if (rawMetadata.size() != 2)
63
- return false;
64
-
65
- keyValuePair = std::make_pair(rawMetadata[0], rawMetadata[1]);
66
- TrimString(keyValuePair.first);
67
- TrimString(keyValuePair.second);
68
-
69
- return (!keyValuePair.first.empty() && !keyValuePair.second.empty());
70
- }
71
-
72
- /**
73
- * \brief Construct unexpected block error message for given block.
74
- * \param section A section being parsed.
75
- * \param cue Cursor to the unexpected markdown block.
76
- * \param sourceData Source data byte buffer.
77
- * \return An Error with description relevant to the type of the unexpected block.
78
- *
79
- * This function
80
- */
81
- FORCEINLINE Error UnexpectedBlockError(const BlueprintSection& section,
82
- const BlockIterator& cur,
83
- const SourceData& sourceData) {
84
-
85
-
86
- std::stringstream ss;
87
- ss << "unexpected " << BlockName(cur->type) << " block";
88
-
89
- if (section.hasParent()) {
90
-
91
- switch (section.parent().type) {
92
-
93
- // Top-level section
94
- case UndefinedSectionType:
95
- ss << ", expected a group, resource or an action definition, e.g. ";
96
- ss << "'# Group <name>', '# <resource name> [<URI>]' or '# <HTTP method> <URI>'";
97
- break;
98
-
99
- // TODO: other sections
100
-
101
- default:
102
- break;
103
- }
104
- }
105
-
106
- return Error(ss.str(),
107
- BusinessError,
108
- MapSourceDataBlock(cur->sourceMap, sourceData));
109
- }
110
-
111
-
112
- /**
113
- * \brief Retrieves source code character map for a markdown block.
114
- * \param cur A block to retrieve the characters map for.
115
- * \param fallback Alternative block if %cur map source does not exists.
116
- * \param bounds Boundaries of the %cur and %fallback container.
117
- * \param sourceData Source data to map.
118
- * \returns Character map for given markdown block or its alternative block,
119
- * if exists. Empty source character map otherwise.
120
- */
121
- FORCEINLINE SourceCharactersBlock CharacterMapForBlock(const BlockIterator& cur,
122
- const BlockIterator& fallback,
123
- const SectionBounds& bounds,
124
- const SourceData& sourceData)
125
- {
126
- // Try to use cursor's source map
127
- if (cur != bounds.second &&
128
- !cur->sourceMap.empty()) {
129
- return MapSourceDataBlock(cur->sourceMap, sourceData);
130
- }
131
-
132
- // Fallback to alternative (previous) block
133
- if (fallback != bounds.second &&
134
- !fallback->sourceMap.empty()) {
135
- return MapSourceDataBlock(fallback->sourceMap, sourceData);
136
- }
137
-
138
- return SourceCharactersBlock();
139
- }
140
-
141
- /**
142
- * \brief Checks cursor validity within its container.
143
- * \param section A section to check against.
144
- * \param cur An iterator to be checked.
145
- * \param sourceData Source data byte buffer.
146
- * \param result Error result output, an error object is added in case of failed check.
147
- * \returns True if cursor appears to be valid, false otherwise.
148
- */
149
- FORCEINLINE bool CheckCursor(const BlueprintSection& section,
150
- const BlockIterator& cur,
151
- const SourceData& sourceData,
152
- Result& result) {
153
- if (cur != section.bounds.second)
154
- return true;
155
-
156
- if (!section.hasParent() ||
157
- section.parent().bounds.first->sourceMap.empty())
158
- return false;
159
-
160
- // ERR: Sanity check
161
- SourceCharactersBlock sourceBlock = CharacterMapForBlock(section.parent().bounds.first,
162
- section.parent().bounds.second,
163
- section.parent().bounds,
164
- sourceData);
165
- result.error = Error("unexpected markdown closure",
166
- ApplicationError,
167
- sourceBlock);
168
- return false;
169
- }
170
-
171
- /**
172
- * \brief Check header block for an potential ambiguous signature
173
- * \return True if a header does not contain potential ambiguous signature, false otherwise.
174
- */
175
- template <class T>
176
- FORCEINLINE bool CheckHeaderBlock(const BlueprintSection& section,
177
- const BlockIterator& cur,
178
- const SourceData& sourceData,
179
- Result& result) {
180
-
181
- return false;
182
- }
183
- }
184
-
185
-
186
- #endif