apex-ruby 1.0.6
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 +7 -0
- data/README.md +119 -0
- data/apex-ruby.gemspec +31 -0
- data/ext/apex_ext/apex_ext.c +215 -0
- data/ext/apex_ext/apex_src/BENCHMARK.md +32 -0
- data/ext/apex_ext/apex_src/BENCHMARK_COMPARISON.md +67 -0
- data/ext/apex_ext/apex_src/CHANGELOG.md +2454 -0
- data/ext/apex_ext/apex_src/CMakeLists.txt +454 -0
- data/ext/apex_ext/apex_src/Dockerfile.linux-build +15 -0
- data/ext/apex_ext/apex_src/Formula/apex.rb +38 -0
- data/ext/apex_ext/apex_src/Info.plist.in +27 -0
- data/ext/apex_ext/apex_src/LICENSE +21 -0
- data/ext/apex_ext/apex_src/Package.swift +160 -0
- data/ext/apex_ext/apex_src/PackageSupport/README.md +17 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_export.h +20 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_version.h +14 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark_gfm_spm_stub.c +4 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/config.h +41 -0
- data/ext/apex_ext/apex_src/README.md +452 -0
- data/ext/apex_ext/apex_src/VERSION +1 -0
- data/ext/apex_ext/apex_src/apex-header-2-rb@2x.webp +0 -0
- data/ext/apex_ext/apex_src/apex-plugins.json.example +20 -0
- data/ext/apex_ext/apex_src/apex.pc.in +11 -0
- data/ext/apex_ext/apex_src/cli/main.c +2720 -0
- data/ext/apex_ext/apex_src/debug_test.sh +22 -0
- data/ext/apex_ext/apex_src/docs/API_REFERENCE.md +451 -0
- data/ext/apex_ext/apex_src/docs/ARCHITECTURE.md +166 -0
- data/ext/apex_ext/apex_src/docs/CMARK_INTEGRATION.md +220 -0
- data/ext/apex_ext/apex_src/docs/CRITICMARKUP.md +501 -0
- data/ext/apex_ext/apex_src/docs/DEBUGGING.md +73 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS.md +391 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS_UPDATE.md +237 -0
- data/ext/apex_ext/apex_src/docs/FUTURE_FEATURES.md +456 -0
- data/ext/apex_ext/apex_src/docs/IAL_FEATURES.md +210 -0
- data/ext/apex_ext/apex_src/docs/IAL_STATUS.md +344 -0
- data/ext/apex_ext/apex_src/docs/INTEGRATION_EXAMPLE.m +144 -0
- data/ext/apex_ext/apex_src/docs/LIMITATIONS_RESOLVED.md +278 -0
- data/ext/apex_ext/apex_src/docs/OUTPUT_MODES.md +321 -0
- data/ext/apex_ext/apex_src/docs/PROGRESS.md +167 -0
- data/ext/apex_ext/apex_src/docs/STANDALONE_FEATURE.md +174 -0
- data/ext/apex_ext/apex_src/docs/TABLE_SPANS_STATUS.md +243 -0
- data/ext/apex_ext/apex_src/docs/TEST_COVERAGE.md +316 -0
- data/ext/apex_ext/apex_src/docs/USER_GUIDE.md +803 -0
- data/ext/apex_ext/apex_src/docs/WIKI_LINKS_ISSUE.md +91 -0
- data/ext/apex_ext/apex_src/documentation/README.md +160 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex Command Line Options.cheatsheet.txt +365 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Info.plist +24 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/C-API.html +1737 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Citations.html +1420 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Command-Line-Options.html +3574 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Configuration.html +1603 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Credits.html +910 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Examples.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Getting-Started.html +1003 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Header-IDs.html +1308 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Home.html +1078 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Inline-Attribute-Lists.html +1622 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Installation.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Limitations-and-Roadmap.html +1698 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Metadata-Transforms.html +1531 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Modes.html +1980 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-File-Documents.html +1368 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Pandoc-Integration.html +1151 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Plugins.html +2861 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Syntax.html +3981 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Troubleshooting.html +1454 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Usage.html +1200 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Xcode-Integration.html +2066 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/tempOptimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Info.plist +22 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/index.html +914 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/style.css +399 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs.rb +772 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs_ai.rb +678 -0
- data/ext/apex_ext/apex_src/documentation/generate_docset.rb +873 -0
- data/ext/apex_ext/apex_src/documentation/generate_single_html.rb +733 -0
- data/ext/apex_ext/apex_src/documentation/html/apex-docs.html +17073 -0
- data/ext/apex_ext/apex_src/documentation/shared_scripts.js +64 -0
- data/ext/apex_ext/apex_src/documentation/shared_styles.css +646 -0
- data/ext/apex_ext/apex_src/documentation/transform_for_app.example.md +260 -0
- data/ext/apex_ext/apex_src/examples/bracketed_spans_demo.md +119 -0
- data/ext/apex_ext/apex_src/examples/emoji_span_plugin.yml +11 -0
- data/ext/apex_ext/apex_src/examples/example.html +53 -0
- data/ext/apex_ext/apex_src/examples/example.md +85 -0
- data/ext/apex_ext/apex_src/examples/fenced_divs_demo.md +158 -0
- data/ext/apex_ext/apex_src/examples/kbd.md +8 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.rb +250 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.yml +9 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon@2x.png +0 -0
- data/ext/apex_ext/apex_src/include/apex/apex.h +247 -0
- data/ext/apex_ext/apex_src/include/apex/buffer.h +93 -0
- data/ext/apex_ext/apex_src/include/apex/module.modulemap +16 -0
- data/ext/apex_ext/apex_src/include/apex/parser.h +150 -0
- data/ext/apex_ext/apex_src/include/apex/renderer.h +39 -0
- data/ext/apex_ext/apex_src/man/apex-config.5 +374 -0
- data/ext/apex_ext/apex_src/man/apex-config.5.md +260 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7 +456 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7.md +365 -0
- data/ext/apex_ext/apex_src/man/apex.1 +828 -0
- data/ext/apex_ext/apex_src/man/apex.1.md +643 -0
- data/ext/apex_ext/apex_src/man/apex.1.new +338 -0
- data/ext/apex_ext/apex_src/objc/Apex.swift +237 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.h +117 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.m +332 -0
- data/ext/apex_ext/apex_src/src/_README.md +358 -0
- data/ext/apex_ext/apex_src/src/apex.c +6326 -0
- data/ext/apex_ext/apex_src/src/buffer.c +93 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +362 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.h +45 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.c +184 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.h +50 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.c +1897 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.c +215 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.h +53 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.c +2042 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.h +163 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.c +329 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.h +48 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.c +1670 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.c +710 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.h +38 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji_data.h +942 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.c +925 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.h +43 -0
- data/ext/apex_ext/apex_src/src/extensions/github-emoji.txt +869 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.c +1121 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.h +33 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.c +626 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.h +60 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.c +135 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.c +408 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.c +4084 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.h +145 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.c +1536 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.h +54 -0
- data/ext/apex_ext/apex_src/src/extensions/index.c +967 -0
- data/ext/apex_ext/apex_src/src/extensions/index.h +90 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.c +205 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.c +332 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.h +13 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.c +248 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.h +18 -0
- data/ext/apex_ext/apex_src/src/extensions/math.c +279 -0
- data/ext/apex_ext/apex_src/src/extensions/math.h +32 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.c +3046 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.h +125 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.c +1297 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.h +39 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.c +194 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.h +29 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.c +405 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +468 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.h +44 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +2679 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.h +23 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.c +255 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.c +624 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.h +58 -0
- data/ext/apex_ext/apex_src/src/html_renderer.c +2762 -0
- data/ext/apex_ext/apex_src/src/html_renderer.h +126 -0
- data/ext/apex_ext/apex_src/src/parser.c +227 -0
- data/ext/apex_ext/apex_src/src/plugins.c +895 -0
- data/ext/apex_ext/apex_src/src/plugins.h +39 -0
- data/ext/apex_ext/apex_src/src/plugins_env.c +187 -0
- data/ext/apex_ext/apex_src/src/plugins_remote.c +263 -0
- data/ext/apex_ext/apex_src/src/pretty_html.c +358 -0
- data/ext/apex_ext/apex_src/src/renderer.c +241 -0
- data/ext/apex_ext/apex_src/src/utf8.c +56 -0
- data/ext/apex_ext/apex_src/test-linux-build.sh +20 -0
- data/ext/apex_ext/apex_src/test.html +103 -0
- data/ext/apex_ext/apex_src/test_coverage.sh +121 -0
- data/ext/apex_ext/apex_src/test_ial_fenced.md +6 -0
- data/ext/apex_ext/apex_src/test_math_norm.py +79 -0
- data/ext/apex_ext/apex_src/test_pandoc_output.html +48 -0
- data/ext/apex_ext/apex_src/test_spm.sh +107 -0
- data/ext/apex_ext/apex_src/tests/ApexSPMTest/main.swift +50 -0
- data/ext/apex_ext/apex_src/tests/BENCHMARK_RESULTS.md +229 -0
- data/ext/apex_ext/apex_src/tests/CMakeLists.txt +24 -0
- data/ext/apex_ext/apex_src/tests/README.md +146 -0
- data/ext/apex_ext/apex_src/tests/benchmark.sh +113 -0
- data/ext/apex_ext/apex_src/tests/benchmark_comparison.sh +166 -0
- data/ext/apex_ext/apex_src/tests/compare_header_ids.sh +31 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/headers.md +25 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/list-interruption.md +24 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/misc_markup.md +33 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/test_basic.md +26 -0
- data/ext/apex_ext/apex_src/tests/fixtures/code/code-blocks.md +260 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/SUMMARY.md +6 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/chapter1.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/index.txt +9 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/intro.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/section1_1.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +620 -0
- data/ext/apex_ext/apex_src/tests/fixtures/debug_ref_image_ial.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial.md +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial_demo.md +177 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji-autocorrect.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/kbd_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/ial/bracketed_spans_test.md +74 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/image_and_encoding_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/multimarkdown_image_attributes_test.md +60 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/pandoc_ial_image_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/width_height_conversion_test.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/img-in-div.md +16 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/code.py +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.csv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.tsv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/image.png +2 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/nested.md +8 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/raw.html +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/simple.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/test_image.png +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/large_doc.md +1094 -0
- data/ext/apex_ext/apex_src/tests/fixtures/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/gfm_header_id_test.md +96 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_citations.md +43 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_def_list_links.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_mmark.md +53 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_textindex.md +37 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/advanced_tables_test.md +93 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/inline_tables_test.md +38 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/relaxed-table.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_cr_line_endings.md +15 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_no_trailing_newline.md +15 -0
- data/ext/apex_ext/apex_src/tests/generate_gfm_ids.sh +105 -0
- data/ext/apex_ext/apex_src/tests/generate_ial_demo.sh +143 -0
- data/ext/apex_ext/apex_src/tests/gfm_id_comparison_summary.md +96 -0
- data/ext/apex_ext/apex_src/tests/gh_api_test.md +6 -0
- data/ext/apex_ext/apex_src/tests/ial_demo.html +186 -0
- data/ext/apex_ext/apex_src/tests/include_code.py +19 -0
- data/ext/apex_ext/apex_src/tests/include_snippet.md +15 -0
- data/ext/apex_ext/apex_src/tests/multi_file_cli_test.sh +64 -0
- data/ext/apex_ext/apex_src/tests/sample_data.csv +7 -0
- data/ext/apex_ext/apex_src/tests/table_escaped_ltlt.md +4 -0
- data/ext/apex_ext/apex_src/tests/test_basic.c +74 -0
- data/ext/apex_ext/apex_src/tests/test_extensions.c +2116 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.c +183 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.h +91 -0
- data/ext/apex_ext/apex_src/tests/test_ial.c +282 -0
- data/ext/apex_ext/apex_src/tests/test_links.c +418 -0
- data/ext/apex_ext/apex_src/tests/test_marked_integration.c +265 -0
- data/ext/apex_ext/apex_src/tests/test_metadata.c +908 -0
- data/ext/apex_ext/apex_src/tests/test_output.c +1118 -0
- data/ext/apex_ext/apex_src/tests/test_plugins.c +219 -0
- data/ext/apex_ext/apex_src/tests/test_refs.bib +31 -0
- data/ext/apex_ext/apex_src/tests/test_runner.c +244 -0
- data/ext/apex_ext/apex_src/tests/test_syntax_highlight.c +198 -0
- data/ext/apex_ext/apex_src/tests/test_tables.c +862 -0
- data/ext/apex_ext/apex_src/tests/update_benchmarks.sh +9 -0
- data/ext/apex_ext/apex_src/tests/yaml_test.md +13 -0
- data/ext/apex_ext/apex_src/tests.rb +39 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CMakeLists.txt +48 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/COPYING +170 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.c +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.cmake +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/FindAsan.cmake +74 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/Makefile.nmake +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/README.md +206 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/CMakeLists.txt +30 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.cpp +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.h +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.c +111 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/main.c +1169 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/appveyor.yml +21 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-flat.md +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-code.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-fences.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-heading.md +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-hr.md +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-html.md +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-lheading.md +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-flat.md +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-nested.md +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-flat.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-nested.md +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-autolink.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-backticks.md +3 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-flat.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-nested.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-worst.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-entity.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-escape.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-html.md +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-flat.md +23 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-newlines.md +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/lorem1.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/rawtabs.md +18 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/statistics.py +595 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/stats.py +19 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/benchmarks.md +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/changelog.txt +1245 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/data/CaseFolding.txt +1495 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/CMakeLists.txt +119 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.c +508 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/cmark-gfm-core-extensions.h +54 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/core-extensions.c +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.c +879 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.re +92 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.c +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.h +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.c +917 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.h +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.c +60 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.c +156 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/CMakeLists.txt +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/README.md +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic.c +91 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic_brackets.c +110 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzzloop.sh +28 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/CMakeLists.txt +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/make_man_page.py +133 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man1/cmark-gfm.1 +78 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man3/cmark-gfm.3 +1041 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/nmake.bat +1 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/CMakeLists.txt +230 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/arena.c +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/blocks.c +1622 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.c +278 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.h +116 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/case_fold_switch.inc +4327 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/chunk.h +135 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm-extension_api.h +737 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm.h +833 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm_version.h.in +7 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark.c +55 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.c +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.h +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/commonmark.c +514 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/config.h.in +76 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/entities.inc +2138 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini.h +57 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_href_e.c +100 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_e.c +66 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_u.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.c +502 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.c +1788 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.h +29 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.c +159 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/latex.c +468 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/libcmark-gfm.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/linked_list.c +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/main.c +328 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/man.c +274 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.c +129 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.h +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.c +1045 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.h +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/parser.h +59 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plaintext.c +218 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.c +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.c +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.c +213 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.h +62 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.c +14056 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.h +70 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.re +365 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.c +317 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/xml.c +182 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/suppressions +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/CMakeLists.txt +114 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/afl_test_cases/test.md +49 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark-fuzz.c +58 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark.py +105 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/entity_tests.py +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-full-info-string.txt +0 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-table-prefer-style-attributes.txt +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions.txt +920 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/fuzzing_dictionary +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/normalize.py +194 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/pathological_tests.py +160 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/regression.txt +375 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/roundtrip_tests.py +50 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/run-cmark-fuzz +4 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/smart_punct.txt +177 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec.txt +10212 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec_tests.py +152 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/toolchain-mingw32.cmake +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/Dockerfile +41 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/appveyor-build.bat +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/make_entities_inc.py +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/mkcasefold.pl +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md.xsl +319 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md_gfm.xsl +80 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/why-cmark-and-not-x.md +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.js +6 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.py +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rb +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rkt +208 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper_ext.py +109 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/CMakeLists.txt +160 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Changes +372 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/License +20 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Makefile.am +51 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/ReadMe.md +46 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/announcement.msg +89 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/bootstrap +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/cmake/config.h.in +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/configure.ac +73 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/doc/doxygen.cfg +222 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/README.mkd +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/alpine-3.7 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/fedora-25 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-14.04 +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-16.04 +24 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/anchors.yaml +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/array.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/global-tag.yaml +14 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/json.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/mapping.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/numbers.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/strings.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/tags.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/yaml-version.yaml +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/Makefile.am +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/yaml.h +1999 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/ReadMe.md +77 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/Dockerfile +32 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/output/ReadMe +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/scripts/libyaml-dist.sh +23 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/regression-inputs/clusterfuzz-testcase-minimized-5607885063061504.yml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/Makefile.am +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/api.c +1393 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/dumper.c +394 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/emitter.c +2358 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/loader.c +544 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/parser.c +1416 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/reader.c +469 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/scanner.c +3598 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/writer.c +141 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/yaml_private.h +684 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/CMakeLists.txt +27 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/Makefile.am +9 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/ReadMe.md +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor-alt.c +800 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor.c +1127 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter-alt.c +217 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter.c +202 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-all-tests.sh +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-dumper.c +314 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter-test-suite.c +290 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter.c +327 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-loader.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser-test-suite.c +196 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser.c +88 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-scanner.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-reader.c +354 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-version.c +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yaml-0.1.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yamlConfig.cmake.in +16 -0
- data/ext/apex_ext/extconf.rb +103 -0
- data/lib/apex/configurable.rb +46 -0
- data/lib/apex/document.rb +66 -0
- data/lib/apex/version.rb +15 -0
- data/lib/apex.rb +28 -0
- metadata +544 -0
|
@@ -0,0 +1,1416 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* The parser implements the following grammar:
|
|
4
|
+
*
|
|
5
|
+
* stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
|
|
6
|
+
* implicit_document ::= block_node DOCUMENT-END*
|
|
7
|
+
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
|
8
|
+
* block_node_or_indentless_sequence ::=
|
|
9
|
+
* ALIAS
|
|
10
|
+
* | properties (block_content | indentless_block_sequence)?
|
|
11
|
+
* | block_content
|
|
12
|
+
* | indentless_block_sequence
|
|
13
|
+
* block_node ::= ALIAS
|
|
14
|
+
* | properties block_content?
|
|
15
|
+
* | block_content
|
|
16
|
+
* flow_node ::= ALIAS
|
|
17
|
+
* | properties flow_content?
|
|
18
|
+
* | flow_content
|
|
19
|
+
* properties ::= TAG ANCHOR? | ANCHOR TAG?
|
|
20
|
+
* block_content ::= block_collection | flow_collection | SCALAR
|
|
21
|
+
* flow_content ::= flow_collection | SCALAR
|
|
22
|
+
* block_collection ::= block_sequence | block_mapping
|
|
23
|
+
* flow_collection ::= flow_sequence | flow_mapping
|
|
24
|
+
* block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
|
|
25
|
+
* indentless_sequence ::= (BLOCK-ENTRY block_node?)+
|
|
26
|
+
* block_mapping ::= BLOCK-MAPPING_START
|
|
27
|
+
* ((KEY block_node_or_indentless_sequence?)?
|
|
28
|
+
* (VALUE block_node_or_indentless_sequence?)?)*
|
|
29
|
+
* BLOCK-END
|
|
30
|
+
* flow_sequence ::= FLOW-SEQUENCE-START
|
|
31
|
+
* (flow_sequence_entry FLOW-ENTRY)*
|
|
32
|
+
* flow_sequence_entry?
|
|
33
|
+
* FLOW-SEQUENCE-END
|
|
34
|
+
* flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
35
|
+
* flow_mapping ::= FLOW-MAPPING-START
|
|
36
|
+
* (flow_mapping_entry FLOW-ENTRY)*
|
|
37
|
+
* flow_mapping_entry?
|
|
38
|
+
* FLOW-MAPPING-END
|
|
39
|
+
* flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
#include "yaml_private.h"
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* Peek the next token in the token queue.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
#define PEEK_TOKEN(parser) \
|
|
49
|
+
((parser->token_available || yaml_parser_fetch_more_tokens(parser)) ? \
|
|
50
|
+
parser->tokens.head : NULL)
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Remove the next token from the queue (must be called after PEEK_TOKEN).
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
#define SKIP_TOKEN(parser) \
|
|
57
|
+
(parser->token_available = 0, \
|
|
58
|
+
parser->tokens_parsed ++, \
|
|
59
|
+
parser->stream_end_produced = \
|
|
60
|
+
(parser->tokens.head->type == YAML_STREAM_END_TOKEN), \
|
|
61
|
+
parser->tokens.head ++)
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* Public API declarations.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
int MAX_NESTING_LEVEL = 1000;
|
|
68
|
+
|
|
69
|
+
YAML_DECLARE(int)
|
|
70
|
+
yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Error handling.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
static int
|
|
77
|
+
yaml_parser_set_parser_error(yaml_parser_t *parser,
|
|
78
|
+
const char *problem, yaml_mark_t problem_mark);
|
|
79
|
+
|
|
80
|
+
static int
|
|
81
|
+
yaml_parser_set_parser_error_context(yaml_parser_t *parser,
|
|
82
|
+
const char *context, yaml_mark_t context_mark,
|
|
83
|
+
const char *problem, yaml_mark_t problem_mark);
|
|
84
|
+
|
|
85
|
+
static int
|
|
86
|
+
yaml_maximum_level_reached(yaml_parser_t *parser,
|
|
87
|
+
yaml_mark_t context_mark, yaml_mark_t problem_mark);
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* State functions.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
static int
|
|
94
|
+
yaml_parser_state_machine(yaml_parser_t *parser, yaml_event_t *event);
|
|
95
|
+
|
|
96
|
+
static int
|
|
97
|
+
yaml_parser_parse_stream_start(yaml_parser_t *parser, yaml_event_t *event);
|
|
98
|
+
|
|
99
|
+
static int
|
|
100
|
+
yaml_parser_parse_document_start(yaml_parser_t *parser, yaml_event_t *event,
|
|
101
|
+
int implicit);
|
|
102
|
+
|
|
103
|
+
static int
|
|
104
|
+
yaml_parser_parse_document_content(yaml_parser_t *parser, yaml_event_t *event);
|
|
105
|
+
|
|
106
|
+
static int
|
|
107
|
+
yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event);
|
|
108
|
+
|
|
109
|
+
static int
|
|
110
|
+
yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
|
|
111
|
+
int block, int indentless_sequence);
|
|
112
|
+
|
|
113
|
+
static int
|
|
114
|
+
yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
|
|
115
|
+
yaml_event_t *event, int first);
|
|
116
|
+
|
|
117
|
+
static int
|
|
118
|
+
yaml_parser_parse_indentless_sequence_entry(yaml_parser_t *parser,
|
|
119
|
+
yaml_event_t *event);
|
|
120
|
+
|
|
121
|
+
static int
|
|
122
|
+
yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
|
|
123
|
+
yaml_event_t *event, int first);
|
|
124
|
+
|
|
125
|
+
static int
|
|
126
|
+
yaml_parser_parse_block_mapping_value(yaml_parser_t *parser,
|
|
127
|
+
yaml_event_t *event);
|
|
128
|
+
|
|
129
|
+
static int
|
|
130
|
+
yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
|
|
131
|
+
yaml_event_t *event, int first);
|
|
132
|
+
|
|
133
|
+
static int
|
|
134
|
+
yaml_parser_parse_flow_sequence_entry_mapping_key(yaml_parser_t *parser,
|
|
135
|
+
yaml_event_t *event);
|
|
136
|
+
|
|
137
|
+
static int
|
|
138
|
+
yaml_parser_parse_flow_sequence_entry_mapping_value(yaml_parser_t *parser,
|
|
139
|
+
yaml_event_t *event);
|
|
140
|
+
|
|
141
|
+
static int
|
|
142
|
+
yaml_parser_parse_flow_sequence_entry_mapping_end(yaml_parser_t *parser,
|
|
143
|
+
yaml_event_t *event);
|
|
144
|
+
|
|
145
|
+
static int
|
|
146
|
+
yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
|
|
147
|
+
yaml_event_t *event, int first);
|
|
148
|
+
|
|
149
|
+
static int
|
|
150
|
+
yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
|
|
151
|
+
yaml_event_t *event, int empty);
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
* Utility functions.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
static int
|
|
158
|
+
yaml_parser_process_empty_scalar(yaml_parser_t *parser,
|
|
159
|
+
yaml_event_t *event, yaml_mark_t mark);
|
|
160
|
+
|
|
161
|
+
static int
|
|
162
|
+
yaml_parser_process_directives(yaml_parser_t *parser,
|
|
163
|
+
yaml_version_directive_t **version_directive_ref,
|
|
164
|
+
yaml_tag_directive_t **tag_directives_start_ref,
|
|
165
|
+
yaml_tag_directive_t **tag_directives_end_ref);
|
|
166
|
+
|
|
167
|
+
static int
|
|
168
|
+
yaml_parser_append_tag_directive(yaml_parser_t *parser,
|
|
169
|
+
yaml_tag_directive_t value, int allow_duplicates, yaml_mark_t mark);
|
|
170
|
+
|
|
171
|
+
YAML_DECLARE(void)
|
|
172
|
+
yaml_set_max_nest_level(int max)
|
|
173
|
+
{
|
|
174
|
+
MAX_NESTING_LEVEL = max;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
* Get the next event.
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
YAML_DECLARE(int)
|
|
182
|
+
yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
|
|
183
|
+
{
|
|
184
|
+
assert(parser); /* Non-NULL parser object is expected. */
|
|
185
|
+
assert(event); /* Non-NULL event object is expected. */
|
|
186
|
+
|
|
187
|
+
/* Erase the event object. */
|
|
188
|
+
|
|
189
|
+
memset(event, 0, sizeof(yaml_event_t));
|
|
190
|
+
|
|
191
|
+
/* No events after the end of the stream or error. */
|
|
192
|
+
|
|
193
|
+
if (parser->stream_end_produced || parser->error ||
|
|
194
|
+
parser->state == YAML_PARSE_END_STATE) {
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Generate the next event. */
|
|
199
|
+
|
|
200
|
+
return yaml_parser_state_machine(parser, event);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/*
|
|
204
|
+
* Set parser error.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
static int
|
|
208
|
+
yaml_parser_set_parser_error(yaml_parser_t *parser,
|
|
209
|
+
const char *problem, yaml_mark_t problem_mark)
|
|
210
|
+
{
|
|
211
|
+
parser->error = YAML_PARSER_ERROR;
|
|
212
|
+
parser->problem = problem;
|
|
213
|
+
parser->problem_mark = problem_mark;
|
|
214
|
+
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
static int
|
|
219
|
+
yaml_parser_set_parser_error_context(yaml_parser_t *parser,
|
|
220
|
+
const char *context, yaml_mark_t context_mark,
|
|
221
|
+
const char *problem, yaml_mark_t problem_mark)
|
|
222
|
+
{
|
|
223
|
+
parser->error = YAML_PARSER_ERROR;
|
|
224
|
+
parser->context = context;
|
|
225
|
+
parser->context_mark = context_mark;
|
|
226
|
+
parser->problem = problem;
|
|
227
|
+
parser->problem_mark = problem_mark;
|
|
228
|
+
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static int
|
|
233
|
+
yaml_maximum_level_reached(yaml_parser_t *parser,
|
|
234
|
+
yaml_mark_t context_mark, yaml_mark_t problem_mark)
|
|
235
|
+
{
|
|
236
|
+
yaml_parser_set_parser_error_context(parser,
|
|
237
|
+
"while parsing", context_mark, "Maximum nesting level reached, set with yaml_set_max_nest_level())", problem_mark);
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
* State dispatcher.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
static int
|
|
246
|
+
yaml_parser_state_machine(yaml_parser_t *parser, yaml_event_t *event)
|
|
247
|
+
{
|
|
248
|
+
switch (parser->state)
|
|
249
|
+
{
|
|
250
|
+
case YAML_PARSE_STREAM_START_STATE:
|
|
251
|
+
return yaml_parser_parse_stream_start(parser, event);
|
|
252
|
+
|
|
253
|
+
case YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE:
|
|
254
|
+
return yaml_parser_parse_document_start(parser, event, 1);
|
|
255
|
+
|
|
256
|
+
case YAML_PARSE_DOCUMENT_START_STATE:
|
|
257
|
+
return yaml_parser_parse_document_start(parser, event, 0);
|
|
258
|
+
|
|
259
|
+
case YAML_PARSE_DOCUMENT_CONTENT_STATE:
|
|
260
|
+
return yaml_parser_parse_document_content(parser, event);
|
|
261
|
+
|
|
262
|
+
case YAML_PARSE_DOCUMENT_END_STATE:
|
|
263
|
+
return yaml_parser_parse_document_end(parser, event);
|
|
264
|
+
|
|
265
|
+
case YAML_PARSE_BLOCK_NODE_STATE:
|
|
266
|
+
return yaml_parser_parse_node(parser, event, 1, 0);
|
|
267
|
+
|
|
268
|
+
case YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
|
|
269
|
+
return yaml_parser_parse_node(parser, event, 1, 1);
|
|
270
|
+
|
|
271
|
+
case YAML_PARSE_FLOW_NODE_STATE:
|
|
272
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
273
|
+
|
|
274
|
+
case YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
|
|
275
|
+
return yaml_parser_parse_block_sequence_entry(parser, event, 1);
|
|
276
|
+
|
|
277
|
+
case YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
|
|
278
|
+
return yaml_parser_parse_block_sequence_entry(parser, event, 0);
|
|
279
|
+
|
|
280
|
+
case YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
|
|
281
|
+
return yaml_parser_parse_indentless_sequence_entry(parser, event);
|
|
282
|
+
|
|
283
|
+
case YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
|
|
284
|
+
return yaml_parser_parse_block_mapping_key(parser, event, 1);
|
|
285
|
+
|
|
286
|
+
case YAML_PARSE_BLOCK_MAPPING_KEY_STATE:
|
|
287
|
+
return yaml_parser_parse_block_mapping_key(parser, event, 0);
|
|
288
|
+
|
|
289
|
+
case YAML_PARSE_BLOCK_MAPPING_VALUE_STATE:
|
|
290
|
+
return yaml_parser_parse_block_mapping_value(parser, event);
|
|
291
|
+
|
|
292
|
+
case YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
|
|
293
|
+
return yaml_parser_parse_flow_sequence_entry(parser, event, 1);
|
|
294
|
+
|
|
295
|
+
case YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
|
|
296
|
+
return yaml_parser_parse_flow_sequence_entry(parser, event, 0);
|
|
297
|
+
|
|
298
|
+
case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
|
|
299
|
+
return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event);
|
|
300
|
+
|
|
301
|
+
case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
|
|
302
|
+
return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event);
|
|
303
|
+
|
|
304
|
+
case YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
|
|
305
|
+
return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event);
|
|
306
|
+
|
|
307
|
+
case YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
|
|
308
|
+
return yaml_parser_parse_flow_mapping_key(parser, event, 1);
|
|
309
|
+
|
|
310
|
+
case YAML_PARSE_FLOW_MAPPING_KEY_STATE:
|
|
311
|
+
return yaml_parser_parse_flow_mapping_key(parser, event, 0);
|
|
312
|
+
|
|
313
|
+
case YAML_PARSE_FLOW_MAPPING_VALUE_STATE:
|
|
314
|
+
return yaml_parser_parse_flow_mapping_value(parser, event, 0);
|
|
315
|
+
|
|
316
|
+
case YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
|
|
317
|
+
return yaml_parser_parse_flow_mapping_value(parser, event, 1);
|
|
318
|
+
|
|
319
|
+
default:
|
|
320
|
+
assert(1); /* Invalid state. */
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return 0;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/*
|
|
327
|
+
* Parse the production:
|
|
328
|
+
* stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
|
|
329
|
+
* ************
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
static int
|
|
333
|
+
yaml_parser_parse_stream_start(yaml_parser_t *parser, yaml_event_t *event)
|
|
334
|
+
{
|
|
335
|
+
yaml_token_t *token;
|
|
336
|
+
|
|
337
|
+
token = PEEK_TOKEN(parser);
|
|
338
|
+
if (!token) return 0;
|
|
339
|
+
|
|
340
|
+
if (token->type != YAML_STREAM_START_TOKEN) {
|
|
341
|
+
return yaml_parser_set_parser_error(parser,
|
|
342
|
+
"did not find expected <stream-start>", token->start_mark);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
|
|
346
|
+
STREAM_START_EVENT_INIT(*event, token->data.stream_start.encoding,
|
|
347
|
+
token->start_mark, token->start_mark);
|
|
348
|
+
SKIP_TOKEN(parser);
|
|
349
|
+
|
|
350
|
+
return 1;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/*
|
|
354
|
+
* Parse the productions:
|
|
355
|
+
* implicit_document ::= block_node DOCUMENT-END*
|
|
356
|
+
* *
|
|
357
|
+
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
|
358
|
+
* *************************
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
static int
|
|
362
|
+
yaml_parser_parse_document_start(yaml_parser_t *parser, yaml_event_t *event,
|
|
363
|
+
int implicit)
|
|
364
|
+
{
|
|
365
|
+
yaml_token_t *token;
|
|
366
|
+
yaml_version_directive_t *version_directive = NULL;
|
|
367
|
+
struct {
|
|
368
|
+
yaml_tag_directive_t *start;
|
|
369
|
+
yaml_tag_directive_t *end;
|
|
370
|
+
} tag_directives = { NULL, NULL };
|
|
371
|
+
|
|
372
|
+
token = PEEK_TOKEN(parser);
|
|
373
|
+
if (!token) return 0;
|
|
374
|
+
|
|
375
|
+
/* Parse extra document end indicators. */
|
|
376
|
+
|
|
377
|
+
if (!implicit)
|
|
378
|
+
{
|
|
379
|
+
while (token->type == YAML_DOCUMENT_END_TOKEN) {
|
|
380
|
+
SKIP_TOKEN(parser);
|
|
381
|
+
token = PEEK_TOKEN(parser);
|
|
382
|
+
if (!token) return 0;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/* Parse an implicit document. */
|
|
387
|
+
|
|
388
|
+
if (implicit && token->type != YAML_VERSION_DIRECTIVE_TOKEN &&
|
|
389
|
+
token->type != YAML_TAG_DIRECTIVE_TOKEN &&
|
|
390
|
+
token->type != YAML_DOCUMENT_START_TOKEN &&
|
|
391
|
+
token->type != YAML_STREAM_END_TOKEN)
|
|
392
|
+
{
|
|
393
|
+
if (!yaml_parser_process_directives(parser, NULL, NULL, NULL))
|
|
394
|
+
return 0;
|
|
395
|
+
if (!PUSH(parser, parser->states, YAML_PARSE_DOCUMENT_END_STATE))
|
|
396
|
+
return 0;
|
|
397
|
+
parser->state = YAML_PARSE_BLOCK_NODE_STATE;
|
|
398
|
+
DOCUMENT_START_EVENT_INIT(*event, NULL, NULL, NULL, 1,
|
|
399
|
+
token->start_mark, token->start_mark);
|
|
400
|
+
return 1;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* Parse an explicit document. */
|
|
404
|
+
|
|
405
|
+
else if (token->type != YAML_STREAM_END_TOKEN)
|
|
406
|
+
{
|
|
407
|
+
yaml_mark_t start_mark, end_mark;
|
|
408
|
+
start_mark = token->start_mark;
|
|
409
|
+
if (!yaml_parser_process_directives(parser, &version_directive,
|
|
410
|
+
&tag_directives.start, &tag_directives.end))
|
|
411
|
+
return 0;
|
|
412
|
+
token = PEEK_TOKEN(parser);
|
|
413
|
+
if (!token) goto error;
|
|
414
|
+
if (token->type != YAML_DOCUMENT_START_TOKEN) {
|
|
415
|
+
yaml_parser_set_parser_error(parser,
|
|
416
|
+
"did not find expected <document start>", token->start_mark);
|
|
417
|
+
goto error;
|
|
418
|
+
}
|
|
419
|
+
if (!PUSH(parser, parser->states, YAML_PARSE_DOCUMENT_END_STATE))
|
|
420
|
+
goto error;
|
|
421
|
+
parser->state = YAML_PARSE_DOCUMENT_CONTENT_STATE;
|
|
422
|
+
end_mark = token->end_mark;
|
|
423
|
+
DOCUMENT_START_EVENT_INIT(*event, version_directive,
|
|
424
|
+
tag_directives.start, tag_directives.end, 0,
|
|
425
|
+
start_mark, end_mark);
|
|
426
|
+
SKIP_TOKEN(parser);
|
|
427
|
+
version_directive = NULL;
|
|
428
|
+
tag_directives.start = tag_directives.end = NULL;
|
|
429
|
+
return 1;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/* Parse the stream end. */
|
|
433
|
+
|
|
434
|
+
else
|
|
435
|
+
{
|
|
436
|
+
parser->state = YAML_PARSE_END_STATE;
|
|
437
|
+
STREAM_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
|
|
438
|
+
SKIP_TOKEN(parser);
|
|
439
|
+
return 1;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
error:
|
|
443
|
+
yaml_free(version_directive);
|
|
444
|
+
while (tag_directives.start != tag_directives.end) {
|
|
445
|
+
yaml_free(tag_directives.end[-1].handle);
|
|
446
|
+
yaml_free(tag_directives.end[-1].prefix);
|
|
447
|
+
tag_directives.end --;
|
|
448
|
+
}
|
|
449
|
+
yaml_free(tag_directives.start);
|
|
450
|
+
return 0;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/*
|
|
454
|
+
* Parse the productions:
|
|
455
|
+
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
|
456
|
+
* ***********
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
static int
|
|
460
|
+
yaml_parser_parse_document_content(yaml_parser_t *parser, yaml_event_t *event)
|
|
461
|
+
{
|
|
462
|
+
yaml_token_t *token;
|
|
463
|
+
|
|
464
|
+
token = PEEK_TOKEN(parser);
|
|
465
|
+
if (!token) return 0;
|
|
466
|
+
|
|
467
|
+
if (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
|
|
468
|
+
token->type == YAML_TAG_DIRECTIVE_TOKEN ||
|
|
469
|
+
token->type == YAML_DOCUMENT_START_TOKEN ||
|
|
470
|
+
token->type == YAML_DOCUMENT_END_TOKEN ||
|
|
471
|
+
token->type == YAML_STREAM_END_TOKEN) {
|
|
472
|
+
parser->state = POP(parser, parser->states);
|
|
473
|
+
return yaml_parser_process_empty_scalar(parser, event,
|
|
474
|
+
token->start_mark);
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
return yaml_parser_parse_node(parser, event, 1, 0);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/*
|
|
482
|
+
* Parse the productions:
|
|
483
|
+
* implicit_document ::= block_node DOCUMENT-END*
|
|
484
|
+
* *************
|
|
485
|
+
* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
|
|
486
|
+
* *************
|
|
487
|
+
*/
|
|
488
|
+
|
|
489
|
+
static int
|
|
490
|
+
yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event)
|
|
491
|
+
{
|
|
492
|
+
yaml_token_t *token;
|
|
493
|
+
yaml_mark_t start_mark, end_mark;
|
|
494
|
+
int implicit = 1;
|
|
495
|
+
|
|
496
|
+
token = PEEK_TOKEN(parser);
|
|
497
|
+
if (!token) return 0;
|
|
498
|
+
|
|
499
|
+
start_mark = end_mark = token->start_mark;
|
|
500
|
+
|
|
501
|
+
if (token->type == YAML_DOCUMENT_END_TOKEN) {
|
|
502
|
+
end_mark = token->end_mark;
|
|
503
|
+
SKIP_TOKEN(parser);
|
|
504
|
+
implicit = 0;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
while (!STACK_EMPTY(parser, parser->tag_directives)) {
|
|
508
|
+
yaml_tag_directive_t tag_directive = POP(parser, parser->tag_directives);
|
|
509
|
+
yaml_free(tag_directive.handle);
|
|
510
|
+
yaml_free(tag_directive.prefix);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
parser->state = YAML_PARSE_DOCUMENT_START_STATE;
|
|
514
|
+
DOCUMENT_END_EVENT_INIT(*event, implicit, start_mark, end_mark);
|
|
515
|
+
|
|
516
|
+
return 1;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/*
|
|
520
|
+
* Parse the productions:
|
|
521
|
+
* block_node_or_indentless_sequence ::=
|
|
522
|
+
* ALIAS
|
|
523
|
+
* *****
|
|
524
|
+
* | properties (block_content | indentless_block_sequence)?
|
|
525
|
+
* ********** *
|
|
526
|
+
* | block_content | indentless_block_sequence
|
|
527
|
+
* *
|
|
528
|
+
* block_node ::= ALIAS
|
|
529
|
+
* *****
|
|
530
|
+
* | properties block_content?
|
|
531
|
+
* ********** *
|
|
532
|
+
* | block_content
|
|
533
|
+
* *
|
|
534
|
+
* flow_node ::= ALIAS
|
|
535
|
+
* *****
|
|
536
|
+
* | properties flow_content?
|
|
537
|
+
* ********** *
|
|
538
|
+
* | flow_content
|
|
539
|
+
* *
|
|
540
|
+
* properties ::= TAG ANCHOR? | ANCHOR TAG?
|
|
541
|
+
* *************************
|
|
542
|
+
* block_content ::= block_collection | flow_collection | SCALAR
|
|
543
|
+
* ******
|
|
544
|
+
* flow_content ::= flow_collection | SCALAR
|
|
545
|
+
* ******
|
|
546
|
+
*/
|
|
547
|
+
|
|
548
|
+
static int
|
|
549
|
+
yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
|
|
550
|
+
int block, int indentless_sequence)
|
|
551
|
+
{
|
|
552
|
+
yaml_token_t *token;
|
|
553
|
+
yaml_char_t *anchor = NULL;
|
|
554
|
+
yaml_char_t *tag_handle = NULL;
|
|
555
|
+
yaml_char_t *tag_suffix = NULL;
|
|
556
|
+
yaml_char_t *tag = NULL;
|
|
557
|
+
yaml_mark_t start_mark, end_mark, tag_mark;
|
|
558
|
+
int implicit;
|
|
559
|
+
|
|
560
|
+
token = PEEK_TOKEN(parser);
|
|
561
|
+
if (!token) return 0;
|
|
562
|
+
|
|
563
|
+
if (token->type == YAML_ALIAS_TOKEN)
|
|
564
|
+
{
|
|
565
|
+
parser->state = POP(parser, parser->states);
|
|
566
|
+
ALIAS_EVENT_INIT(*event, token->data.alias.value,
|
|
567
|
+
token->start_mark, token->end_mark);
|
|
568
|
+
SKIP_TOKEN(parser);
|
|
569
|
+
return 1;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
else
|
|
573
|
+
{
|
|
574
|
+
start_mark = end_mark = token->start_mark;
|
|
575
|
+
|
|
576
|
+
if (token->type == YAML_ANCHOR_TOKEN)
|
|
577
|
+
{
|
|
578
|
+
anchor = token->data.anchor.value;
|
|
579
|
+
start_mark = token->start_mark;
|
|
580
|
+
end_mark = token->end_mark;
|
|
581
|
+
SKIP_TOKEN(parser);
|
|
582
|
+
token = PEEK_TOKEN(parser);
|
|
583
|
+
if (!token) goto error;
|
|
584
|
+
if (token->type == YAML_TAG_TOKEN)
|
|
585
|
+
{
|
|
586
|
+
tag_handle = token->data.tag.handle;
|
|
587
|
+
tag_suffix = token->data.tag.suffix;
|
|
588
|
+
tag_mark = token->start_mark;
|
|
589
|
+
end_mark = token->end_mark;
|
|
590
|
+
SKIP_TOKEN(parser);
|
|
591
|
+
token = PEEK_TOKEN(parser);
|
|
592
|
+
if (!token) goto error;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else if (token->type == YAML_TAG_TOKEN)
|
|
596
|
+
{
|
|
597
|
+
tag_handle = token->data.tag.handle;
|
|
598
|
+
tag_suffix = token->data.tag.suffix;
|
|
599
|
+
start_mark = tag_mark = token->start_mark;
|
|
600
|
+
end_mark = token->end_mark;
|
|
601
|
+
SKIP_TOKEN(parser);
|
|
602
|
+
token = PEEK_TOKEN(parser);
|
|
603
|
+
if (!token) goto error;
|
|
604
|
+
if (token->type == YAML_ANCHOR_TOKEN)
|
|
605
|
+
{
|
|
606
|
+
anchor = token->data.anchor.value;
|
|
607
|
+
end_mark = token->end_mark;
|
|
608
|
+
SKIP_TOKEN(parser);
|
|
609
|
+
token = PEEK_TOKEN(parser);
|
|
610
|
+
if (!token) goto error;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
if (tag_handle) {
|
|
615
|
+
if (!*tag_handle) {
|
|
616
|
+
tag = tag_suffix;
|
|
617
|
+
yaml_free(tag_handle);
|
|
618
|
+
tag_handle = tag_suffix = NULL;
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
yaml_tag_directive_t *tag_directive;
|
|
622
|
+
for (tag_directive = parser->tag_directives.start;
|
|
623
|
+
tag_directive != parser->tag_directives.top;
|
|
624
|
+
tag_directive ++) {
|
|
625
|
+
if (strcmp((char *)tag_directive->handle, (char *)tag_handle) == 0) {
|
|
626
|
+
size_t prefix_len = strlen((char *)tag_directive->prefix);
|
|
627
|
+
size_t suffix_len = strlen((char *)tag_suffix);
|
|
628
|
+
tag = YAML_MALLOC(prefix_len+suffix_len+1);
|
|
629
|
+
if (!tag) {
|
|
630
|
+
parser->error = YAML_MEMORY_ERROR;
|
|
631
|
+
goto error;
|
|
632
|
+
}
|
|
633
|
+
memcpy(tag, tag_directive->prefix, prefix_len);
|
|
634
|
+
memcpy(tag+prefix_len, tag_suffix, suffix_len);
|
|
635
|
+
tag[prefix_len+suffix_len] = '\0';
|
|
636
|
+
yaml_free(tag_handle);
|
|
637
|
+
yaml_free(tag_suffix);
|
|
638
|
+
tag_handle = tag_suffix = NULL;
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (!tag) {
|
|
643
|
+
yaml_parser_set_parser_error_context(parser,
|
|
644
|
+
"while parsing a node", start_mark,
|
|
645
|
+
"found undefined tag handle", tag_mark);
|
|
646
|
+
goto error;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
implicit = (!tag || !*tag);
|
|
652
|
+
if (indentless_sequence && token->type == YAML_BLOCK_ENTRY_TOKEN) {
|
|
653
|
+
end_mark = token->end_mark;
|
|
654
|
+
parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
|
|
655
|
+
SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
|
|
656
|
+
YAML_BLOCK_SEQUENCE_STYLE, start_mark, end_mark);
|
|
657
|
+
return 1;
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
if (token->type == YAML_SCALAR_TOKEN) {
|
|
661
|
+
int plain_implicit = 0;
|
|
662
|
+
int quoted_implicit = 0;
|
|
663
|
+
end_mark = token->end_mark;
|
|
664
|
+
if ((token->data.scalar.style == YAML_PLAIN_SCALAR_STYLE && !tag)
|
|
665
|
+
|| (tag && strcmp((char *)tag, "!") == 0)) {
|
|
666
|
+
plain_implicit = 1;
|
|
667
|
+
}
|
|
668
|
+
else if (!tag) {
|
|
669
|
+
quoted_implicit = 1;
|
|
670
|
+
}
|
|
671
|
+
parser->state = POP(parser, parser->states);
|
|
672
|
+
SCALAR_EVENT_INIT(*event, anchor, tag,
|
|
673
|
+
token->data.scalar.value, token->data.scalar.length,
|
|
674
|
+
plain_implicit, quoted_implicit,
|
|
675
|
+
token->data.scalar.style, start_mark, end_mark);
|
|
676
|
+
SKIP_TOKEN(parser);
|
|
677
|
+
return 1;
|
|
678
|
+
}
|
|
679
|
+
else if (token->type == YAML_FLOW_SEQUENCE_START_TOKEN) {
|
|
680
|
+
if (!STACK_LIMIT(parser, parser->indents, MAX_NESTING_LEVEL - parser->flow_level)) {
|
|
681
|
+
yaml_maximum_level_reached(parser, start_mark, token->start_mark);
|
|
682
|
+
goto error;
|
|
683
|
+
}
|
|
684
|
+
end_mark = token->end_mark;
|
|
685
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE;
|
|
686
|
+
SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
|
|
687
|
+
YAML_FLOW_SEQUENCE_STYLE, start_mark, end_mark);
|
|
688
|
+
return 1;
|
|
689
|
+
}
|
|
690
|
+
else if (token->type == YAML_FLOW_MAPPING_START_TOKEN) {
|
|
691
|
+
if (!STACK_LIMIT(parser, parser->indents, MAX_NESTING_LEVEL - parser->flow_level)) {
|
|
692
|
+
yaml_maximum_level_reached(parser, start_mark, token->start_mark);
|
|
693
|
+
goto error;
|
|
694
|
+
}
|
|
695
|
+
end_mark = token->end_mark;
|
|
696
|
+
parser->state = YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE;
|
|
697
|
+
MAPPING_START_EVENT_INIT(*event, anchor, tag, implicit,
|
|
698
|
+
YAML_FLOW_MAPPING_STYLE, start_mark, end_mark);
|
|
699
|
+
return 1;
|
|
700
|
+
}
|
|
701
|
+
else if (block && token->type == YAML_BLOCK_SEQUENCE_START_TOKEN) {
|
|
702
|
+
if (!STACK_LIMIT(parser, parser->indents, MAX_NESTING_LEVEL - parser->flow_level)) {
|
|
703
|
+
yaml_maximum_level_reached(parser, start_mark, token->start_mark);
|
|
704
|
+
goto error;
|
|
705
|
+
}
|
|
706
|
+
end_mark = token->end_mark;
|
|
707
|
+
parser->state = YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE;
|
|
708
|
+
SEQUENCE_START_EVENT_INIT(*event, anchor, tag, implicit,
|
|
709
|
+
YAML_BLOCK_SEQUENCE_STYLE, start_mark, end_mark);
|
|
710
|
+
return 1;
|
|
711
|
+
}
|
|
712
|
+
else if (block && token->type == YAML_BLOCK_MAPPING_START_TOKEN) {
|
|
713
|
+
if (!STACK_LIMIT(parser, parser->indents, MAX_NESTING_LEVEL - parser->flow_level)) {
|
|
714
|
+
yaml_maximum_level_reached(parser, start_mark, token->start_mark);
|
|
715
|
+
goto error;
|
|
716
|
+
}
|
|
717
|
+
end_mark = token->end_mark;
|
|
718
|
+
parser->state = YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
|
|
719
|
+
MAPPING_START_EVENT_INIT(*event, anchor, tag, implicit,
|
|
720
|
+
YAML_BLOCK_MAPPING_STYLE, start_mark, end_mark);
|
|
721
|
+
return 1;
|
|
722
|
+
}
|
|
723
|
+
else if (anchor || tag) {
|
|
724
|
+
yaml_char_t *value = YAML_MALLOC(1);
|
|
725
|
+
if (!value) {
|
|
726
|
+
parser->error = YAML_MEMORY_ERROR;
|
|
727
|
+
goto error;
|
|
728
|
+
}
|
|
729
|
+
value[0] = '\0';
|
|
730
|
+
parser->state = POP(parser, parser->states);
|
|
731
|
+
SCALAR_EVENT_INIT(*event, anchor, tag, value, 0,
|
|
732
|
+
implicit, 0, YAML_PLAIN_SCALAR_STYLE,
|
|
733
|
+
start_mark, end_mark);
|
|
734
|
+
return 1;
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
yaml_parser_set_parser_error_context(parser,
|
|
738
|
+
(block ? "while parsing a block node"
|
|
739
|
+
: "while parsing a flow node"), start_mark,
|
|
740
|
+
"did not find expected node content", token->start_mark);
|
|
741
|
+
goto error;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
error:
|
|
747
|
+
yaml_free(anchor);
|
|
748
|
+
yaml_free(tag_handle);
|
|
749
|
+
yaml_free(tag_suffix);
|
|
750
|
+
yaml_free(tag);
|
|
751
|
+
|
|
752
|
+
return 0;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/*
|
|
756
|
+
* Parse the productions:
|
|
757
|
+
* block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
|
|
758
|
+
* ******************** *********** * *********
|
|
759
|
+
*/
|
|
760
|
+
|
|
761
|
+
static int
|
|
762
|
+
yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
|
|
763
|
+
yaml_event_t *event, int first)
|
|
764
|
+
{
|
|
765
|
+
yaml_token_t *token;
|
|
766
|
+
|
|
767
|
+
if (first) {
|
|
768
|
+
token = PEEK_TOKEN(parser);
|
|
769
|
+
if (!PUSH(parser, parser->marks, token->start_mark))
|
|
770
|
+
return 0;
|
|
771
|
+
SKIP_TOKEN(parser);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
token = PEEK_TOKEN(parser);
|
|
775
|
+
if (!token) return 0;
|
|
776
|
+
|
|
777
|
+
if (token->type == YAML_BLOCK_ENTRY_TOKEN)
|
|
778
|
+
{
|
|
779
|
+
yaml_mark_t mark = token->end_mark;
|
|
780
|
+
SKIP_TOKEN(parser);
|
|
781
|
+
token = PEEK_TOKEN(parser);
|
|
782
|
+
if (!token) return 0;
|
|
783
|
+
if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
|
|
784
|
+
token->type != YAML_BLOCK_END_TOKEN) {
|
|
785
|
+
if (!PUSH(parser, parser->states,
|
|
786
|
+
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE))
|
|
787
|
+
return 0;
|
|
788
|
+
return yaml_parser_parse_node(parser, event, 1, 0);
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
parser->state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
|
|
792
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
else if (token->type == YAML_BLOCK_END_TOKEN)
|
|
797
|
+
{
|
|
798
|
+
parser->state = POP(parser, parser->states);
|
|
799
|
+
(void)POP(parser, parser->marks);
|
|
800
|
+
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
|
|
801
|
+
SKIP_TOKEN(parser);
|
|
802
|
+
return 1;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
else
|
|
806
|
+
{
|
|
807
|
+
return yaml_parser_set_parser_error_context(parser,
|
|
808
|
+
"while parsing a block collection", POP(parser, parser->marks),
|
|
809
|
+
"did not find expected '-' indicator", token->start_mark);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/*
|
|
814
|
+
* Parse the productions:
|
|
815
|
+
* indentless_sequence ::= (BLOCK-ENTRY block_node?)+
|
|
816
|
+
* *********** *
|
|
817
|
+
*/
|
|
818
|
+
|
|
819
|
+
static int
|
|
820
|
+
yaml_parser_parse_indentless_sequence_entry(yaml_parser_t *parser,
|
|
821
|
+
yaml_event_t *event)
|
|
822
|
+
{
|
|
823
|
+
yaml_token_t *token;
|
|
824
|
+
|
|
825
|
+
token = PEEK_TOKEN(parser);
|
|
826
|
+
if (!token) return 0;
|
|
827
|
+
|
|
828
|
+
if (token->type == YAML_BLOCK_ENTRY_TOKEN)
|
|
829
|
+
{
|
|
830
|
+
yaml_mark_t mark = token->end_mark;
|
|
831
|
+
SKIP_TOKEN(parser);
|
|
832
|
+
token = PEEK_TOKEN(parser);
|
|
833
|
+
if (!token) return 0;
|
|
834
|
+
if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
|
|
835
|
+
token->type != YAML_KEY_TOKEN &&
|
|
836
|
+
token->type != YAML_VALUE_TOKEN &&
|
|
837
|
+
token->type != YAML_BLOCK_END_TOKEN) {
|
|
838
|
+
if (!PUSH(parser, parser->states,
|
|
839
|
+
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE))
|
|
840
|
+
return 0;
|
|
841
|
+
return yaml_parser_parse_node(parser, event, 1, 0);
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
|
|
845
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
else
|
|
850
|
+
{
|
|
851
|
+
parser->state = POP(parser, parser->states);
|
|
852
|
+
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
|
|
853
|
+
return 1;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/*
|
|
858
|
+
* Parse the productions:
|
|
859
|
+
* block_mapping ::= BLOCK-MAPPING_START
|
|
860
|
+
* *******************
|
|
861
|
+
* ((KEY block_node_or_indentless_sequence?)?
|
|
862
|
+
* *** *
|
|
863
|
+
* (VALUE block_node_or_indentless_sequence?)?)*
|
|
864
|
+
*
|
|
865
|
+
* BLOCK-END
|
|
866
|
+
* *********
|
|
867
|
+
*/
|
|
868
|
+
|
|
869
|
+
static int
|
|
870
|
+
yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
|
|
871
|
+
yaml_event_t *event, int first)
|
|
872
|
+
{
|
|
873
|
+
yaml_token_t *token;
|
|
874
|
+
|
|
875
|
+
if (first) {
|
|
876
|
+
token = PEEK_TOKEN(parser);
|
|
877
|
+
if (!PUSH(parser, parser->marks, token->start_mark))
|
|
878
|
+
return 0;
|
|
879
|
+
SKIP_TOKEN(parser);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
token = PEEK_TOKEN(parser);
|
|
883
|
+
if (!token) return 0;
|
|
884
|
+
|
|
885
|
+
if (token->type == YAML_KEY_TOKEN)
|
|
886
|
+
{
|
|
887
|
+
yaml_mark_t mark = token->end_mark;
|
|
888
|
+
SKIP_TOKEN(parser);
|
|
889
|
+
token = PEEK_TOKEN(parser);
|
|
890
|
+
if (!token) return 0;
|
|
891
|
+
if (token->type != YAML_KEY_TOKEN &&
|
|
892
|
+
token->type != YAML_VALUE_TOKEN &&
|
|
893
|
+
token->type != YAML_BLOCK_END_TOKEN) {
|
|
894
|
+
if (!PUSH(parser, parser->states,
|
|
895
|
+
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE))
|
|
896
|
+
return 0;
|
|
897
|
+
return yaml_parser_parse_node(parser, event, 1, 1);
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
parser->state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
|
|
901
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
else if (token->type == YAML_BLOCK_END_TOKEN)
|
|
906
|
+
{
|
|
907
|
+
parser->state = POP(parser, parser->states);
|
|
908
|
+
(void)POP(parser, parser->marks);
|
|
909
|
+
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
|
|
910
|
+
SKIP_TOKEN(parser);
|
|
911
|
+
return 1;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
else
|
|
915
|
+
{
|
|
916
|
+
return yaml_parser_set_parser_error_context(parser,
|
|
917
|
+
"while parsing a block mapping", POP(parser, parser->marks),
|
|
918
|
+
"did not find expected key", token->start_mark);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/*
|
|
923
|
+
* Parse the productions:
|
|
924
|
+
* block_mapping ::= BLOCK-MAPPING_START
|
|
925
|
+
*
|
|
926
|
+
* ((KEY block_node_or_indentless_sequence?)?
|
|
927
|
+
*
|
|
928
|
+
* (VALUE block_node_or_indentless_sequence?)?)*
|
|
929
|
+
* ***** *
|
|
930
|
+
* BLOCK-END
|
|
931
|
+
*
|
|
932
|
+
*/
|
|
933
|
+
|
|
934
|
+
static int
|
|
935
|
+
yaml_parser_parse_block_mapping_value(yaml_parser_t *parser,
|
|
936
|
+
yaml_event_t *event)
|
|
937
|
+
{
|
|
938
|
+
yaml_token_t *token;
|
|
939
|
+
|
|
940
|
+
token = PEEK_TOKEN(parser);
|
|
941
|
+
if (!token) return 0;
|
|
942
|
+
|
|
943
|
+
if (token->type == YAML_VALUE_TOKEN)
|
|
944
|
+
{
|
|
945
|
+
yaml_mark_t mark = token->end_mark;
|
|
946
|
+
SKIP_TOKEN(parser);
|
|
947
|
+
token = PEEK_TOKEN(parser);
|
|
948
|
+
if (!token) return 0;
|
|
949
|
+
if (token->type != YAML_KEY_TOKEN &&
|
|
950
|
+
token->type != YAML_VALUE_TOKEN &&
|
|
951
|
+
token->type != YAML_BLOCK_END_TOKEN) {
|
|
952
|
+
if (!PUSH(parser, parser->states,
|
|
953
|
+
YAML_PARSE_BLOCK_MAPPING_KEY_STATE))
|
|
954
|
+
return 0;
|
|
955
|
+
return yaml_parser_parse_node(parser, event, 1, 1);
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
|
|
959
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
else
|
|
964
|
+
{
|
|
965
|
+
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
|
|
966
|
+
return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/*
|
|
971
|
+
* Parse the productions:
|
|
972
|
+
* flow_sequence ::= FLOW-SEQUENCE-START
|
|
973
|
+
* *******************
|
|
974
|
+
* (flow_sequence_entry FLOW-ENTRY)*
|
|
975
|
+
* * **********
|
|
976
|
+
* flow_sequence_entry?
|
|
977
|
+
* *
|
|
978
|
+
* FLOW-SEQUENCE-END
|
|
979
|
+
* *****************
|
|
980
|
+
* flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
981
|
+
* *
|
|
982
|
+
*/
|
|
983
|
+
|
|
984
|
+
static int
|
|
985
|
+
yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
|
|
986
|
+
yaml_event_t *event, int first)
|
|
987
|
+
{
|
|
988
|
+
yaml_token_t *token;
|
|
989
|
+
|
|
990
|
+
if (first) {
|
|
991
|
+
token = PEEK_TOKEN(parser);
|
|
992
|
+
if (!PUSH(parser, parser->marks, token->start_mark))
|
|
993
|
+
return 0;
|
|
994
|
+
SKIP_TOKEN(parser);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
token = PEEK_TOKEN(parser);
|
|
998
|
+
if (!token) return 0;
|
|
999
|
+
|
|
1000
|
+
if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
|
|
1001
|
+
{
|
|
1002
|
+
if (!first) {
|
|
1003
|
+
if (token->type == YAML_FLOW_ENTRY_TOKEN) {
|
|
1004
|
+
SKIP_TOKEN(parser);
|
|
1005
|
+
token = PEEK_TOKEN(parser);
|
|
1006
|
+
if (!token) return 0;
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
return yaml_parser_set_parser_error_context(parser,
|
|
1010
|
+
"while parsing a flow sequence", POP(parser, parser->marks),
|
|
1011
|
+
"did not find expected ',' or ']'", token->start_mark);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
if (token->type == YAML_KEY_TOKEN) {
|
|
1016
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE;
|
|
1017
|
+
MAPPING_START_EVENT_INIT(*event, NULL, NULL,
|
|
1018
|
+
1, YAML_FLOW_MAPPING_STYLE,
|
|
1019
|
+
token->start_mark, token->end_mark);
|
|
1020
|
+
SKIP_TOKEN(parser);
|
|
1021
|
+
return 1;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
else if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
|
|
1025
|
+
if (!PUSH(parser, parser->states,
|
|
1026
|
+
YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE))
|
|
1027
|
+
return 0;
|
|
1028
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
parser->state = POP(parser, parser->states);
|
|
1033
|
+
(void)POP(parser, parser->marks);
|
|
1034
|
+
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
|
|
1035
|
+
SKIP_TOKEN(parser);
|
|
1036
|
+
return 1;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/*
|
|
1040
|
+
* Parse the productions:
|
|
1041
|
+
* flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
1042
|
+
* *** *
|
|
1043
|
+
*/
|
|
1044
|
+
|
|
1045
|
+
static int
|
|
1046
|
+
yaml_parser_parse_flow_sequence_entry_mapping_key(yaml_parser_t *parser,
|
|
1047
|
+
yaml_event_t *event)
|
|
1048
|
+
{
|
|
1049
|
+
yaml_token_t *token;
|
|
1050
|
+
|
|
1051
|
+
token = PEEK_TOKEN(parser);
|
|
1052
|
+
if (!token) return 0;
|
|
1053
|
+
|
|
1054
|
+
if (token->type != YAML_VALUE_TOKEN && token->type != YAML_FLOW_ENTRY_TOKEN
|
|
1055
|
+
&& token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
|
|
1056
|
+
if (!PUSH(parser, parser->states,
|
|
1057
|
+
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE))
|
|
1058
|
+
return 0;
|
|
1059
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1060
|
+
}
|
|
1061
|
+
else if (token->type == YAML_FLOW_SEQUENCE_END_TOKEN) {
|
|
1062
|
+
yaml_mark_t mark = token->start_mark;
|
|
1063
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE;
|
|
1064
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
yaml_mark_t mark = token->end_mark;
|
|
1068
|
+
SKIP_TOKEN(parser);
|
|
1069
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE;
|
|
1070
|
+
return yaml_parser_process_empty_scalar(parser, event, mark);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/*
|
|
1075
|
+
* Parse the productions:
|
|
1076
|
+
* flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
1077
|
+
* ***** *
|
|
1078
|
+
*/
|
|
1079
|
+
|
|
1080
|
+
static int
|
|
1081
|
+
yaml_parser_parse_flow_sequence_entry_mapping_value(yaml_parser_t *parser,
|
|
1082
|
+
yaml_event_t *event)
|
|
1083
|
+
{
|
|
1084
|
+
yaml_token_t *token;
|
|
1085
|
+
|
|
1086
|
+
token = PEEK_TOKEN(parser);
|
|
1087
|
+
if (!token) return 0;
|
|
1088
|
+
|
|
1089
|
+
if (token->type == YAML_VALUE_TOKEN) {
|
|
1090
|
+
SKIP_TOKEN(parser);
|
|
1091
|
+
token = PEEK_TOKEN(parser);
|
|
1092
|
+
if (!token) return 0;
|
|
1093
|
+
if (token->type != YAML_FLOW_ENTRY_TOKEN
|
|
1094
|
+
&& token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
|
|
1095
|
+
if (!PUSH(parser, parser->states,
|
|
1096
|
+
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE))
|
|
1097
|
+
return 0;
|
|
1098
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE;
|
|
1102
|
+
return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/*
|
|
1106
|
+
* Parse the productions:
|
|
1107
|
+
* flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
1108
|
+
* *
|
|
1109
|
+
*/
|
|
1110
|
+
|
|
1111
|
+
static int
|
|
1112
|
+
yaml_parser_parse_flow_sequence_entry_mapping_end(yaml_parser_t *parser,
|
|
1113
|
+
yaml_event_t *event)
|
|
1114
|
+
{
|
|
1115
|
+
yaml_token_t *token;
|
|
1116
|
+
|
|
1117
|
+
token = PEEK_TOKEN(parser);
|
|
1118
|
+
if (!token) return 0;
|
|
1119
|
+
|
|
1120
|
+
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE;
|
|
1121
|
+
|
|
1122
|
+
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
|
|
1123
|
+
return 1;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/*
|
|
1127
|
+
* Parse the productions:
|
|
1128
|
+
* flow_mapping ::= FLOW-MAPPING-START
|
|
1129
|
+
* ******************
|
|
1130
|
+
* (flow_mapping_entry FLOW-ENTRY)*
|
|
1131
|
+
* * **********
|
|
1132
|
+
* flow_mapping_entry?
|
|
1133
|
+
* ******************
|
|
1134
|
+
* FLOW-MAPPING-END
|
|
1135
|
+
* ****************
|
|
1136
|
+
* flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
1137
|
+
* * *** *
|
|
1138
|
+
*/
|
|
1139
|
+
|
|
1140
|
+
static int
|
|
1141
|
+
yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
|
|
1142
|
+
yaml_event_t *event, int first)
|
|
1143
|
+
{
|
|
1144
|
+
yaml_token_t *token;
|
|
1145
|
+
|
|
1146
|
+
if (first) {
|
|
1147
|
+
token = PEEK_TOKEN(parser);
|
|
1148
|
+
if (!PUSH(parser, parser->marks, token->start_mark))
|
|
1149
|
+
return 0;
|
|
1150
|
+
SKIP_TOKEN(parser);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
token = PEEK_TOKEN(parser);
|
|
1154
|
+
if (!token) return 0;
|
|
1155
|
+
|
|
1156
|
+
if (token->type != YAML_FLOW_MAPPING_END_TOKEN)
|
|
1157
|
+
{
|
|
1158
|
+
if (!first) {
|
|
1159
|
+
if (token->type == YAML_FLOW_ENTRY_TOKEN) {
|
|
1160
|
+
SKIP_TOKEN(parser);
|
|
1161
|
+
token = PEEK_TOKEN(parser);
|
|
1162
|
+
if (!token) return 0;
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
return yaml_parser_set_parser_error_context(parser,
|
|
1166
|
+
"while parsing a flow mapping", POP(parser, parser->marks),
|
|
1167
|
+
"did not find expected ',' or '}'", token->start_mark);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
if (token->type == YAML_KEY_TOKEN) {
|
|
1172
|
+
SKIP_TOKEN(parser);
|
|
1173
|
+
token = PEEK_TOKEN(parser);
|
|
1174
|
+
if (!token) return 0;
|
|
1175
|
+
if (token->type != YAML_VALUE_TOKEN
|
|
1176
|
+
&& token->type != YAML_FLOW_ENTRY_TOKEN
|
|
1177
|
+
&& token->type != YAML_FLOW_MAPPING_END_TOKEN) {
|
|
1178
|
+
if (!PUSH(parser, parser->states,
|
|
1179
|
+
YAML_PARSE_FLOW_MAPPING_VALUE_STATE))
|
|
1180
|
+
return 0;
|
|
1181
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1182
|
+
}
|
|
1183
|
+
else {
|
|
1184
|
+
parser->state = YAML_PARSE_FLOW_MAPPING_VALUE_STATE;
|
|
1185
|
+
return yaml_parser_process_empty_scalar(parser, event,
|
|
1186
|
+
token->start_mark);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
else if (token->type != YAML_FLOW_MAPPING_END_TOKEN) {
|
|
1190
|
+
if (!PUSH(parser, parser->states,
|
|
1191
|
+
YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE))
|
|
1192
|
+
return 0;
|
|
1193
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
parser->state = POP(parser, parser->states);
|
|
1198
|
+
(void)POP(parser, parser->marks);
|
|
1199
|
+
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
|
|
1200
|
+
SKIP_TOKEN(parser);
|
|
1201
|
+
return 1;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/*
|
|
1205
|
+
* Parse the productions:
|
|
1206
|
+
* flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
|
|
1207
|
+
* * ***** *
|
|
1208
|
+
*/
|
|
1209
|
+
|
|
1210
|
+
static int
|
|
1211
|
+
yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
|
|
1212
|
+
yaml_event_t *event, int empty)
|
|
1213
|
+
{
|
|
1214
|
+
yaml_token_t *token;
|
|
1215
|
+
|
|
1216
|
+
token = PEEK_TOKEN(parser);
|
|
1217
|
+
if (!token) return 0;
|
|
1218
|
+
|
|
1219
|
+
if (empty) {
|
|
1220
|
+
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
|
|
1221
|
+
return yaml_parser_process_empty_scalar(parser, event,
|
|
1222
|
+
token->start_mark);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
if (token->type == YAML_VALUE_TOKEN) {
|
|
1226
|
+
SKIP_TOKEN(parser);
|
|
1227
|
+
token = PEEK_TOKEN(parser);
|
|
1228
|
+
if (!token) return 0;
|
|
1229
|
+
if (token->type != YAML_FLOW_ENTRY_TOKEN
|
|
1230
|
+
&& token->type != YAML_FLOW_MAPPING_END_TOKEN) {
|
|
1231
|
+
if (!PUSH(parser, parser->states,
|
|
1232
|
+
YAML_PARSE_FLOW_MAPPING_KEY_STATE))
|
|
1233
|
+
return 0;
|
|
1234
|
+
return yaml_parser_parse_node(parser, event, 0, 0);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
|
|
1239
|
+
return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/*
|
|
1243
|
+
* Generate an empty scalar event.
|
|
1244
|
+
*/
|
|
1245
|
+
|
|
1246
|
+
static int
|
|
1247
|
+
yaml_parser_process_empty_scalar(yaml_parser_t *parser, yaml_event_t *event,
|
|
1248
|
+
yaml_mark_t mark)
|
|
1249
|
+
{
|
|
1250
|
+
yaml_char_t *value;
|
|
1251
|
+
|
|
1252
|
+
value = YAML_MALLOC(1);
|
|
1253
|
+
if (!value) {
|
|
1254
|
+
parser->error = YAML_MEMORY_ERROR;
|
|
1255
|
+
return 0;
|
|
1256
|
+
}
|
|
1257
|
+
value[0] = '\0';
|
|
1258
|
+
|
|
1259
|
+
SCALAR_EVENT_INIT(*event, NULL, NULL, value, 0,
|
|
1260
|
+
1, 0, YAML_PLAIN_SCALAR_STYLE, mark, mark);
|
|
1261
|
+
|
|
1262
|
+
return 1;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/*
|
|
1266
|
+
* Parse directives.
|
|
1267
|
+
*/
|
|
1268
|
+
|
|
1269
|
+
static int
|
|
1270
|
+
yaml_parser_process_directives(yaml_parser_t *parser,
|
|
1271
|
+
yaml_version_directive_t **version_directive_ref,
|
|
1272
|
+
yaml_tag_directive_t **tag_directives_start_ref,
|
|
1273
|
+
yaml_tag_directive_t **tag_directives_end_ref)
|
|
1274
|
+
{
|
|
1275
|
+
yaml_tag_directive_t default_tag_directives[] = {
|
|
1276
|
+
{(yaml_char_t *)"!", (yaml_char_t *)"!"},
|
|
1277
|
+
{(yaml_char_t *)"!!", (yaml_char_t *)"tag:yaml.org,2002:"},
|
|
1278
|
+
{NULL, NULL}
|
|
1279
|
+
};
|
|
1280
|
+
yaml_tag_directive_t *default_tag_directive;
|
|
1281
|
+
yaml_version_directive_t *version_directive = NULL;
|
|
1282
|
+
struct {
|
|
1283
|
+
yaml_tag_directive_t *start;
|
|
1284
|
+
yaml_tag_directive_t *end;
|
|
1285
|
+
yaml_tag_directive_t *top;
|
|
1286
|
+
} tag_directives = { NULL, NULL, NULL };
|
|
1287
|
+
yaml_token_t *token;
|
|
1288
|
+
|
|
1289
|
+
if (!STACK_INIT(parser, tag_directives, yaml_tag_directive_t*))
|
|
1290
|
+
goto error;
|
|
1291
|
+
|
|
1292
|
+
token = PEEK_TOKEN(parser);
|
|
1293
|
+
if (!token) goto error;
|
|
1294
|
+
|
|
1295
|
+
while (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
|
|
1296
|
+
token->type == YAML_TAG_DIRECTIVE_TOKEN)
|
|
1297
|
+
{
|
|
1298
|
+
if (token->type == YAML_VERSION_DIRECTIVE_TOKEN) {
|
|
1299
|
+
if (version_directive) {
|
|
1300
|
+
yaml_parser_set_parser_error(parser,
|
|
1301
|
+
"found duplicate %YAML directive", token->start_mark);
|
|
1302
|
+
goto error;
|
|
1303
|
+
}
|
|
1304
|
+
if (token->data.version_directive.major != 1
|
|
1305
|
+
|| (
|
|
1306
|
+
token->data.version_directive.minor != 1
|
|
1307
|
+
&& token->data.version_directive.minor != 2
|
|
1308
|
+
)) {
|
|
1309
|
+
yaml_parser_set_parser_error(parser,
|
|
1310
|
+
"found incompatible YAML document", token->start_mark);
|
|
1311
|
+
goto error;
|
|
1312
|
+
}
|
|
1313
|
+
version_directive = YAML_MALLOC_STATIC(yaml_version_directive_t);
|
|
1314
|
+
if (!version_directive) {
|
|
1315
|
+
parser->error = YAML_MEMORY_ERROR;
|
|
1316
|
+
goto error;
|
|
1317
|
+
}
|
|
1318
|
+
version_directive->major = token->data.version_directive.major;
|
|
1319
|
+
version_directive->minor = token->data.version_directive.minor;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
else if (token->type == YAML_TAG_DIRECTIVE_TOKEN) {
|
|
1323
|
+
yaml_tag_directive_t value;
|
|
1324
|
+
value.handle = token->data.tag_directive.handle;
|
|
1325
|
+
value.prefix = token->data.tag_directive.prefix;
|
|
1326
|
+
|
|
1327
|
+
if (!yaml_parser_append_tag_directive(parser, value, 0,
|
|
1328
|
+
token->start_mark))
|
|
1329
|
+
goto error;
|
|
1330
|
+
if (!PUSH(parser, tag_directives, value))
|
|
1331
|
+
goto error;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
SKIP_TOKEN(parser);
|
|
1335
|
+
token = PEEK_TOKEN(parser);
|
|
1336
|
+
if (!token) goto error;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
for (default_tag_directive = default_tag_directives;
|
|
1340
|
+
default_tag_directive->handle; default_tag_directive++) {
|
|
1341
|
+
if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
|
|
1342
|
+
token->start_mark))
|
|
1343
|
+
goto error;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
if (version_directive_ref) {
|
|
1347
|
+
*version_directive_ref = version_directive;
|
|
1348
|
+
}
|
|
1349
|
+
if (tag_directives_start_ref) {
|
|
1350
|
+
if (STACK_EMPTY(parser, tag_directives)) {
|
|
1351
|
+
*tag_directives_start_ref = *tag_directives_end_ref = NULL;
|
|
1352
|
+
STACK_DEL(parser, tag_directives);
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
*tag_directives_start_ref = tag_directives.start;
|
|
1356
|
+
*tag_directives_end_ref = tag_directives.top;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
STACK_DEL(parser, tag_directives);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
if (!version_directive_ref)
|
|
1364
|
+
yaml_free(version_directive);
|
|
1365
|
+
return 1;
|
|
1366
|
+
|
|
1367
|
+
error:
|
|
1368
|
+
yaml_free(version_directive);
|
|
1369
|
+
while (!STACK_EMPTY(parser, tag_directives)) {
|
|
1370
|
+
yaml_tag_directive_t tag_directive = POP(parser, tag_directives);
|
|
1371
|
+
yaml_free(tag_directive.handle);
|
|
1372
|
+
yaml_free(tag_directive.prefix);
|
|
1373
|
+
}
|
|
1374
|
+
STACK_DEL(parser, tag_directives);
|
|
1375
|
+
return 0;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/*
|
|
1379
|
+
* Append a tag directive to the directives stack.
|
|
1380
|
+
*/
|
|
1381
|
+
|
|
1382
|
+
static int
|
|
1383
|
+
yaml_parser_append_tag_directive(yaml_parser_t *parser,
|
|
1384
|
+
yaml_tag_directive_t value, int allow_duplicates, yaml_mark_t mark)
|
|
1385
|
+
{
|
|
1386
|
+
yaml_tag_directive_t *tag_directive;
|
|
1387
|
+
yaml_tag_directive_t copy = { NULL, NULL };
|
|
1388
|
+
|
|
1389
|
+
for (tag_directive = parser->tag_directives.start;
|
|
1390
|
+
tag_directive != parser->tag_directives.top; tag_directive ++) {
|
|
1391
|
+
if (strcmp((char *)value.handle, (char *)tag_directive->handle) == 0) {
|
|
1392
|
+
if (allow_duplicates)
|
|
1393
|
+
return 1;
|
|
1394
|
+
return yaml_parser_set_parser_error(parser,
|
|
1395
|
+
"found duplicate %TAG directive", mark);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
copy.handle = yaml_strdup(value.handle);
|
|
1400
|
+
copy.prefix = yaml_strdup(value.prefix);
|
|
1401
|
+
if (!copy.handle || !copy.prefix) {
|
|
1402
|
+
parser->error = YAML_MEMORY_ERROR;
|
|
1403
|
+
goto error;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
if (!PUSH(parser, parser->tag_directives, copy))
|
|
1407
|
+
goto error;
|
|
1408
|
+
|
|
1409
|
+
return 1;
|
|
1410
|
+
|
|
1411
|
+
error:
|
|
1412
|
+
yaml_free(copy.handle);
|
|
1413
|
+
yaml_free(copy.prefix);
|
|
1414
|
+
return 0;
|
|
1415
|
+
}
|
|
1416
|
+
|