From 6a315e96420ecab68c5d9f0b40fb74cb8cbad611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 16:44:13 +0200 Subject: [PATCH 01/16] update: add Column/Line information for annotations --- drafter.gyp | 8 +++-- src/ConversionContext.cc | 7 +++- src/ConversionContext.h | 9 ++++- src/RefractAPI.cc | 7 ++-- src/RefractAPI.h | 2 +- src/RefractSourceMap.cc | 31 ++++++++++++++++++ src/RefractSourceMap.h | 6 ++-- src/SerializeResult.cc | 9 ++--- src/SourceMapUtils.cc | 60 +++++++++++++++++++++++++++++++++ src/SourceMapUtils.h | 39 ++++++++++++++++++++++ src/drafter.cc | 4 ++- src/reporting.cc | 71 ++-------------------------------------- src/reporting.h | 1 + 13 files changed, 172 insertions(+), 82 deletions(-) create mode 100644 src/SourceMapUtils.cc create mode 100644 src/SourceMapUtils.h diff --git a/drafter.gyp b/drafter.gyp index 6cca56093..248c42215 100644 --- a/drafter.gyp +++ b/drafter.gyp @@ -263,8 +263,12 @@ "src/RefractElementFactory.cc", "src/ConversionContext.cc", "src/ConversionContext.h", - "src/ElementInfoUtils.h" - "src/ElementComparator.h" + "src/ElementInfoUtils.h", + "src/ElementComparator.h", + + + "src/SourceMapUtils.h", + "src/SourceMapUtils.cc", "src/utils/Variant.h", "src/utils/Utf8.h", diff --git a/src/ConversionContext.cc b/src/ConversionContext.cc index 8ac6fadfb..5d3cee8e2 100644 --- a/src/ConversionContext.cc +++ b/src/ConversionContext.cc @@ -11,6 +11,11 @@ namespace drafter { + ConversionContext::ConversionContext(const char* source, const WrapperOptions& options) : options(options) + { + ::GetLinesEndIndex(source, newLinesIndex); + } + void ConversionContext::warn(const snowcrash::Warning& warning) { for (auto& item : warnings) { @@ -36,4 +41,4 @@ namespace drafter warnings.push_back(warning); } -} \ No newline at end of file +} diff --git a/src/ConversionContext.h b/src/ConversionContext.h index ef06c7e38..1edab81ed 100644 --- a/src/ConversionContext.h +++ b/src/ConversionContext.h @@ -10,6 +10,7 @@ #include "refract/Registry.h" #include "snowcrash.h" +#include "SourceMapUtils.h" namespace drafter { @@ -19,8 +20,11 @@ namespace drafter class ConversionContext { refract::Registry registry; + NewLinesIndex newLinesIndex; public: + ConversionContext(const char* source, const WrapperOptions& options); + const WrapperOptions& options; std::vector warnings; @@ -34,7 +38,10 @@ namespace drafter return registry; } - ConversionContext(const WrapperOptions& options) : options(options) {} + inline const NewLinesIndex& GetNewLinesIndex() const + { + return newLinesIndex; + } void warn(const snowcrash::Warning& warning); }; diff --git a/src/RefractAPI.cc b/src/RefractAPI.cc index 540a01c1f..e264a2aab 100644 --- a/src/RefractAPI.cc +++ b/src/RefractAPI.cc @@ -26,6 +26,8 @@ #include "NamedTypesRegistry.h" #include "ConversionContext.h" +#include "reporting.h" + using namespace drafter; using namespace refract; using namespace drafter::utils::log; @@ -613,7 +615,7 @@ std::unique_ptr drafter::BlueprintToRefract( } std::unique_ptr drafter::AnnotationToRefract( - const snowcrash::SourceAnnotation& annotation, const std::string& key) + const snowcrash::SourceAnnotation& annotation, const std::string& key, ConversionContext& context) { auto element = from_primitive(annotation.message); @@ -622,7 +624,8 @@ std::unique_ptr drafter::AnnotationToRefract( element->meta().set(SerializeKey::Classes, make_element(from_primitive(key))); element->attributes().set(SerializeKey::AnnotationCode, from_primitive(annotation.code)); - element->attributes().set(SerializeKey::SourceMap, SourceMapToRefract(annotation.location)); + element->attributes().set( + SerializeKey::SourceMap, SourceMapToRefractWithColumnLineInfo(annotation.location, context)); return std::move(element); } diff --git a/src/RefractAPI.h b/src/RefractAPI.h index e1b1c86dc..175a2ab7d 100644 --- a/src/RefractAPI.h +++ b/src/RefractAPI.h @@ -22,7 +22,7 @@ namespace drafter class ConversionContext; std::unique_ptr AnnotationToRefract( - const snowcrash::SourceAnnotation& annotation, const std::string& key); + const snowcrash::SourceAnnotation& annotation, const std::string& key, ConversionContext& context); std::unique_ptr DataStructureToRefract( const NodeInfo& dataStructure, ConversionContext& context); diff --git a/src/RefractSourceMap.cc b/src/RefractSourceMap.cc index 9afae4081..86b19abba 100644 --- a/src/RefractSourceMap.cc +++ b/src/RefractSourceMap.cc @@ -1,4 +1,6 @@ #include "RefractSourceMap.h" +#include "reporting.h" +#include "ConversionContext.h" using namespace refract; @@ -10,6 +12,7 @@ namespace from_primitive(sourceMap.location), from_primitive(sourceMap.length)); } + } // namespace std::unique_ptr drafter::SourceMapToRefract(const mdp::CharactersRangeSet& sourceMap) @@ -26,6 +29,34 @@ std::unique_ptr drafter::SourceMapToRefract(const mdp::CharactersRange return make_element(std::move(sourceMapElement)); } +std::unique_ptr drafter::SourceMapToRefractWithColumnLineInfo( + const mdp::CharactersRangeSet& sourceMap, const ConversionContext& context) +{ + auto sourceMapElement = make_element(); + sourceMapElement->element(SerializeKey::SourceMap); + + std::transform( // + sourceMap.begin(), + sourceMap.end(), + std::back_inserter(sourceMapElement->get()), + [&context](auto& sourceMap) { + AnnotationPosition position; + ::GetLineFromMap(context.GetNewLinesIndex(), sourceMap, position); + + auto location = make_element(sourceMap.location); + location->attributes().set("line", from_primitive(position.fromLine)); + location->attributes().set("column", from_primitive(position.fromColumn)); + + auto length = make_element(sourceMap.length); + length->attributes().set("line", from_primitive(position.toLine)); + length->attributes().set("column", from_primitive(position.toColumn)); + + return make_element(std::move(location), std::move(length)); + }); + + return make_element(std::move(sourceMapElement)); +} + std::unique_ptr drafter::LiteralToRefract( const NodeInfo& literal, ConversionContext& context) { diff --git a/src/RefractSourceMap.h b/src/RefractSourceMap.h index 5c8a9c3f2..525ab3304 100644 --- a/src/RefractSourceMap.h +++ b/src/RefractSourceMap.h @@ -14,7 +14,11 @@ namespace drafter { + class ConversionContext; + std::unique_ptr SourceMapToRefract(const mdp::CharactersRangeSet& sourceMap); + std::unique_ptr SourceMapToRefractWithColumnLineInfo( + const mdp::CharactersRangeSet& sourceMap, const ConversionContext& context); template void AttachSourceMap(refract::IElement& element, const T& nodeInfo) @@ -32,8 +36,6 @@ namespace drafter return std::move(element); } - class ConversionContext; - std::unique_ptr LiteralToRefract( const NodeInfo& literal, ConversionContext& context); } diff --git a/src/SerializeResult.cc b/src/SerializeResult.cc index 4785d5ab3..2f5d70417 100644 --- a/src/SerializeResult.cc +++ b/src/SerializeResult.cc @@ -26,12 +26,13 @@ namespace helper struct AnnotationToRefract { const std::string& key; + ConversionContext& context; - AnnotationToRefract(const std::string& key) : key(key) {} + AnnotationToRefract(const std::string& key, ConversionContext& context) : key(key), context(context) {} auto operator()(snowcrash::SourceAnnotation& annotation) { - return drafter::AnnotationToRefract(annotation, key); + return drafter::AnnotationToRefract(annotation, key, context); } }; } @@ -69,7 +70,7 @@ std::unique_ptr drafter::WrapRefract( } if (blueprint.report.error.code != snowcrash::Error::OK) { - parseResult->get().push_back(helper::AnnotationToRefract(SerializeKey::Error)(blueprint.report.error)); + parseResult->get().push_back(helper::AnnotationToRefract(SerializeKey::Error, context)(blueprint.report.error)); } snowcrash::Warnings& warnings = blueprint.report.warnings; @@ -82,7 +83,7 @@ std::unique_ptr drafter::WrapRefract( std::transform(warnings.begin(), warnings.end(), std::back_inserter(parseResult->get()), - helper::AnnotationToRefract(SerializeKey::Warning)); + helper::AnnotationToRefract(SerializeKey::Warning, context)); } return parseResult; diff --git a/src/SourceMapUtils.cc b/src/SourceMapUtils.cc new file mode 100644 index 000000000..f719b37c6 --- /dev/null +++ b/src/SourceMapUtils.cc @@ -0,0 +1,60 @@ +#include "SourceMapUtils.h" +#include + +/** + * \brief Convert character index mapping to line and column number + * \param linesEndIndex Vector containing indexes of end line characters + * \param range Character index mapping as input + * \param out Position of the given range as output + */ +void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out) +{ + + std::vector::const_iterator annotationPositionIt; + + out.fromLine = 0; + out.fromColumn = 0; + out.toLine = 0; + out.toColumn = 0; + + // Finds starting line and column position + annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1; + + if (annotationPositionIt != linesEndIndex.end()) { + + out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; + out.fromColumn = range.location - *annotationPositionIt + 1; + } + + // Finds ending line and column position + annotationPositionIt + = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1; + + if (annotationPositionIt != linesEndIndex.end()) { + + out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; + out.toColumn = (range.location + range.length) - *annotationPositionIt + 1; + + if (*(annotationPositionIt + 1) == (range.location + range.length)) { + out.toColumn--; + } + } +} + +/** + * \brief Given the source returns the length of all the lines in source as a vector + * \param source Source data + * \param out Vector containing indexes of all end line character in source + */ +void GetLinesEndIndex(const std::string& source, std::vector& out) +{ + + out.push_back(0); + + for (size_t i = 0; i < source.length(); i++) { + + if (source[i] == '\n') { + out.push_back(i + 1); + } + } +} diff --git a/src/SourceMapUtils.h b/src/SourceMapUtils.h new file mode 100644 index 000000000..6e60a0298 --- /dev/null +++ b/src/SourceMapUtils.h @@ -0,0 +1,39 @@ +// +// SourceMapUtils.h +// librafter +// +// Created by Jiri Kratochvil on 2018-10-02 +// Copyright (c) 2018 Apiary Inc. All rights reserved. +// + +#ifndef DRAFTER_SOURCEMAPUTILS_H +#define DRAFTER_SOURCEMAPUTILS_H + +#include "SourceAnnotation.h" + +typedef std::vector NewLinesIndex; + +/** structure contains starting and ending position of a error/warning. */ +struct AnnotationPosition { + size_t fromLine; + size_t fromColumn; + size_t toLine; + size_t toColumn; +}; + +/** + * \brief Convert character index mapping to line and column number + * \param linesEndIndex Vector containing indexes of end line characters + * \param range Character index mapping as input + * \param out Position of the given range as output + */ +void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out); + +/** + * \brief Given the source returns the length of all the lines in source as a vector + * \param source Source data + * \param out Vector containing indexes of all end line character in source + */ +void GetLinesEndIndex(const std::string& source, NewLinesIndex& out); + +#endif diff --git a/src/drafter.cc b/src/drafter.cc index c8a26ccb2..86a457626 100644 --- a/src/drafter.cc +++ b/src/drafter.cc @@ -25,6 +25,8 @@ #include "Version.h" +#include "reporting.h" + #include DRAFTER_API drafter_error drafter_parse_blueprint_to(const char* source, @@ -83,7 +85,7 @@ DRAFTER_API drafter_error drafter_parse_blueprint( sc::parse(source, scOptions, blueprint); drafter::WrapperOptions wrapperOptions; - drafter::ConversionContext context(wrapperOptions); + drafter::ConversionContext context(source, wrapperOptions); auto result = WrapRefract(blueprint, context); *out = result.release(); diff --git a/src/reporting.cc b/src/reporting.cc index 61dec0673..31f08d691 100644 --- a/src/reporting.cc +++ b/src/reporting.cc @@ -18,6 +18,7 @@ #include "refract/TypeQueryVisitor.h" #include "refract/VisitorUtils.h" +#include "SourceMapUtils.h" namespace sc = snowcrash; @@ -37,72 +38,6 @@ namespace return out; } - /** structure contains starting and ending position of a error/warning. */ - struct AnnotationPosition { - size_t fromLine; - size_t fromColumn; - size_t toLine; - size_t toColumn; - }; - - /** - * \brief Convert character index mapping to line and column number - * \param linesEndIndex Vector containing indexes of end line characters - * \param range Character index mapping as input - * \param out Position of the given range as output - */ - void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out) - { - - std::vector::const_iterator annotationPositionIt; - - out.fromLine = 0; - out.fromColumn = 0; - out.toLine = 0; - out.toColumn = 0; - - // Finds starting line and column position - annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1; - - if (annotationPositionIt != linesEndIndex.end()) { - - out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.fromColumn = range.location - *annotationPositionIt + 1; - } - - // Finds ending line and column position - annotationPositionIt - = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1; - - if (annotationPositionIt != linesEndIndex.end()) { - - out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.toColumn = (range.location + range.length) - *annotationPositionIt + 1; - - if (*(annotationPositionIt + 1) == (range.location + range.length)) { - out.toColumn--; - } - } - } - - /** - * \brief Given the source returns the length of all the lines in source as a vector - * \param source Source data - * \param out Vector containing indexes of all end line character in source - */ - void GetLinesEndIndex(const std::string& source, std::vector& out) - { - - out.push_back(0); - - for (size_t i = 0; i < source.length(); i++) { - - if (source[i] == '\n') { - out.push_back(i + 1); - } - } - } - void PrintAnnotation(const std::string& prefix, const snowcrash::SourceAnnotation& annotation, const std::string& source, @@ -134,7 +69,7 @@ namespace if (useLineNumbers) { AnnotationPosition annotationPosition; - GetLineFromMap(linesEndIndex, *it, annotationPosition); + ::GetLineFromMap(linesEndIndex, *it, annotationPosition); std::cerr << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn; @@ -176,7 +111,7 @@ namespace AnnotationPosition annotationPosition; mdp::Range pos(static_cast(loc->get()), static_cast(len->get())); - GetLineFromMap(linesEndIndex, pos, annotationPosition); + ::GetLineFromMap(linesEndIndex, pos, annotationPosition); output << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn; diff --git a/src/reporting.h b/src/reporting.h index 0e2036f57..3002febe3 100644 --- a/src/reporting.h +++ b/src/reporting.h @@ -11,6 +11,7 @@ #include "drafter.h" #include "SourceAnnotation.h" +#include "reporting.h" /** * \brief Print parser report to stderr. From ccb859e89d2c29a0e9f68feacc2739a7e2b51c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 16:45:08 +0200 Subject: [PATCH 02/16] update: update tests for anotation extended info --- test/draftertest.h | 42 ++++++++++++++------------- test/test-RefractDataStructureTest.cc | 10 ------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/test/draftertest.h b/test/draftertest.h index d0341b864..57db4d28e 100644 --- a/test/draftertest.h +++ b/test/draftertest.h @@ -17,25 +17,25 @@ #include "Serialize.h" #include "SerializeResult.h" -#define TEST_DRAFTER(description, category, name, tag, wrapper, options, mustBeOk) \ - TEST_CASE(description " " category " " name, "[" tag "][" category "][" name "]") \ +static drafter::WrapperOptions MSONTestOptions(false, true); + +#define TEST_MSON(name, mustBeOk) \ + TEST_CASE("Testing MSON serialization for " name, "[refract][MSON][" name "]") \ { \ - REQUIRE(FixtureHelper::handleResultJSON(wrapper, "test/fixtures/" category "/" name, options, mustBeOk)); \ + REQUIRE(FixtureHelper::handleResultJSON("test/fixtures/mson/" name, MSONTestOptions, mustBeOk)); \ } #define TEST_REFRACT(category, name) \ TEST_CASE("Testing refract serialization for " category " " name, "[refract][" category "][" name "]") \ { \ - FixtureHelper::handleResultJSON( \ - &FixtureHelper::parseAndSerialize, "test/fixtures/" category "/" name, drafter::WrapperOptions(false)); \ + FixtureHelper::handleResultJSON("test/fixtures/" category "/" name, drafter::WrapperOptions(false)); \ } #define TEST_REFRACT_SOURCE_MAP(category, name) \ TEST_CASE("Testing refract + source map serialization for " category " " name, \ "[refract_sourcemap][" category "][" name "]") \ { \ - FixtureHelper::handleResultJSON( \ - &FixtureHelper::parseAndSerialize, "test/fixtures/" category "/" name, drafter::WrapperOptions(true)); \ + FixtureHelper::handleResultJSON("test/fixtures/" category "/" name, drafter::WrapperOptions(true)); \ } namespace draftertest @@ -103,10 +103,11 @@ namespace draftertest struct FixtureHelper { - static std::unique_ptr parseAndSerialize( - snowcrash::ParseResult& blueprint, const drafter::WrapperOptions& options) + static std::unique_ptr parseAndSerialize(const std::string& source, + snowcrash::ParseResult& blueprint, + const drafter::WrapperOptions& options) { - drafter::ConversionContext context(options); + drafter::ConversionContext context(source.c_str(), options); return WrapRefract(blueprint, context); } @@ -150,23 +151,24 @@ namespace draftertest return ext::json; } - typedef std::unique_ptr (*Wrapper)( - snowcrash::ParseResult& blueprint, const drafter::WrapperOptions& options); + typedef std::unique_ptr (*Wrapper)(const std::string& source, + snowcrash::ParseResult& blueprint, + const drafter::WrapperOptions& options); - static bool handleResultJSON(const Wrapper wrapper, - const std::string& basepath, - const drafter::WrapperOptions& options, - bool mustBeOk = false) + static bool handleResultJSON( + const std::string& fixturePath, const drafter::WrapperOptions& options, bool mustBeOk = false) { ENABLE_LOGGING; - ITFixtureFiles fixture = ITFixtureFiles(basepath); + ITFixtureFiles fixture = ITFixtureFiles(fixturePath); snowcrash::ParseResult blueprint; - int result = snowcrash::parse(fixture.get(ext::apib), snowcrash::ExportSourcemapOption, blueprint); + const auto source = fixture.get(ext::apib); + + int result = snowcrash::parse(source, snowcrash::ExportSourcemapOption, blueprint); std::ostringstream outStream; - if (auto parsed = (*wrapper)(blueprint, options)) { + if (auto parsed = parseAndSerialize(source, blueprint, options)) { auto soValue = refract::serialize::renderSo(*parsed, options.generateSourceMap); drafter::utils::so::serialize_json(outStream, soValue); } @@ -177,7 +179,7 @@ namespace draftertest std::string expected; std::string extension = getFixtureExtension(options); - INFO("Filename: \x1b[35m" << basepath << extension << "\x1b[0m"); + INFO("Filename: \x1b[35m" << fixturePath << extension << "\x1b[0m"); expected = fixture.get(extension); if (actual != expected) { diff --git a/test/test-RefractDataStructureTest.cc b/test/test-RefractDataStructureTest.cc index 10af69459..e48ac83e2 100644 --- a/test/test-RefractDataStructureTest.cc +++ b/test/test-RefractDataStructureTest.cc @@ -2,16 +2,6 @@ using namespace draftertest; -static drafter::WrapperOptions MSONTestOptions(false, true); - -#define TEST_MSON(file, mustBeOk) \ - TEST_DRAFTER("Testing MSON serialization for", \ - "mson", \ - file, \ - "refract", \ - &FixtureHelper::parseAndSerialize, \ - MSONTestOptions, \ - mustBeOk) #define TEST_MSON_SUCCESS(file) TEST_MSON(file, true) TEST_MSON_SUCCESS("primitives"); From 70420dac082dc446104adbb58f9708293ec3c737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 21:52:25 +0200 Subject: [PATCH 03/16] chore: update fixtures according to changes --- test/fixtures/api/issue-386.sourcemap.json | 20 ++ test/fixtures/api/request-only.json | 20 ++ test/fixtures/api/request-only.sourcemap.json | 20 ++ test/fixtures/circular/mixed.json | 20 ++ test/fixtures/circular/mixin-cross.json | 20 ++ test/fixtures/circular/mixin-embed.json | 20 ++ test/fixtures/circular/mixin-identity.json | 20 ++ test/fixtures/circular/mixin-member.json | 20 ++ .../check-bool-number-value-validity.json | 100 ++++++++++ .../mson/check-default-without-value.json | 20 ++ .../mson/check-sample-without-value.json | 20 ++ test/fixtures/mson/enum-empty-default.json | 20 ++ test/fixtures/mson/enum-multiple-default.json | 160 ++++++++++++++++ test/fixtures/mson/enum-variants.json | 120 ++++++++++++ test/fixtures/mson/mixin-nonexistent.json | 40 ++++ test/fixtures/mson/number-wrong-value.json | 20 ++ .../fixtures/mson/primitive-with-members.json | 180 ++++++++++++++++++ test/fixtures/mson/regression-269.json | 20 ++ .../mson/resource-primitive-mixin.json | 40 ++++ .../mson/resource-unresolved-reference.json | 40 ++++ .../mson/type-attributes-payload.json | 20 ++ .../type-attributes-payload.sourcemap.json | 20 ++ test/fixtures/mson/type-attributes.json | 80 ++++++++ .../mson/type-attributes.sourcemap.json | 80 ++++++++ test/fixtures/parse-result/blueprint.json | 20 ++ .../parse-result/blueprint.sourcemap.json | 20 ++ test/fixtures/parse-result/error-warning.json | 40 ++++ .../parse-result/error-warning.sourcemap.json | 40 ++++ test/fixtures/parse-result/warning.json | 20 ++ .../parse-result/warning.sourcemap.json | 20 ++ test/fixtures/parse-result/warnings.json | 40 ++++ .../parse-result/warnings.sourcemap.json | 40 ++++ .../render/enum-default-multiple.json | 60 ++++++ test/fixtures/render/issue-246.json | 100 ++++++++++ test/fixtures/render/issue-318.json | 60 ++++++ test/fixtures/render/issue-328-1.json | 20 ++ test/fixtures/render/issue-328-2.json | 40 ++++ test/fixtures/render/issue-547.json | 20 ++ test/fixtures/render/numbers.json | 160 ++++++++++++++++ test/fixtures/syntax/issue-350.json | 60 ++++++ 40 files changed, 1900 insertions(+) diff --git a/test/fixtures/api/issue-386.sourcemap.json b/test/fixtures/api/issue-386.sourcemap.json index add9edc31..6b929af9a 100644 --- a/test/fixtures/api/issue-386.sourcemap.json +++ b/test/fixtures/api/issue-386.sourcemap.json @@ -844,10 +844,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 153 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 4 } ] diff --git a/test/fixtures/api/request-only.json b/test/fixtures/api/request-only.json index 1e1475d13..9cc2fe25c 100644 --- a/test/fixtures/api/request-only.json +++ b/test/fixtures/api/request-only.json @@ -133,10 +133,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 26 } ] diff --git a/test/fixtures/api/request-only.sourcemap.json b/test/fixtures/api/request-only.sourcemap.json index a6f082c37..1867427c6 100644 --- a/test/fixtures/api/request-only.sourcemap.json +++ b/test/fixtures/api/request-only.sourcemap.json @@ -331,10 +331,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 26 } ] diff --git a/test/fixtures/circular/mixed.json b/test/fixtures/circular/mixed.json index 0a8468d2b..0c24eefae 100644 --- a/test/fixtures/circular/mixed.json +++ b/test/fixtures/circular/mixed.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 109 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 10 } ] diff --git a/test/fixtures/circular/mixin-cross.json b/test/fixtures/circular/mixin-cross.json index 14def45e0..17f2d058c 100644 --- a/test/fixtures/circular/mixin-cross.json +++ b/test/fixtures/circular/mixin-cross.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 122 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 10 } ] diff --git a/test/fixtures/circular/mixin-embed.json b/test/fixtures/circular/mixin-embed.json index 26704e692..534ba384c 100644 --- a/test/fixtures/circular/mixin-embed.json +++ b/test/fixtures/circular/mixin-embed.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 89 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 12 } ] diff --git a/test/fixtures/circular/mixin-identity.json b/test/fixtures/circular/mixin-identity.json index 3a6e7b6b3..bf9898eaf 100644 --- a/test/fixtures/circular/mixin-identity.json +++ b/test/fixtures/circular/mixin-identity.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 98 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 10 } ] diff --git a/test/fixtures/circular/mixin-member.json b/test/fixtures/circular/mixin-member.json index 5a6db0acf..c0d8e54a1 100644 --- a/test/fixtures/circular/mixin-member.json +++ b/test/fixtures/circular/mixin-member.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 7 + } + }, "content": 102 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 16 + } + }, "content": 10 } ] diff --git a/test/fixtures/mson/check-bool-number-value-validity.json b/test/fixtures/mson/check-bool-number-value-validity.json index ba035253e..43a77fd69 100644 --- a/test/fixtures/mson/check-bool-number-value-validity.json +++ b/test/fixtures/mson/check-bool-number-value-validity.json @@ -296,10 +296,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 65 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 16 + } + }, "content": 14 } ] @@ -340,10 +360,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 7 + } + }, "content": 98 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 32 + } + }, "content": 26 } ] @@ -384,10 +424,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 126 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 12 } ] @@ -428,10 +488,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 12 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 140 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 12 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 11 } ] @@ -472,10 +552,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 186 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 20 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] diff --git a/test/fixtures/mson/check-default-without-value.json b/test/fixtures/mson/check-default-without-value.json index 1933e88a0..b4e0d51af 100644 --- a/test/fixtures/mson/check-default-without-value.json +++ b/test/fixtures/mson/check-default-without-value.json @@ -144,10 +144,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 66 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 25 + } + }, "content": 15 } ] diff --git a/test/fixtures/mson/check-sample-without-value.json b/test/fixtures/mson/check-sample-without-value.json index f02c37e35..19ac3ce2b 100644 --- a/test/fixtures/mson/check-sample-without-value.json +++ b/test/fixtures/mson/check-sample-without-value.json @@ -144,10 +144,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 66 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 24 + } + }, "content": 14 } ] diff --git a/test/fixtures/mson/enum-empty-default.json b/test/fixtures/mson/enum-empty-default.json index e08b0222d..37263aa9c 100644 --- a/test/fixtures/mson/enum-empty-default.json +++ b/test/fixtures/mson/enum-empty-default.json @@ -334,10 +334,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 115 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 15 + } + }, "content": 13 } ] diff --git a/test/fixtures/mson/enum-multiple-default.json b/test/fixtures/mson/enum-multiple-default.json index 8a7401e68..1f45c66a0 100644 --- a/test/fixtures/mson/enum-multiple-default.json +++ b/test/fixtures/mson/enum-multiple-default.json @@ -296,10 +296,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 69 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 10 } ] @@ -309,10 +329,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 83 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] @@ -322,10 +362,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 95 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] @@ -366,10 +426,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 12 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 122 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 12 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 10 } ] @@ -379,10 +459,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 136 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] @@ -392,10 +492,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 149 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 10 } ] @@ -405,10 +525,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 163 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] @@ -449,10 +589,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 175 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 29 + } + }, "content": 27 } ] diff --git a/test/fixtures/mson/enum-variants.json b/test/fixtures/mson/enum-variants.json index 13d2f052f..53af2bd8c 100644 --- a/test/fixtures/mson/enum-variants.json +++ b/test/fixtures/mson/enum-variants.json @@ -1663,10 +1663,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 145 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 74 + } + }, "content": 72 } ] @@ -1707,10 +1727,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 60 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 1133 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 60 + }, + "column": { + "element": "number", + "content": 38 + } + }, "content": 36 } ] @@ -1751,10 +1791,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 64 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 1188 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 64 + }, + "column": { + "element": "number", + "content": 40 + } + }, "content": 38 } ] @@ -1795,10 +1855,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 80 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 1440 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 80 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 10 } ] @@ -1808,10 +1888,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 81 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 1454 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 81 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] @@ -1821,10 +1921,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 82 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 1466 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 82 + }, + "column": { + "element": "number", + "content": 12 + } + }, "content": 8 } ] diff --git a/test/fixtures/mson/mixin-nonexistent.json b/test/fixtures/mson/mixin-nonexistent.json index aabc493c6..ac25374ec 100644 --- a/test/fixtures/mson/mixin-nonexistent.json +++ b/test/fixtures/mson/mixin-nonexistent.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 282 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 12 } ] @@ -74,10 +94,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 282 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 14 + } + }, "content": 12 } ] diff --git a/test/fixtures/mson/number-wrong-value.json b/test/fixtures/mson/number-wrong-value.json index 0bceb6a3f..ba7d6ce7a 100644 --- a/test/fixtures/mson/number-wrong-value.json +++ b/test/fixtures/mson/number-wrong-value.json @@ -101,10 +101,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 334 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 32 + } + }, "content": 30 } ] diff --git a/test/fixtures/mson/primitive-with-members.json b/test/fixtures/mson/primitive-with-members.json index e0a985709..95ea7e438 100644 --- a/test/fixtures/mson/primitive-with-members.json +++ b/test/fixtures/mson/primitive-with-members.json @@ -144,10 +144,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 74 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -188,10 +208,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 74 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -232,10 +272,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 105 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -276,10 +336,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 105 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -320,10 +400,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 134 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -364,10 +464,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 134 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] @@ -408,10 +528,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 165 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 15 + } + }, "content": 15 } ] @@ -452,10 +592,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 165 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 15 + } + }, "content": 15 } ] @@ -496,10 +656,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 18 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 180 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 6 } ] diff --git a/test/fixtures/mson/regression-269.json b/test/fixtures/mson/regression-269.json index fc3aa0d26..86880cc77 100644 --- a/test/fixtures/mson/regression-269.json +++ b/test/fixtures/mson/regression-269.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 19 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 10 + } + }, "content": 10 } ] diff --git a/test/fixtures/mson/resource-primitive-mixin.json b/test/fixtures/mson/resource-primitive-mixin.json index e5ccbe657..08ccf1eca 100644 --- a/test/fixtures/mson/resource-primitive-mixin.json +++ b/test/fixtures/mson/resource-primitive-mixin.json @@ -99,10 +99,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 7 + } + }, "content": 45 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 21 + } + }, "content": 15 } ] @@ -143,10 +163,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 43 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 21 + } + }, "content": 17 } ] diff --git a/test/fixtures/mson/resource-unresolved-reference.json b/test/fixtures/mson/resource-unresolved-reference.json index 1c323f23c..9a79dd035 100644 --- a/test/fixtures/mson/resource-unresolved-reference.json +++ b/test/fixtures/mson/resource-unresolved-reference.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 99 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 22 + } + }, "content": 20 } ] @@ -74,10 +94,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 76 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 21 } ] diff --git a/test/fixtures/mson/type-attributes-payload.json b/test/fixtures/mson/type-attributes-payload.json index 876e368ea..db6e0327b 100644 --- a/test/fixtures/mson/type-attributes-payload.json +++ b/test/fixtures/mson/type-attributes-payload.json @@ -219,10 +219,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 85 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 33 + } + }, "content": 23 } ] diff --git a/test/fixtures/mson/type-attributes-payload.sourcemap.json b/test/fixtures/mson/type-attributes-payload.sourcemap.json index 1ed2a14d7..b71ccbdd5 100644 --- a/test/fixtures/mson/type-attributes-payload.sourcemap.json +++ b/test/fixtures/mson/type-attributes-payload.sourcemap.json @@ -442,10 +442,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 85 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 33 + } + }, "content": 23 } ] diff --git a/test/fixtures/mson/type-attributes.json b/test/fixtures/mson/type-attributes.json index 24d9b6a47..036014f4d 100644 --- a/test/fixtures/mson/type-attributes.json +++ b/test/fixtures/mson/type-attributes.json @@ -121,10 +121,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -165,10 +185,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -209,10 +249,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -253,10 +313,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] diff --git a/test/fixtures/mson/type-attributes.sourcemap.json b/test/fixtures/mson/type-attributes.sourcemap.json index 94e4187d0..fa6a4c7fe 100644 --- a/test/fixtures/mson/type-attributes.sourcemap.json +++ b/test/fixtures/mson/type-attributes.sourcemap.json @@ -194,10 +194,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -238,10 +258,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -282,10 +322,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] @@ -326,10 +386,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 3 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 64 + } + }, "content": 62 } ] diff --git a/test/fixtures/parse-result/blueprint.json b/test/fixtures/parse-result/blueprint.json index e7cb242a5..8ae4e9bc0 100644 --- a/test/fixtures/parse-result/blueprint.json +++ b/test/fixtures/parse-result/blueprint.json @@ -130,10 +130,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 87 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 24 + } + }, "content": 24 } ] diff --git a/test/fixtures/parse-result/blueprint.sourcemap.json b/test/fixtures/parse-result/blueprint.sourcemap.json index e8345cd68..5717ad5ba 100644 --- a/test/fixtures/parse-result/blueprint.sourcemap.json +++ b/test/fixtures/parse-result/blueprint.sourcemap.json @@ -330,10 +330,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 87 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 24 + } + }, "content": 24 } ] diff --git a/test/fixtures/parse-result/error-warning.json b/test/fixtures/parse-result/error-warning.json index 21f5e16a6..08db9975b 100644 --- a/test/fixtures/parse-result/error-warning.json +++ b/test/fixtures/parse-result/error-warning.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 55 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 9 + } + }, "content": 9 } ] @@ -74,10 +94,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 8 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] diff --git a/test/fixtures/parse-result/error-warning.sourcemap.json b/test/fixtures/parse-result/error-warning.sourcemap.json index 21f5e16a6..08db9975b 100644 --- a/test/fixtures/parse-result/error-warning.sourcemap.json +++ b/test/fixtures/parse-result/error-warning.sourcemap.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 55 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 9 + } + }, "content": 9 } ] @@ -74,10 +94,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 8 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 2 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] diff --git a/test/fixtures/parse-result/warning.json b/test/fixtures/parse-result/warning.json index 291a1e750..2c625b551 100644 --- a/test/fixtures/parse-result/warning.json +++ b/test/fixtures/parse-result/warning.json @@ -123,10 +123,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] diff --git a/test/fixtures/parse-result/warning.sourcemap.json b/test/fixtures/parse-result/warning.sourcemap.json index f3c85c182..4831b1239 100644 --- a/test/fixtures/parse-result/warning.sourcemap.json +++ b/test/fixtures/parse-result/warning.sourcemap.json @@ -246,10 +246,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] diff --git a/test/fixtures/parse-result/warnings.json b/test/fixtures/parse-result/warnings.json index 93a9d759f..0035c7371 100644 --- a/test/fixtures/parse-result/warnings.json +++ b/test/fixtures/parse-result/warnings.json @@ -139,10 +139,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] @@ -183,10 +203,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 37 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 27 } ] diff --git a/test/fixtures/parse-result/warnings.sourcemap.json b/test/fixtures/parse-result/warnings.sourcemap.json index 144b3b501..7b45e29df 100644 --- a/test/fixtures/parse-result/warnings.sourcemap.json +++ b/test/fixtures/parse-result/warnings.sourcemap.json @@ -287,10 +287,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 24 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 13 } ] @@ -331,10 +351,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 37 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 27 } ] diff --git a/test/fixtures/render/enum-default-multiple.json b/test/fixtures/render/enum-default-multiple.json index 858fc9279..7f6263eaf 100644 --- a/test/fixtures/render/enum-default-multiple.json +++ b/test/fixtures/render/enum-default-multiple.json @@ -274,10 +274,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 115 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 25 + } + }, "content": 13 } ] @@ -287,10 +307,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 140 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 25 + } + }, "content": 13 } ] @@ -300,10 +340,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 13 + } + }, "content": 165 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 25 + } + }, "content": 13 } ] diff --git a/test/fixtures/render/issue-246.json b/test/fixtures/render/issue-246.json index eb6a5868b..7b2c0fe6f 100644 --- a/test/fixtures/render/issue-246.json +++ b/test/fixtures/render/issue-246.json @@ -283,10 +283,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 128 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 23 + } + }, "content": 19 } ] @@ -327,10 +347,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 161 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 31 } ] @@ -371,10 +411,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 192 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 21 } ] @@ -415,10 +475,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 18 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 213 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 13 } ] @@ -459,10 +539,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 21 + }, + "column": { + "element": "number", + "content": 5 + } + }, "content": 240 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 21 + }, + "column": { + "element": "number", + "content": 23 + } + }, "content": 19 } ] diff --git a/test/fixtures/render/issue-318.json b/test/fixtures/render/issue-318.json index 1549c1673..3ac7090e0 100644 --- a/test/fixtures/render/issue-318.json +++ b/test/fixtures/render/issue-318.json @@ -283,10 +283,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 118 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 12 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 28 } ] @@ -327,10 +347,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 13 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 146 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 36 } ] @@ -371,10 +411,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 182 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 20 } ] diff --git a/test/fixtures/render/issue-328-1.json b/test/fixtures/render/issue-328-1.json index 3b8aac5b3..75526dfe9 100644 --- a/test/fixtures/render/issue-328-1.json +++ b/test/fixtures/render/issue-328-1.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 30 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 18 } ] diff --git a/test/fixtures/render/issue-328-2.json b/test/fixtures/render/issue-328-2.json index 4ff4b1657..26b3f5f9a 100644 --- a/test/fixtures/render/issue-328-2.json +++ b/test/fixtures/render/issue-328-2.json @@ -30,10 +30,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 6 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 35 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 18 } ] @@ -74,10 +94,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 10 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 73 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 11 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 15 } ] diff --git a/test/fixtures/render/issue-547.json b/test/fixtures/render/issue-547.json index 0e6398e09..6fbe4cac2 100644 --- a/test/fixtures/render/issue-547.json +++ b/test/fixtures/render/issue-547.json @@ -170,10 +170,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 71 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 18 + } + }, "content": 8 } ] diff --git a/test/fixtures/render/numbers.json b/test/fixtures/render/numbers.json index 236bd8afa..bbd6011d1 100644 --- a/test/fixtures/render/numbers.json +++ b/test/fixtures/render/numbers.json @@ -448,10 +448,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 791 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 47 + } + }, "content": 37 } ] @@ -492,10 +512,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 838 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 15 + }, + "column": { + "element": "number", + "content": 71 + } + }, "content": 61 } ] @@ -536,10 +576,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 909 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 16 + }, + "column": { + "element": "number", + "content": 51 + } + }, "content": 41 } ] @@ -580,10 +640,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 960 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 17 + }, + "column": { + "element": "number", + "content": 53 + } + }, "content": 43 } ] @@ -624,10 +704,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 18 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 1013 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 18 + }, + "column": { + "element": "number", + "content": 54 + } + }, "content": 44 } ] @@ -668,10 +768,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 1067 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 19 + }, + "column": { + "element": "number", + "content": 48 + } + }, "content": 38 } ] @@ -712,10 +832,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 20 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 1115 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 20 + }, + "column": { + "element": "number", + "content": 55 + } + }, "content": 45 } ] @@ -756,10 +896,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 21 + }, + "column": { + "element": "number", + "content": 11 + } + }, "content": 1170 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 21 + }, + "column": { + "element": "number", + "content": 38 + } + }, "content": 28 } ] diff --git a/test/fixtures/syntax/issue-350.json b/test/fixtures/syntax/issue-350.json index ce247535b..e60fd9d4c 100644 --- a/test/fixtures/syntax/issue-350.json +++ b/test/fixtures/syntax/issue-350.json @@ -126,10 +126,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 3 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 32 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 4 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 34 } ] @@ -170,10 +190,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 5 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 66 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 7 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 44 } ] @@ -214,10 +254,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 8 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 110 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 9 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 16 } ] From 7a2146d336da004d6671f50f6f5de2741c104969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 22:09:21 +0200 Subject: [PATCH 04/16] chore: remove restful header file --- src/ConversionContext.cc | 2 +- src/RefractAPI.cc | 2 -- src/RefractSourceMap.cc | 3 +- src/SourceMapUtils.cc | 74 ++++++++++++++++++---------------------- src/SourceMapUtils.h | 53 +++++++++++++++------------- src/reporting.cc | 1 + src/reporting.h | 1 - 7 files changed, 66 insertions(+), 70 deletions(-) diff --git a/src/ConversionContext.cc b/src/ConversionContext.cc index 5d3cee8e2..55be7b244 100644 --- a/src/ConversionContext.cc +++ b/src/ConversionContext.cc @@ -13,7 +13,7 @@ namespace drafter ConversionContext::ConversionContext(const char* source, const WrapperOptions& options) : options(options) { - ::GetLinesEndIndex(source, newLinesIndex); + GetLinesEndIndex(source, newLinesIndex); } void ConversionContext::warn(const snowcrash::Warning& warning) diff --git a/src/RefractAPI.cc b/src/RefractAPI.cc index e264a2aab..e1588838a 100644 --- a/src/RefractAPI.cc +++ b/src/RefractAPI.cc @@ -26,8 +26,6 @@ #include "NamedTypesRegistry.h" #include "ConversionContext.h" -#include "reporting.h" - using namespace drafter; using namespace refract; using namespace drafter::utils::log; diff --git a/src/RefractSourceMap.cc b/src/RefractSourceMap.cc index 86b19abba..7e044774d 100644 --- a/src/RefractSourceMap.cc +++ b/src/RefractSourceMap.cc @@ -1,5 +1,4 @@ #include "RefractSourceMap.h" -#include "reporting.h" #include "ConversionContext.h" using namespace refract; @@ -41,7 +40,7 @@ std::unique_ptr drafter::SourceMapToRefractWithColumnLineInfo( std::back_inserter(sourceMapElement->get()), [&context](auto& sourceMap) { AnnotationPosition position; - ::GetLineFromMap(context.GetNewLinesIndex(), sourceMap, position); + GetLineFromMap(context.GetNewLinesIndex(), sourceMap, position); auto location = make_element(sourceMap.location); location->attributes().set("line", from_primitive(position.fromLine)); diff --git a/src/SourceMapUtils.cc b/src/SourceMapUtils.cc index f719b37c6..ce5a26564 100644 --- a/src/SourceMapUtils.cc +++ b/src/SourceMapUtils.cc @@ -1,60 +1,54 @@ #include "SourceMapUtils.h" #include -/** - * \brief Convert character index mapping to line and column number - * \param linesEndIndex Vector containing indexes of end line characters - * \param range Character index mapping as input - * \param out Position of the given range as output - */ -void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out) +namespace drafter { - std::vector::const_iterator annotationPositionIt; + void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out) + { - out.fromLine = 0; - out.fromColumn = 0; - out.toLine = 0; - out.toColumn = 0; + std::vector::const_iterator annotationPositionIt; - // Finds starting line and column position - annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1; + out.fromLine = 0; + out.fromColumn = 0; + out.toLine = 0; + out.toColumn = 0; - if (annotationPositionIt != linesEndIndex.end()) { + // Finds starting line and column position + annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1; - out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.fromColumn = range.location - *annotationPositionIt + 1; - } + if (annotationPositionIt != linesEndIndex.end()) { + + out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; + out.fromColumn = range.location - *annotationPositionIt + 1; + } - // Finds ending line and column position - annotationPositionIt - = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1; + // Finds ending line and column position + annotationPositionIt + = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1; - if (annotationPositionIt != linesEndIndex.end()) { + if (annotationPositionIt != linesEndIndex.end()) { - out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.toColumn = (range.location + range.length) - *annotationPositionIt + 1; + out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; + out.toColumn = (range.location + range.length) - *annotationPositionIt + 1; - if (*(annotationPositionIt + 1) == (range.location + range.length)) { - out.toColumn--; + if (*(annotationPositionIt + 1) == (range.location + range.length)) { + out.toColumn--; + } } } -} - -/** - * \brief Given the source returns the length of all the lines in source as a vector - * \param source Source data - * \param out Vector containing indexes of all end line character in source - */ -void GetLinesEndIndex(const std::string& source, std::vector& out) -{ - out.push_back(0); + void GetLinesEndIndex(const std::string& source, std::vector& out) + { + + out.push_back(0); - for (size_t i = 0; i < source.length(); i++) { + for (size_t i = 0; i < source.length(); i++) { - if (source[i] == '\n') { - out.push_back(i + 1); + if (source[i] == '\n') { + out.push_back(i + 1); + } } } -} + +} // namespace drafter diff --git a/src/SourceMapUtils.h b/src/SourceMapUtils.h index 6e60a0298..539908e0e 100644 --- a/src/SourceMapUtils.h +++ b/src/SourceMapUtils.h @@ -11,29 +11,34 @@ #include "SourceAnnotation.h" -typedef std::vector NewLinesIndex; - -/** structure contains starting and ending position of a error/warning. */ -struct AnnotationPosition { - size_t fromLine; - size_t fromColumn; - size_t toLine; - size_t toColumn; -}; - -/** - * \brief Convert character index mapping to line and column number - * \param linesEndIndex Vector containing indexes of end line characters - * \param range Character index mapping as input - * \param out Position of the given range as output - */ -void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out); - -/** - * \brief Given the source returns the length of all the lines in source as a vector - * \param source Source data - * \param out Vector containing indexes of all end line character in source - */ -void GetLinesEndIndex(const std::string& source, NewLinesIndex& out); +namespace drafter +{ + + typedef std::vector NewLinesIndex; + + /** structure contains starting and ending position of a error/warning. */ + struct AnnotationPosition { + size_t fromLine; + size_t fromColumn; + size_t toLine; + size_t toColumn; + }; + + /** + * \brief Convert character index mapping to line and column number + * \param linesEndIndex Vector containing indexes of end line characters + * \param range Character index mapping as input + * \param out Position of the given range as output + */ + void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out); + + /** + * \brief Given the source returns the length of all the lines in source as a vector + * \param source Source data + * \param out Vector containing indexes of all end line character in source + */ + void GetLinesEndIndex(const std::string& source, NewLinesIndex& out); + +} // namespace drafter #endif diff --git a/src/reporting.cc b/src/reporting.cc index 31f08d691..bb8f955b6 100644 --- a/src/reporting.cc +++ b/src/reporting.cc @@ -23,6 +23,7 @@ namespace sc = snowcrash; using namespace refract; +using namespace drafter; namespace { diff --git a/src/reporting.h b/src/reporting.h index 3002febe3..0e2036f57 100644 --- a/src/reporting.h +++ b/src/reporting.h @@ -11,7 +11,6 @@ #include "drafter.h" #include "SourceAnnotation.h" -#include "reporting.h" /** * \brief Print parser report to stderr. From d514785c4dcb6c652c431fe6549fdc88abec3478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 22:26:37 +0200 Subject: [PATCH 05/16] chore: update integration testr fixtures --- features/fixtures/refract.json | 60 ++++++++++++++++++++++++ features/fixtures/refract.sourcemap.json | 60 ++++++++++++++++++++++++ features/fixtures/refract.sourcemap.yaml | 42 +++++++++++++++++ features/fixtures/refract.yaml | 42 +++++++++++++++++ 4 files changed, 204 insertions(+) diff --git a/features/fixtures/refract.json b/features/fixtures/refract.json index 820699693..b80b4fdcb 100644 --- a/features/fixtures/refract.json +++ b/features/fixtures/refract.json @@ -1040,10 +1040,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 39 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 685 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 42 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 } ] @@ -1084,10 +1104,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 55 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 992 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 58 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 } ] @@ -1128,10 +1168,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 7 + } + }, "content": 200 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 108 + } + }, "content": 102 } ] diff --git a/features/fixtures/refract.sourcemap.json b/features/fixtures/refract.sourcemap.json index 5f3a104f7..4a61817c7 100644 --- a/features/fixtures/refract.sourcemap.json +++ b/features/fixtures/refract.sourcemap.json @@ -3212,10 +3212,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 39 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 685 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 42 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 } ] @@ -3256,10 +3276,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 55 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 992 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 58 + }, + "column": { + "element": "number", + "content": 1 + } + }, "content": 45 } ] @@ -3300,10 +3340,30 @@ "content": [ { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 7 + } + }, "content": 200 }, { "element": "number", + "attributes": { + "line": { + "element": "number", + "content": 14 + }, + "column": { + "element": "number", + "content": 108 + } + }, "content": 102 } ] diff --git a/features/fixtures/refract.sourcemap.yaml b/features/fixtures/refract.sourcemap.yaml index 6a171f7a4..a19f67665 100644 --- a/features/fixtures/refract.sourcemap.yaml +++ b/features/fixtures/refract.sourcemap.yaml @@ -2095,9 +2095,23 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 39 + column: + element: "number" + content: 1 content: 685 - element: "number" + attributes: + line: + element: "number" + content: 42 + column: + element: "number" + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2124,9 +2138,23 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 55 + column: + element: "number" + content: 1 content: 992 - element: "number" + attributes: + line: + element: "number" + content: 58 + column: + element: "number" + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2153,8 +2181,22 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 14 + column: + element: "number" + content: 7 content: 200 - element: "number" + attributes: + line: + element: "number" + content: 14 + column: + element: "number" + content: 108 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" diff --git a/features/fixtures/refract.yaml b/features/fixtures/refract.yaml index 37241f595..b68cd1df6 100644 --- a/features/fixtures/refract.yaml +++ b/features/fixtures/refract.yaml @@ -701,9 +701,23 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 39 + column: + element: "number" + content: 1 content: 685 - element: "number" + attributes: + line: + element: "number" + content: 42 + column: + element: "number" + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -730,9 +744,23 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 55 + column: + element: "number" + content: 1 content: 992 - element: "number" + attributes: + line: + element: "number" + content: 58 + column: + element: "number" + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -759,8 +787,22 @@ content: content: - element: "number" + attributes: + line: + element: "number" + content: 14 + column: + element: "number" + content: 7 content: 200 - element: "number" + attributes: + line: + element: "number" + content: 14 + column: + element: "number" + content: 108 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" From 7626424a4b5ee60b6b4004f010196c183dac487a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 2 Oct 2018 22:44:32 +0200 Subject: [PATCH 06/16] chore: remove unused function --- test/draftertest.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/test/draftertest.h b/test/draftertest.h index 57db4d28e..414208b2f 100644 --- a/test/draftertest.h +++ b/test/draftertest.h @@ -103,15 +103,6 @@ namespace draftertest struct FixtureHelper { - static std::unique_ptr parseAndSerialize(const std::string& source, - snowcrash::ParseResult& blueprint, - const drafter::WrapperOptions& options) - { - drafter::ConversionContext context(source.c_str(), options); - - return WrapRefract(blueprint, context); - } - static const std::string printDiff(const std::string& actual, const std::string& expected) { // First, convert strings into arrays of lines. @@ -151,10 +142,6 @@ namespace draftertest return ext::json; } - typedef std::unique_ptr (*Wrapper)(const std::string& source, - snowcrash::ParseResult& blueprint, - const drafter::WrapperOptions& options); - static bool handleResultJSON( const std::string& fixturePath, const drafter::WrapperOptions& options, bool mustBeOk = false) { @@ -168,7 +155,9 @@ namespace draftertest int result = snowcrash::parse(source, snowcrash::ExportSourcemapOption, blueprint); std::ostringstream outStream; - if (auto parsed = parseAndSerialize(source, blueprint, options)) { + drafter::ConversionContext context(source.c_str(), options); + + if (auto parsed = WrapRefract(blueprint, context)) { auto soValue = refract::serialize::renderSo(*parsed, options.generateSourceMap); drafter::utils::so::serialize_json(outStream, soValue); } From fa195df745a87357c633de196db7152213fa0b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Thu, 18 Oct 2018 12:36:13 +0200 Subject: [PATCH 07/16] update: add unit test to cover map sourcemap ranges translation to column/line --- test/test-sourceMapToLineColumn.cc | 149 +++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 test/test-sourceMapToLineColumn.cc diff --git a/test/test-sourceMapToLineColumn.cc b/test/test-sourceMapToLineColumn.cc new file mode 100644 index 000000000..599a7f84f --- /dev/null +++ b/test/test-sourceMapToLineColumn.cc @@ -0,0 +1,149 @@ +#include "catch.hpp" + +#include "../src/SourceMapUtils.h" + +using namespace drafter; + +/* +Map: +'^' - newline +'_' - other character + +01234567 + +____^ 0, 5 +____^ 5, 5 +^ 10, 1 +___^ 11, 4 +__^ 15, 3 +_______^ 18, 8 +*/ + +static const NewLinesIndex nlIndex = { 0, 5, 10, 11, 15, 18, 26 }; + +TEST_CASE("AnnotationPosition is initialized to zero", "[sourcemap utils]") +{ + AnnotationPosition a; + + REQUIRE(a.fromLine == 0); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 0); + REQUIRE(a.toColumn == 0); +} + +TEST_CASE("GetLineFromMap for position [0,3]", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {0,3}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 1); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 1); + REQUIRE(a.toColumn == 2); +} + +TEST_CASE("GetLineFromMap for position - 1st line w/o NL", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {0,4}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 1); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 1); + REQUIRE(a.toColumn == 3); +} + +TEST_CASE("GetLineFromMap for position - 1st line w/ NL", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {0,5}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 1); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 1); + REQUIRE(a.toColumn == 4); +} + +TEST_CASE("GetLineFromMap for position - 2nd line w/ NL", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {5,5}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 2); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 2); + REQUIRE(a.toColumn == 4); +} + +TEST_CASE("GetLineFromMap for position - last line w/ NL", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {18,8}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 6); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 6); + REQUIRE(a.toColumn == 7); +} + +TEST_CASE("GetLineFromMap for position - 3rd empty line - just NL", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {10,1}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 3); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 3); + REQUIRE(a.toColumn == 0); +} + +TEST_CASE("GetLineFromMap for position - 1st two lines", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {0,10}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 1); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 2); + REQUIRE(a.toColumn == 4); +} + +TEST_CASE("GetLineFromMap for position - lines 1-3", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {5,10}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 2); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 4); + REQUIRE(a.toColumn == 3); +} + +TEST_CASE("GetLineFromMap for position - all lines", "[sourcemap utils]") +{ + AnnotationPosition a; + mdp::Range r = {0,26}; + + GetLineFromMap(nlIndex, r, a); + + REQUIRE(a.fromLine == 1); + REQUIRE(a.fromColumn == 0); + REQUIRE(a.toLine == 6); + REQUIRE(a.toColumn == 7); +} From fa7a80a7a550b41a766be544f58b8c84ff8592d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Mon, 5 Nov 2018 11:18:46 +0100 Subject: [PATCH 08/16] Update implementation --- drafter.gyp | 1 + src/ConversionContext.cc | 4 +- src/ConversionContext.h | 2 +- src/RefractSourceMap.cc | 3 +- src/SourceMapUtils.cc | 66 +++++++++++++++++---------- src/SourceMapUtils.h | 16 +++---- src/reporting.cc | 12 ++--- test/test-sourceMapToLineColumn.cc | 73 ++++++++++++++++++------------ 8 files changed, 103 insertions(+), 74 deletions(-) diff --git a/drafter.gyp b/drafter.gyp index 248c42215..47801ef20 100644 --- a/drafter.gyp +++ b/drafter.gyp @@ -416,6 +416,7 @@ "test/test-ElementInfoUtils.cc", "test/test-ElementComparator.cc", "test/test-VisitorUtils.cc", + "test/test-sourceMapToLineColumn.cc", ], 'dependencies': [ diff --git a/src/ConversionContext.cc b/src/ConversionContext.cc index 55be7b244..e1c057fe0 100644 --- a/src/ConversionContext.cc +++ b/src/ConversionContext.cc @@ -11,9 +11,9 @@ namespace drafter { - ConversionContext::ConversionContext(const char* source, const WrapperOptions& options) : options(options) + ConversionContext::ConversionContext(const char* source, const WrapperOptions& options) + : newLinesIndex(GetLinesEndIndex(source)), options(options) { - GetLinesEndIndex(source, newLinesIndex); } void ConversionContext::warn(const snowcrash::Warning& warning) diff --git a/src/ConversionContext.h b/src/ConversionContext.h index 1edab81ed..58a410ca1 100644 --- a/src/ConversionContext.h +++ b/src/ConversionContext.h @@ -20,7 +20,7 @@ namespace drafter class ConversionContext { refract::Registry registry; - NewLinesIndex newLinesIndex; + const NewLinesIndex newLinesIndex; public: ConversionContext(const char* source, const WrapperOptions& options); diff --git a/src/RefractSourceMap.cc b/src/RefractSourceMap.cc index 7e044774d..145de3d6c 100644 --- a/src/RefractSourceMap.cc +++ b/src/RefractSourceMap.cc @@ -39,8 +39,7 @@ std::unique_ptr drafter::SourceMapToRefractWithColumnLineInfo( sourceMap.end(), std::back_inserter(sourceMapElement->get()), [&context](auto& sourceMap) { - AnnotationPosition position; - GetLineFromMap(context.GetNewLinesIndex(), sourceMap, position); + auto position = GetLineFromMap(context.GetNewLinesIndex(), sourceMap); auto location = make_element(sourceMap.location); location->attributes().set("line", from_primitive(position.fromLine)); diff --git a/src/SourceMapUtils.cc b/src/SourceMapUtils.cc index ce5a26564..623f6d17a 100644 --- a/src/SourceMapUtils.cc +++ b/src/SourceMapUtils.cc @@ -1,54 +1,70 @@ #include "SourceMapUtils.h" #include +#include "utils/Utf8.h" + +#include + namespace drafter { - void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out) + const AnnotationPosition GetLineFromMap(const NewLinesIndex& linesEndIndex, const mdp::Range& range) { - - std::vector::const_iterator annotationPositionIt; - - out.fromLine = 0; - out.fromColumn = 0; - out.toLine = 0; - out.toColumn = 0; - // Finds starting line and column position - annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1; + AnnotationPosition out; + if (linesEndIndex.empty()) { // to avoid std::prev() on empty + return out; + } - if (annotationPositionIt != linesEndIndex.end()) { + auto annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location); - out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.fromColumn = range.location - *annotationPositionIt + 1; + if (annotationPositionIt != linesEndIndex.end()) { + out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt); + out.fromColumn = range.location - *std::prev(annotationPositionIt); } // Finds ending line and column position annotationPositionIt - = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1; + = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length); - if (annotationPositionIt != linesEndIndex.end()) { + // + // FIXME: workaround for byte mapping + // handle just case when position is after latest newline + // remove once all sourceMaps will correctly send character ranges + // + + if (linesEndIndex.back() < (range.location + range.length)) { + out.toLine = linesEndIndex.size(); + return out; + } - out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1; - out.toColumn = (range.location + range.length) - *annotationPositionIt + 1; + // end of byte mapping workarround - if (*(annotationPositionIt + 1) == (range.location + range.length)) { - out.toColumn--; - } + if (annotationPositionIt != linesEndIndex.end()) { + out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt); + out.toColumn = (range.location + range.length) - *(std::prev(annotationPositionIt)) - 1; } + + return out; } - void GetLinesEndIndex(const std::string& source, std::vector& out) + const NewLinesIndex GetLinesEndIndex(const std::string& source) { + NewLinesIndex out; + out.push_back(0); - for (size_t i = 0; i < source.length(); i++) { + utils::utf8::input_iterator it(source); + utils::utf8::input_iterator e{ source.end(), source.end() }; - if (source[i] == '\n') { - out.push_back(i + 1); - } + int i = 1; + for (; it != e; ++it, ++i) { + if (*it == '\n') + out.push_back(i); } + + return out; } } // namespace drafter diff --git a/src/SourceMapUtils.h b/src/SourceMapUtils.h index 539908e0e..85ac810ba 100644 --- a/src/SourceMapUtils.h +++ b/src/SourceMapUtils.h @@ -14,30 +14,30 @@ namespace drafter { - typedef std::vector NewLinesIndex; + using NewLinesIndex = std::vector; /** structure contains starting and ending position of a error/warning. */ struct AnnotationPosition { - size_t fromLine; - size_t fromColumn; - size_t toLine; - size_t toColumn; + size_t fromLine = 0; + size_t fromColumn = 0; + size_t toLine = 0; + size_t toColumn = 0; }; /** * \brief Convert character index mapping to line and column number + * \return out Position of the given range as output * \param linesEndIndex Vector containing indexes of end line characters * \param range Character index mapping as input - * \param out Position of the given range as output */ - void GetLineFromMap(const std::vector& linesEndIndex, const mdp::Range& range, AnnotationPosition& out); + const AnnotationPosition GetLineFromMap(const NewLinesIndex& linesEndIndex, const mdp::Range& range); /** * \brief Given the source returns the length of all the lines in source as a vector * \param source Source data * \param out Vector containing indexes of all end line character in source */ - void GetLinesEndIndex(const std::string& source, NewLinesIndex& out); + const NewLinesIndex GetLinesEndIndex(const std::string& source); } // namespace drafter diff --git a/src/reporting.cc b/src/reporting.cc index bb8f955b6..619fee3f5 100644 --- a/src/reporting.cc +++ b/src/reporting.cc @@ -55,10 +55,10 @@ namespace std::cerr << " " << annotation.message; } - std::vector linesEndIndex; + NewLinesIndex linesEndIndex; if (useLineNumbers) { - GetLinesEndIndex(source, linesEndIndex); + linesEndIndex = GetLinesEndIndex(source); } if (!annotation.location.empty()) { @@ -69,8 +69,7 @@ namespace if (useLineNumbers) { - AnnotationPosition annotationPosition; - ::GetLineFromMap(linesEndIndex, *it, annotationPosition); + auto annotationPosition = GetLineFromMap(linesEndIndex, *it); std::cerr << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn; @@ -94,7 +93,7 @@ namespace AnnotationToString(const std::string& source, const bool useLineNumbers) : useLineNumbers(useLineNumbers) { if (useLineNumbers) { - GetLinesEndIndex(source, linesEndIndex); + linesEndIndex = GetLinesEndIndex(source); } } @@ -110,9 +109,8 @@ namespace if (useLineNumbers) { - AnnotationPosition annotationPosition; mdp::Range pos(static_cast(loc->get()), static_cast(len->get())); - ::GetLineFromMap(linesEndIndex, pos, annotationPosition); + const auto annotationPosition = GetLineFromMap(linesEndIndex, pos); output << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn; diff --git a/test/test-sourceMapToLineColumn.cc b/test/test-sourceMapToLineColumn.cc index 599a7f84f..3dd186f92 100644 --- a/test/test-sourceMapToLineColumn.cc +++ b/test/test-sourceMapToLineColumn.cc @@ -2,6 +2,9 @@ #include "../src/SourceMapUtils.h" +#include +#include + using namespace drafter; /* @@ -10,12 +13,12 @@ using namespace drafter; '_' - other character 01234567 - + ____^ 0, 5 ____^ 5, 5 ^ 10, 1 ___^ 11, 4 -__^ 15, 3 +__^ 15, 3 _______^ 18, 8 */ @@ -33,10 +36,9 @@ TEST_CASE("AnnotationPosition is initialized to zero", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position [0,3]", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {0,3}; + mdp::Range r = { 0, 3 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); REQUIRE(a.fromColumn == 0); @@ -46,10 +48,9 @@ TEST_CASE("GetLineFromMap for position [0,3]", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - 1st line w/o NL", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {0,4}; + mdp::Range r = { 0, 4 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); REQUIRE(a.fromColumn == 0); @@ -59,10 +60,9 @@ TEST_CASE("GetLineFromMap for position - 1st line w/o NL", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - 1st line w/ NL", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {0,5}; + mdp::Range r = { 0, 5 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); REQUIRE(a.fromColumn == 0); @@ -72,10 +72,9 @@ TEST_CASE("GetLineFromMap for position - 1st line w/ NL", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - 2nd line w/ NL", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {5,5}; + mdp::Range r = { 5, 5 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 2); REQUIRE(a.fromColumn == 0); @@ -85,10 +84,9 @@ TEST_CASE("GetLineFromMap for position - 2nd line w/ NL", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - last line w/ NL", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {18,8}; + mdp::Range r = { 18, 8 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 6); REQUIRE(a.fromColumn == 0); @@ -98,10 +96,9 @@ TEST_CASE("GetLineFromMap for position - last line w/ NL", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - 3rd empty line - just NL", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {10,1}; + mdp::Range r = { 10, 1 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 3); REQUIRE(a.fromColumn == 0); @@ -111,10 +108,9 @@ TEST_CASE("GetLineFromMap for position - 3rd empty line - just NL", "[sourcemap TEST_CASE("GetLineFromMap for position - 1st two lines", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {0,10}; + mdp::Range r = { 0, 10 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); REQUIRE(a.fromColumn == 0); @@ -124,10 +120,9 @@ TEST_CASE("GetLineFromMap for position - 1st two lines", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - lines 1-3", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {5,10}; + mdp::Range r = { 5, 10 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 2); REQUIRE(a.fromColumn == 0); @@ -137,13 +132,33 @@ TEST_CASE("GetLineFromMap for position - lines 1-3", "[sourcemap utils]") TEST_CASE("GetLineFromMap for position - all lines", "[sourcemap utils]") { - AnnotationPosition a; - mdp::Range r = {0,26}; + mdp::Range r = { 0, 26 }; - GetLineFromMap(nlIndex, r, a); + const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); REQUIRE(a.fromColumn == 0); REQUIRE(a.toLine == 6); REQUIRE(a.toColumn == 7); } + +TEST_CASE("GetLineFromMap for position - range is overflowing last char index", "[sourcemap utils workaround]") +{ + mdp::Range r = { 22, 10 }; + + const auto a = GetLineFromMap(nlIndex, r); + + REQUIRE(a.fromLine == 6); + REQUIRE(a.fromColumn == 4); + REQUIRE(a.toLine == 7); + REQUIRE(a.toColumn == 0); +} + +TEST_CASE("GetLinesEndIndex - check indexing utf8 chars", "[sourcemap utils]") +{ + const static std::string input = "$\n¢\n€\n𐍈\n"; // 0, 2, 4, 6, 8 + const NewLinesIndex expected = { 0, 2, 4, 6, 8 }; + + const auto out = GetLinesEndIndex(input); + REQUIRE(std::equal(expected.begin(), expected.end(), out.begin())); +} From be04cd799eccb2d77e43754308093d93b6308ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Mon, 5 Nov 2018 13:18:49 +0100 Subject: [PATCH 09/16] Update fixtures --- test/fixtures/api/issue-386.sourcemap.json | 4 +-- test/fixtures/api/request-only.json | 4 +-- test/fixtures/api/request-only.sourcemap.json | 4 +-- test/fixtures/circular/mixed.json | 4 +-- test/fixtures/circular/mixin-cross.json | 4 +-- test/fixtures/circular/mixin-embed.json | 4 +-- test/fixtures/circular/mixin-identity.json | 4 +-- test/fixtures/circular/mixin-member.json | 4 +-- .../check-bool-number-value-validity.json | 22 ++++++------ .../mson/check-default-without-value.json | 4 +-- .../mson/check-sample-without-value.json | 4 +-- test/fixtures/mson/enum-empty-default.json | 4 +-- test/fixtures/mson/enum-multiple-default.json | 32 ++++++++--------- test/fixtures/mson/enum-variants.json | 24 ++++++------- test/fixtures/mson/mixin-nonexistent.json | 8 ++--- test/fixtures/mson/number-wrong-value.json | 6 ++-- .../fixtures/mson/primitive-with-members.json | 36 +++++++++---------- test/fixtures/mson/regression-269.json | 4 +-- .../mson/resource-primitive-mixin.json | 8 ++--- .../mson/resource-unresolved-reference.json | 8 ++--- .../mson/type-attributes-payload.json | 4 +-- .../type-attributes-payload.sourcemap.json | 4 +-- test/fixtures/mson/type-attributes.json | 16 ++++----- .../mson/type-attributes.sourcemap.json | 16 ++++----- test/fixtures/parse-result/blueprint.json | 4 +-- .../parse-result/blueprint.sourcemap.json | 4 +-- test/fixtures/parse-result/error-warning.json | 8 ++--- .../parse-result/error-warning.sourcemap.json | 8 ++--- test/fixtures/parse-result/warning.json | 4 +-- .../parse-result/warning.sourcemap.json | 4 +-- test/fixtures/parse-result/warnings.json | 8 ++--- .../parse-result/warnings.sourcemap.json | 8 ++--- .../render/enum-default-multiple.json | 12 +++---- test/fixtures/render/issue-246.json | 20 +++++------ test/fixtures/render/issue-318.json | 12 +++---- test/fixtures/render/issue-328-1.json | 4 +-- test/fixtures/render/issue-328-2.json | 8 ++--- test/fixtures/render/issue-547.json | 4 +-- test/fixtures/render/numbers.json | 32 ++++++++--------- test/fixtures/syntax/issue-350.json | 12 +++---- 40 files changed, 192 insertions(+), 192 deletions(-) diff --git a/test/fixtures/api/issue-386.sourcemap.json b/test/fixtures/api/issue-386.sourcemap.json index 6b929af9a..d6148be58 100644 --- a/test/fixtures/api/issue-386.sourcemap.json +++ b/test/fixtures/api/issue-386.sourcemap.json @@ -851,7 +851,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 153 @@ -865,7 +865,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 4 diff --git a/test/fixtures/api/request-only.json b/test/fixtures/api/request-only.json index 9cc2fe25c..5482195ab 100644 --- a/test/fixtures/api/request-only.json +++ b/test/fixtures/api/request-only.json @@ -140,7 +140,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -154,7 +154,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 26 diff --git a/test/fixtures/api/request-only.sourcemap.json b/test/fixtures/api/request-only.sourcemap.json index 1867427c6..dd8283f1a 100644 --- a/test/fixtures/api/request-only.sourcemap.json +++ b/test/fixtures/api/request-only.sourcemap.json @@ -338,7 +338,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -352,7 +352,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 26 diff --git a/test/fixtures/circular/mixed.json b/test/fixtures/circular/mixed.json index 0c24eefae..c1ccfe9ab 100644 --- a/test/fixtures/circular/mixed.json +++ b/test/fixtures/circular/mixed.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 109 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-cross.json b/test/fixtures/circular/mixin-cross.json index 17f2d058c..fe619f7fb 100644 --- a/test/fixtures/circular/mixin-cross.json +++ b/test/fixtures/circular/mixin-cross.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 122 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-embed.json b/test/fixtures/circular/mixin-embed.json index 534ba384c..2cf9bb3ac 100644 --- a/test/fixtures/circular/mixin-embed.json +++ b/test/fixtures/circular/mixin-embed.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 89 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 12 diff --git a/test/fixtures/circular/mixin-identity.json b/test/fixtures/circular/mixin-identity.json index bf9898eaf..481dea2a6 100644 --- a/test/fixtures/circular/mixin-identity.json +++ b/test/fixtures/circular/mixin-identity.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 98 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-member.json b/test/fixtures/circular/mixin-member.json index c0d8e54a1..be3c110ca 100644 --- a/test/fixtures/circular/mixin-member.json +++ b/test/fixtures/circular/mixin-member.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 7 + "content": 6 } }, "content": 102 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 16 + "content": 15 } }, "content": 10 diff --git a/test/fixtures/mson/check-bool-number-value-validity.json b/test/fixtures/mson/check-bool-number-value-validity.json index 43a77fd69..7766e1c1b 100644 --- a/test/fixtures/mson/check-bool-number-value-validity.json +++ b/test/fixtures/mson/check-bool-number-value-validity.json @@ -303,7 +303,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 65 @@ -317,7 +317,7 @@ }, "column": { "element": "number", - "content": 16 + "content": 15 } }, "content": 14 @@ -367,7 +367,7 @@ }, "column": { "element": "number", - "content": 7 + "content": 6 } }, "content": 98 @@ -381,7 +381,7 @@ }, "column": { "element": "number", - "content": 32 + "content": 31 } }, "content": 26 @@ -431,7 +431,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 126 @@ -445,7 +445,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 12 @@ -495,7 +495,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 140 @@ -505,11 +505,11 @@ "attributes": { "line": { "element": "number", - "content": 12 + "content": 13 }, "column": { "element": "number", - "content": 13 + "content": 0 } }, "content": 11 @@ -569,11 +569,11 @@ "attributes": { "line": { "element": "number", - "content": 20 + "content": 21 }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 diff --git a/test/fixtures/mson/check-default-without-value.json b/test/fixtures/mson/check-default-without-value.json index b4e0d51af..e86286996 100644 --- a/test/fixtures/mson/check-default-without-value.json +++ b/test/fixtures/mson/check-default-without-value.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 66 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 25 + "content": 24 } }, "content": 15 diff --git a/test/fixtures/mson/check-sample-without-value.json b/test/fixtures/mson/check-sample-without-value.json index 19ac3ce2b..29d2fd9f1 100644 --- a/test/fixtures/mson/check-sample-without-value.json +++ b/test/fixtures/mson/check-sample-without-value.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 66 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 23 } }, "content": 14 diff --git a/test/fixtures/mson/enum-empty-default.json b/test/fixtures/mson/enum-empty-default.json index 37263aa9c..aa3d86a90 100644 --- a/test/fixtures/mson/enum-empty-default.json +++ b/test/fixtures/mson/enum-empty-default.json @@ -341,7 +341,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 115 @@ -355,7 +355,7 @@ }, "column": { "element": "number", - "content": 15 + "content": 14 } }, "content": 13 diff --git a/test/fixtures/mson/enum-multiple-default.json b/test/fixtures/mson/enum-multiple-default.json index 1f45c66a0..3f7770ff5 100644 --- a/test/fixtures/mson/enum-multiple-default.json +++ b/test/fixtures/mson/enum-multiple-default.json @@ -303,7 +303,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 69 @@ -317,7 +317,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 10 @@ -336,7 +336,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 83 @@ -350,7 +350,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 @@ -369,7 +369,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 95 @@ -383,7 +383,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 @@ -433,7 +433,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 122 @@ -447,7 +447,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 10 @@ -466,7 +466,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 136 @@ -480,7 +480,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 @@ -499,7 +499,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 149 @@ -513,7 +513,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 10 @@ -532,7 +532,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 163 @@ -546,7 +546,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 @@ -596,7 +596,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 175 @@ -610,7 +610,7 @@ }, "column": { "element": "number", - "content": 29 + "content": 28 } }, "content": 27 diff --git a/test/fixtures/mson/enum-variants.json b/test/fixtures/mson/enum-variants.json index 53af2bd8c..6952edd5a 100644 --- a/test/fixtures/mson/enum-variants.json +++ b/test/fixtures/mson/enum-variants.json @@ -1670,7 +1670,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 145 @@ -1684,7 +1684,7 @@ }, "column": { "element": "number", - "content": 74 + "content": 73 } }, "content": 72 @@ -1734,7 +1734,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 1133 @@ -1748,7 +1748,7 @@ }, "column": { "element": "number", - "content": 38 + "content": 37 } }, "content": 36 @@ -1798,7 +1798,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 1188 @@ -1812,7 +1812,7 @@ }, "column": { "element": "number", - "content": 40 + "content": 39 } }, "content": 38 @@ -1862,7 +1862,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 1440 @@ -1876,7 +1876,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 10 @@ -1895,7 +1895,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 1454 @@ -1909,7 +1909,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 @@ -1928,7 +1928,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 1466 @@ -1942,7 +1942,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 11 } }, "content": 8 diff --git a/test/fixtures/mson/mixin-nonexistent.json b/test/fixtures/mson/mixin-nonexistent.json index ac25374ec..51e6189ca 100644 --- a/test/fixtures/mson/mixin-nonexistent.json +++ b/test/fixtures/mson/mixin-nonexistent.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 282 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 12 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 282 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 13 } }, "content": 12 diff --git a/test/fixtures/mson/number-wrong-value.json b/test/fixtures/mson/number-wrong-value.json index ba7d6ce7a..5478366b8 100644 --- a/test/fixtures/mson/number-wrong-value.json +++ b/test/fixtures/mson/number-wrong-value.json @@ -108,7 +108,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 334 @@ -118,11 +118,11 @@ "attributes": { "line": { "element": "number", - "content": 15 + "content": 16 }, "column": { "element": "number", - "content": 32 + "content": 0 } }, "content": 30 diff --git a/test/fixtures/mson/primitive-with-members.json b/test/fixtures/mson/primitive-with-members.json index 95ea7e438..c7521e438 100644 --- a/test/fixtures/mson/primitive-with-members.json +++ b/test/fixtures/mson/primitive-with-members.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 74 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -215,7 +215,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 74 @@ -229,7 +229,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -279,7 +279,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 105 @@ -293,7 +293,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -343,7 +343,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 105 @@ -357,7 +357,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -407,7 +407,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 134 @@ -421,7 +421,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -471,7 +471,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 134 @@ -485,7 +485,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 @@ -535,7 +535,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 165 @@ -549,7 +549,7 @@ }, "column": { "element": "number", - "content": 15 + "content": 14 } }, "content": 15 @@ -599,7 +599,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 165 @@ -613,7 +613,7 @@ }, "column": { "element": "number", - "content": 15 + "content": 14 } }, "content": 15 @@ -663,7 +663,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 180 @@ -677,7 +677,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 6 diff --git a/test/fixtures/mson/regression-269.json b/test/fixtures/mson/regression-269.json index 86880cc77..37f945253 100644 --- a/test/fixtures/mson/regression-269.json +++ b/test/fixtures/mson/regression-269.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 19 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 9 } }, "content": 10 diff --git a/test/fixtures/mson/resource-primitive-mixin.json b/test/fixtures/mson/resource-primitive-mixin.json index 08ccf1eca..440ade8c3 100644 --- a/test/fixtures/mson/resource-primitive-mixin.json +++ b/test/fixtures/mson/resource-primitive-mixin.json @@ -106,7 +106,7 @@ }, "column": { "element": "number", - "content": 7 + "content": 6 } }, "content": 45 @@ -120,7 +120,7 @@ }, "column": { "element": "number", - "content": 21 + "content": 20 } }, "content": 15 @@ -170,7 +170,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 43 @@ -184,7 +184,7 @@ }, "column": { "element": "number", - "content": 21 + "content": 20 } }, "content": 17 diff --git a/test/fixtures/mson/resource-unresolved-reference.json b/test/fixtures/mson/resource-unresolved-reference.json index 9a79dd035..f8774867a 100644 --- a/test/fixtures/mson/resource-unresolved-reference.json +++ b/test/fixtures/mson/resource-unresolved-reference.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 99 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 22 + "content": 21 } }, "content": 20 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 76 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 21 diff --git a/test/fixtures/mson/type-attributes-payload.json b/test/fixtures/mson/type-attributes-payload.json index db6e0327b..94392761f 100644 --- a/test/fixtures/mson/type-attributes-payload.json +++ b/test/fixtures/mson/type-attributes-payload.json @@ -226,7 +226,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 85 @@ -240,7 +240,7 @@ }, "column": { "element": "number", - "content": 33 + "content": 32 } }, "content": 23 diff --git a/test/fixtures/mson/type-attributes-payload.sourcemap.json b/test/fixtures/mson/type-attributes-payload.sourcemap.json index b71ccbdd5..906c23f8a 100644 --- a/test/fixtures/mson/type-attributes-payload.sourcemap.json +++ b/test/fixtures/mson/type-attributes-payload.sourcemap.json @@ -449,7 +449,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 85 @@ -463,7 +463,7 @@ }, "column": { "element": "number", - "content": 33 + "content": 32 } }, "content": 23 diff --git a/test/fixtures/mson/type-attributes.json b/test/fixtures/mson/type-attributes.json index 036014f4d..2f7c7d6d3 100644 --- a/test/fixtures/mson/type-attributes.json +++ b/test/fixtures/mson/type-attributes.json @@ -128,7 +128,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -142,7 +142,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -192,7 +192,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -206,7 +206,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -256,7 +256,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -270,7 +270,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -320,7 +320,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -334,7 +334,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 diff --git a/test/fixtures/mson/type-attributes.sourcemap.json b/test/fixtures/mson/type-attributes.sourcemap.json index fa6a4c7fe..16471bec3 100644 --- a/test/fixtures/mson/type-attributes.sourcemap.json +++ b/test/fixtures/mson/type-attributes.sourcemap.json @@ -201,7 +201,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -215,7 +215,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -265,7 +265,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -279,7 +279,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -329,7 +329,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -343,7 +343,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 @@ -393,7 +393,7 @@ }, "column": { "element": "number", - "content": 3 + "content": 2 } }, "content": 24 @@ -407,7 +407,7 @@ }, "column": { "element": "number", - "content": 64 + "content": 63 } }, "content": 62 diff --git a/test/fixtures/parse-result/blueprint.json b/test/fixtures/parse-result/blueprint.json index 8ae4e9bc0..aa0871045 100644 --- a/test/fixtures/parse-result/blueprint.json +++ b/test/fixtures/parse-result/blueprint.json @@ -137,7 +137,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 87 @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 23 } }, "content": 24 diff --git a/test/fixtures/parse-result/blueprint.sourcemap.json b/test/fixtures/parse-result/blueprint.sourcemap.json index 5717ad5ba..a30fe3cff 100644 --- a/test/fixtures/parse-result/blueprint.sourcemap.json +++ b/test/fixtures/parse-result/blueprint.sourcemap.json @@ -337,7 +337,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 87 @@ -351,7 +351,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 23 } }, "content": 24 diff --git a/test/fixtures/parse-result/error-warning.json b/test/fixtures/parse-result/error-warning.json index 08db9975b..a705758b7 100644 --- a/test/fixtures/parse-result/error-warning.json +++ b/test/fixtures/parse-result/error-warning.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 55 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 9 + "content": 8 } }, "content": 9 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 8 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 diff --git a/test/fixtures/parse-result/error-warning.sourcemap.json b/test/fixtures/parse-result/error-warning.sourcemap.json index 08db9975b..a705758b7 100644 --- a/test/fixtures/parse-result/error-warning.sourcemap.json +++ b/test/fixtures/parse-result/error-warning.sourcemap.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 55 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 9 + "content": 8 } }, "content": 9 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 8 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 diff --git a/test/fixtures/parse-result/warning.json b/test/fixtures/parse-result/warning.json index 2c625b551..ba169e2da 100644 --- a/test/fixtures/parse-result/warning.json +++ b/test/fixtures/parse-result/warning.json @@ -130,7 +130,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 24 @@ -144,7 +144,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 diff --git a/test/fixtures/parse-result/warning.sourcemap.json b/test/fixtures/parse-result/warning.sourcemap.json index 4831b1239..1330be8fd 100644 --- a/test/fixtures/parse-result/warning.sourcemap.json +++ b/test/fixtures/parse-result/warning.sourcemap.json @@ -253,7 +253,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 24 @@ -267,7 +267,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 diff --git a/test/fixtures/parse-result/warnings.json b/test/fixtures/parse-result/warnings.json index 0035c7371..f9f5b3b85 100644 --- a/test/fixtures/parse-result/warnings.json +++ b/test/fixtures/parse-result/warnings.json @@ -146,7 +146,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 24 @@ -160,7 +160,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 @@ -210,7 +210,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 37 @@ -224,7 +224,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 27 diff --git a/test/fixtures/parse-result/warnings.sourcemap.json b/test/fixtures/parse-result/warnings.sourcemap.json index 7b45e29df..d36b7faf3 100644 --- a/test/fixtures/parse-result/warnings.sourcemap.json +++ b/test/fixtures/parse-result/warnings.sourcemap.json @@ -294,7 +294,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 24 @@ -308,7 +308,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 13 @@ -358,7 +358,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 37 @@ -372,7 +372,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 27 diff --git a/test/fixtures/render/enum-default-multiple.json b/test/fixtures/render/enum-default-multiple.json index 7f6263eaf..75936cea7 100644 --- a/test/fixtures/render/enum-default-multiple.json +++ b/test/fixtures/render/enum-default-multiple.json @@ -281,7 +281,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 115 @@ -295,7 +295,7 @@ }, "column": { "element": "number", - "content": 25 + "content": 24 } }, "content": 13 @@ -314,7 +314,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 140 @@ -328,7 +328,7 @@ }, "column": { "element": "number", - "content": 25 + "content": 24 } }, "content": 13 @@ -347,7 +347,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 12 } }, "content": 165 @@ -361,7 +361,7 @@ }, "column": { "element": "number", - "content": 25 + "content": 24 } }, "content": 13 diff --git a/test/fixtures/render/issue-246.json b/test/fixtures/render/issue-246.json index 7b2c0fe6f..538689e2a 100644 --- a/test/fixtures/render/issue-246.json +++ b/test/fixtures/render/issue-246.json @@ -290,7 +290,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 128 @@ -304,7 +304,7 @@ }, "column": { "element": "number", - "content": 23 + "content": 22 } }, "content": 19 @@ -354,7 +354,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 161 @@ -368,7 +368,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 31 @@ -418,7 +418,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 192 @@ -432,7 +432,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 21 @@ -482,7 +482,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 213 @@ -496,7 +496,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 13 @@ -546,7 +546,7 @@ }, "column": { "element": "number", - "content": 5 + "content": 4 } }, "content": 240 @@ -560,7 +560,7 @@ }, "column": { "element": "number", - "content": 23 + "content": 22 } }, "content": 19 diff --git a/test/fixtures/render/issue-318.json b/test/fixtures/render/issue-318.json index 3ac7090e0..4e0397574 100644 --- a/test/fixtures/render/issue-318.json +++ b/test/fixtures/render/issue-318.json @@ -290,7 +290,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 118 @@ -304,7 +304,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 28 @@ -354,7 +354,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 146 @@ -368,7 +368,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 36 @@ -418,7 +418,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 182 @@ -432,7 +432,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 20 diff --git a/test/fixtures/render/issue-328-1.json b/test/fixtures/render/issue-328-1.json index 75526dfe9..037c44ff8 100644 --- a/test/fixtures/render/issue-328-1.json +++ b/test/fixtures/render/issue-328-1.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 30 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 18 diff --git a/test/fixtures/render/issue-328-2.json b/test/fixtures/render/issue-328-2.json index 26b3f5f9a..15b9ebb3d 100644 --- a/test/fixtures/render/issue-328-2.json +++ b/test/fixtures/render/issue-328-2.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 35 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 18 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 73 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 15 diff --git a/test/fixtures/render/issue-547.json b/test/fixtures/render/issue-547.json index 6fbe4cac2..a97016f2b 100644 --- a/test/fixtures/render/issue-547.json +++ b/test/fixtures/render/issue-547.json @@ -177,7 +177,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 71 @@ -191,7 +191,7 @@ }, "column": { "element": "number", - "content": 18 + "content": 17 } }, "content": 8 diff --git a/test/fixtures/render/numbers.json b/test/fixtures/render/numbers.json index bbd6011d1..f16f82b4e 100644 --- a/test/fixtures/render/numbers.json +++ b/test/fixtures/render/numbers.json @@ -455,7 +455,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 791 @@ -469,7 +469,7 @@ }, "column": { "element": "number", - "content": 47 + "content": 46 } }, "content": 37 @@ -519,7 +519,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 838 @@ -533,7 +533,7 @@ }, "column": { "element": "number", - "content": 71 + "content": 70 } }, "content": 61 @@ -583,7 +583,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 909 @@ -597,7 +597,7 @@ }, "column": { "element": "number", - "content": 51 + "content": 50 } }, "content": 41 @@ -647,7 +647,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 960 @@ -661,7 +661,7 @@ }, "column": { "element": "number", - "content": 53 + "content": 52 } }, "content": 43 @@ -711,7 +711,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 1013 @@ -725,7 +725,7 @@ }, "column": { "element": "number", - "content": 54 + "content": 53 } }, "content": 44 @@ -775,7 +775,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 1067 @@ -789,7 +789,7 @@ }, "column": { "element": "number", - "content": 48 + "content": 47 } }, "content": 38 @@ -839,7 +839,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 1115 @@ -853,7 +853,7 @@ }, "column": { "element": "number", - "content": 55 + "content": 54 } }, "content": 45 @@ -903,7 +903,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 10 } }, "content": 1170 @@ -917,7 +917,7 @@ }, "column": { "element": "number", - "content": 38 + "content": 37 } }, "content": 28 diff --git a/test/fixtures/syntax/issue-350.json b/test/fixtures/syntax/issue-350.json index e60fd9d4c..a6ea454c3 100644 --- a/test/fixtures/syntax/issue-350.json +++ b/test/fixtures/syntax/issue-350.json @@ -133,7 +133,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 32 @@ -147,7 +147,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 34 @@ -197,7 +197,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 66 @@ -211,7 +211,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 44 @@ -261,7 +261,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 110 @@ -275,7 +275,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 16 From 8998ab80e19c74d79c19440caea0d6aa25143002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Mon, 5 Nov 2018 13:20:19 +0100 Subject: [PATCH 10/16] chore: update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c92371465..092b46300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Drafter Changelog +## master + +* Add column/line info to anotations source maps +* change start column index from 1 to 0 in reporting. (while `-l` switch is used) + ## 4.0.0-pre.1 ### Breaking From 8aaa8c48cd7c37dc2579d4a4356cb265c988f864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Mon, 5 Nov 2018 13:49:53 +0100 Subject: [PATCH 11/16] chore: update integration tests according to impl --- features/fixtures/refract.json | 12 ++++++------ features/fixtures/refract.sourcemap.json | 12 ++++++------ features/fixtures/refract.sourcemap.yaml | 12 ++++++------ features/fixtures/refract.yaml | 12 ++++++------ features/validate.feature | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/features/fixtures/refract.json b/features/fixtures/refract.json index b80b4fdcb..9bc4a0169 100644 --- a/features/fixtures/refract.json +++ b/features/fixtures/refract.json @@ -1047,7 +1047,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 685 @@ -1061,7 +1061,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -1111,7 +1111,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 992 @@ -1125,7 +1125,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -1175,7 +1175,7 @@ }, "column": { "element": "number", - "content": 7 + "content": 6 } }, "content": 200 @@ -1189,7 +1189,7 @@ }, "column": { "element": "number", - "content": 108 + "content": 107 } }, "content": 102 diff --git a/features/fixtures/refract.sourcemap.json b/features/fixtures/refract.sourcemap.json index 4a61817c7..932c70497 100644 --- a/features/fixtures/refract.sourcemap.json +++ b/features/fixtures/refract.sourcemap.json @@ -3219,7 +3219,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 685 @@ -3233,7 +3233,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -3283,7 +3283,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 992 @@ -3297,7 +3297,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 0 } }, "content": 45 @@ -3347,7 +3347,7 @@ }, "column": { "element": "number", - "content": 7 + "content": 6 } }, "content": 200 @@ -3361,7 +3361,7 @@ }, "column": { "element": "number", - "content": 108 + "content": 107 } }, "content": 102 diff --git a/features/fixtures/refract.sourcemap.yaml b/features/fixtures/refract.sourcemap.yaml index a19f67665..8903ae503 100644 --- a/features/fixtures/refract.sourcemap.yaml +++ b/features/fixtures/refract.sourcemap.yaml @@ -2101,7 +2101,7 @@ content: content: 39 column: element: "number" - content: 1 + content: 0 content: 685 - element: "number" @@ -2111,7 +2111,7 @@ content: content: 42 column: element: "number" - content: 1 + content: 0 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2144,7 +2144,7 @@ content: content: 55 column: element: "number" - content: 1 + content: 0 content: 992 - element: "number" @@ -2154,7 +2154,7 @@ content: content: 58 column: element: "number" - content: 1 + content: 0 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2187,7 +2187,7 @@ content: content: 14 column: element: "number" - content: 7 + content: 6 content: 200 - element: "number" @@ -2197,6 +2197,6 @@ content: content: 14 column: element: "number" - content: 108 + content: 107 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" diff --git a/features/fixtures/refract.yaml b/features/fixtures/refract.yaml index b68cd1df6..37d9951bc 100644 --- a/features/fixtures/refract.yaml +++ b/features/fixtures/refract.yaml @@ -707,7 +707,7 @@ content: content: 39 column: element: "number" - content: 1 + content: 0 content: 685 - element: "number" @@ -717,7 +717,7 @@ content: content: 42 column: element: "number" - content: 1 + content: 0 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -750,7 +750,7 @@ content: content: 55 column: element: "number" - content: 1 + content: 0 content: 992 - element: "number" @@ -760,7 +760,7 @@ content: content: 58 column: element: "number" - content: 1 + content: 0 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -793,7 +793,7 @@ content: content: 14 column: element: "number" - content: 7 + content: 6 content: 200 - element: "number" @@ -803,6 +803,6 @@ content: content: 14 column: element: "number" - content: 108 + content: 107 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" diff --git a/features/validate.feature b/features/validate.feature index 9937b9559..98266922f 100644 --- a/features/validate.feature +++ b/features/validate.feature @@ -42,5 +42,5 @@ Feature: Validate a blueprint Then the output should contain: """ OK. - warning: (5) unexpected header block, expected a group, resource or an action definition, e.g. '# Group ', '# []' or '# '; line 4, column 1 - line 4, column 29 + warning: (5) unexpected header block, expected a group, resource or an action definition, e.g. '# Group ', '# []' or '# '; line 4, column 0 - line 4, column 28 """ From 42e55bd0cef2d626ff3e843c9ac749c638bf57d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 13 Nov 2018 13:53:48 +0100 Subject: [PATCH 12/16] chore: update cmake according to master --- src/CMakeLists.txt | 1 + test/CMakeLists.txt | 1 + test/test-sourceMapToLineColumn.cc | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3bc2283de..3de21989e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,7 @@ set(DRAFTER_SOURCES Render.cc ConversionContext.cc RefractElementFactory.cc + SourceMapUtils.cc ) set(DRAFTER_COMPILE_FEATURES diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 19a28eec3..d94ac75e2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,6 +44,7 @@ add_executable(drafter-test test-CircularReferenceTest.cc test-RenderTest.cc test-Serialize.cc + test-sourceMapToLineColumn.cc ) target_link_libraries(drafter-test diff --git a/test/test-sourceMapToLineColumn.cc b/test/test-sourceMapToLineColumn.cc index 3dd186f92..bc487225b 100644 --- a/test/test-sourceMapToLineColumn.cc +++ b/test/test-sourceMapToLineColumn.cc @@ -1,8 +1,7 @@ -#include "catch.hpp" +#include #include "../src/SourceMapUtils.h" -#include #include using namespace drafter; From cf98113fec22eb3df606072539699c41c0f11c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 13 Nov 2018 16:15:06 +0100 Subject: [PATCH 13/16] update: rewrite indexing of column from 1 --- src/SourceMapUtils.cc | 5 +-- test/test-sourceMapToLineColumn.cc | 52 +++++++++++++++--------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/SourceMapUtils.cc b/src/SourceMapUtils.cc index 623f6d17a..780ca9cf0 100644 --- a/src/SourceMapUtils.cc +++ b/src/SourceMapUtils.cc @@ -20,7 +20,7 @@ namespace drafter if (annotationPositionIt != linesEndIndex.end()) { out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt); - out.fromColumn = range.location - *std::prev(annotationPositionIt); + out.fromColumn = range.location - *std::prev(annotationPositionIt) + 1; } // Finds ending line and column position @@ -35,6 +35,7 @@ namespace drafter if (linesEndIndex.back() < (range.location + range.length)) { out.toLine = linesEndIndex.size(); + out.toColumn = 1; return out; } @@ -42,7 +43,7 @@ namespace drafter if (annotationPositionIt != linesEndIndex.end()) { out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt); - out.toColumn = (range.location + range.length) - *(std::prev(annotationPositionIt)) - 1; + out.toColumn = (range.location + range.length) - *(std::prev(annotationPositionIt)); } return out; diff --git a/test/test-sourceMapToLineColumn.cc b/test/test-sourceMapToLineColumn.cc index bc487225b..24108b73e 100644 --- a/test/test-sourceMapToLineColumn.cc +++ b/test/test-sourceMapToLineColumn.cc @@ -13,12 +13,12 @@ using namespace drafter; 01234567 -____^ 0, 5 -____^ 5, 5 -^ 10, 1 -___^ 11, 4 -__^ 15, 3 -_______^ 18, 8 +____^ 1, 5 +____^ 6, 5 +^ 11, 1 +___^ 12, 4 +__^ 16, 3 +_______^ 19, 8 */ static const NewLinesIndex nlIndex = { 0, 5, 10, 11, 15, 18, 26 }; @@ -40,9 +40,9 @@ TEST_CASE("GetLineFromMap for position [0,3]", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 1); - REQUIRE(a.toColumn == 2); + REQUIRE(a.toColumn == 3); } TEST_CASE("GetLineFromMap for position - 1st line w/o NL", "[sourcemap utils]") @@ -52,9 +52,9 @@ TEST_CASE("GetLineFromMap for position - 1st line w/o NL", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 1); - REQUIRE(a.toColumn == 3); + REQUIRE(a.toColumn == 4); } TEST_CASE("GetLineFromMap for position - 1st line w/ NL", "[sourcemap utils]") @@ -64,9 +64,9 @@ TEST_CASE("GetLineFromMap for position - 1st line w/ NL", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 1); - REQUIRE(a.toColumn == 4); + REQUIRE(a.toColumn == 5); } TEST_CASE("GetLineFromMap for position - 2nd line w/ NL", "[sourcemap utils]") @@ -76,9 +76,9 @@ TEST_CASE("GetLineFromMap for position - 2nd line w/ NL", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 2); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 2); - REQUIRE(a.toColumn == 4); + REQUIRE(a.toColumn == 5); } TEST_CASE("GetLineFromMap for position - last line w/ NL", "[sourcemap utils]") @@ -88,9 +88,9 @@ TEST_CASE("GetLineFromMap for position - last line w/ NL", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 6); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 6); - REQUIRE(a.toColumn == 7); + REQUIRE(a.toColumn == 8); } TEST_CASE("GetLineFromMap for position - 3rd empty line - just NL", "[sourcemap utils]") @@ -100,9 +100,9 @@ TEST_CASE("GetLineFromMap for position - 3rd empty line - just NL", "[sourcemap const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 3); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 3); - REQUIRE(a.toColumn == 0); + REQUIRE(a.toColumn == 1); } TEST_CASE("GetLineFromMap for position - 1st two lines", "[sourcemap utils]") @@ -112,9 +112,9 @@ TEST_CASE("GetLineFromMap for position - 1st two lines", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 2); - REQUIRE(a.toColumn == 4); + REQUIRE(a.toColumn == 5); } TEST_CASE("GetLineFromMap for position - lines 1-3", "[sourcemap utils]") @@ -124,9 +124,9 @@ TEST_CASE("GetLineFromMap for position - lines 1-3", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 2); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 4); - REQUIRE(a.toColumn == 3); + REQUIRE(a.toColumn == 4); } TEST_CASE("GetLineFromMap for position - all lines", "[sourcemap utils]") @@ -136,9 +136,9 @@ TEST_CASE("GetLineFromMap for position - all lines", "[sourcemap utils]") const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 1); - REQUIRE(a.fromColumn == 0); + REQUIRE(a.fromColumn == 1); REQUIRE(a.toLine == 6); - REQUIRE(a.toColumn == 7); + REQUIRE(a.toColumn == 8); } TEST_CASE("GetLineFromMap for position - range is overflowing last char index", "[sourcemap utils workaround]") @@ -148,9 +148,9 @@ TEST_CASE("GetLineFromMap for position - range is overflowing last char index", const auto a = GetLineFromMap(nlIndex, r); REQUIRE(a.fromLine == 6); - REQUIRE(a.fromColumn == 4); + REQUIRE(a.fromColumn == 5); REQUIRE(a.toLine == 7); - REQUIRE(a.toColumn == 0); + REQUIRE(a.toColumn == 1); } TEST_CASE("GetLinesEndIndex - check indexing utf8 chars", "[sourcemap utils]") From 8edc53fa194a94e1dd55da3017a87c615b9f8843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 13 Nov 2018 16:16:04 +0100 Subject: [PATCH 14/16] chore: update fixtures --- test/fixtures/api/issue-386.sourcemap.json | 4 +-- test/fixtures/api/request-only.json | 4 +-- test/fixtures/api/request-only.sourcemap.json | 4 +-- test/fixtures/circular/mixed.json | 4 +-- test/fixtures/circular/mixin-cross.json | 4 +-- test/fixtures/circular/mixin-embed.json | 4 +-- test/fixtures/circular/mixin-identity.json | 4 +-- test/fixtures/circular/mixin-member.json | 4 +-- .../check-bool-number-value-validity.json | 20 +++++------ .../mson/check-default-without-value.json | 4 +-- .../mson/check-sample-without-value.json | 4 +-- test/fixtures/mson/enum-empty-default.json | 4 +-- test/fixtures/mson/enum-multiple-default.json | 32 ++++++++--------- test/fixtures/mson/enum-variants.json | 24 ++++++------- test/fixtures/mson/mixin-nonexistent.json | 8 ++--- test/fixtures/mson/number-wrong-value.json | 4 +-- .../fixtures/mson/primitive-with-members.json | 36 +++++++++---------- test/fixtures/mson/regression-269.json | 4 +-- .../mson/resource-primitive-mixin.json | 8 ++--- .../mson/resource-unresolved-reference.json | 8 ++--- .../mson/type-attributes-payload.json | 4 +-- .../type-attributes-payload.sourcemap.json | 4 +-- test/fixtures/mson/type-attributes.json | 16 ++++----- .../mson/type-attributes.sourcemap.json | 16 ++++----- test/fixtures/parse-result/blueprint.json | 4 +-- .../parse-result/blueprint.sourcemap.json | 4 +-- test/fixtures/parse-result/error-warning.json | 8 ++--- .../parse-result/error-warning.sourcemap.json | 8 ++--- test/fixtures/parse-result/warning.json | 4 +-- .../parse-result/warning.sourcemap.json | 4 +-- test/fixtures/parse-result/warnings.json | 8 ++--- .../parse-result/warnings.sourcemap.json | 8 ++--- .../render/enum-default-multiple.json | 12 +++---- test/fixtures/render/issue-246.json | 20 +++++------ test/fixtures/render/issue-318.json | 12 +++---- test/fixtures/render/issue-328-1.json | 4 +-- test/fixtures/render/issue-328-2.json | 8 ++--- test/fixtures/render/issue-547.json | 4 +-- test/fixtures/render/numbers.json | 32 ++++++++--------- test/fixtures/syntax/issue-350.json | 12 +++---- 40 files changed, 190 insertions(+), 190 deletions(-) diff --git a/test/fixtures/api/issue-386.sourcemap.json b/test/fixtures/api/issue-386.sourcemap.json index d6148be58..6b929af9a 100644 --- a/test/fixtures/api/issue-386.sourcemap.json +++ b/test/fixtures/api/issue-386.sourcemap.json @@ -851,7 +851,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 153 @@ -865,7 +865,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 4 diff --git a/test/fixtures/api/request-only.json b/test/fixtures/api/request-only.json index 5482195ab..9cc2fe25c 100644 --- a/test/fixtures/api/request-only.json +++ b/test/fixtures/api/request-only.json @@ -140,7 +140,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -154,7 +154,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 26 diff --git a/test/fixtures/api/request-only.sourcemap.json b/test/fixtures/api/request-only.sourcemap.json index dd8283f1a..1867427c6 100644 --- a/test/fixtures/api/request-only.sourcemap.json +++ b/test/fixtures/api/request-only.sourcemap.json @@ -338,7 +338,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -352,7 +352,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 26 diff --git a/test/fixtures/circular/mixed.json b/test/fixtures/circular/mixed.json index c1ccfe9ab..0c24eefae 100644 --- a/test/fixtures/circular/mixed.json +++ b/test/fixtures/circular/mixed.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 109 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-cross.json b/test/fixtures/circular/mixin-cross.json index fe619f7fb..17f2d058c 100644 --- a/test/fixtures/circular/mixin-cross.json +++ b/test/fixtures/circular/mixin-cross.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 122 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-embed.json b/test/fixtures/circular/mixin-embed.json index 2cf9bb3ac..534ba384c 100644 --- a/test/fixtures/circular/mixin-embed.json +++ b/test/fixtures/circular/mixin-embed.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 89 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 12 diff --git a/test/fixtures/circular/mixin-identity.json b/test/fixtures/circular/mixin-identity.json index 481dea2a6..bf9898eaf 100644 --- a/test/fixtures/circular/mixin-identity.json +++ b/test/fixtures/circular/mixin-identity.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 98 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 10 diff --git a/test/fixtures/circular/mixin-member.json b/test/fixtures/circular/mixin-member.json index be3c110ca..c0d8e54a1 100644 --- a/test/fixtures/circular/mixin-member.json +++ b/test/fixtures/circular/mixin-member.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 6 + "content": 7 } }, "content": 102 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 15 + "content": 16 } }, "content": 10 diff --git a/test/fixtures/mson/check-bool-number-value-validity.json b/test/fixtures/mson/check-bool-number-value-validity.json index 7766e1c1b..a4cb8b4a8 100644 --- a/test/fixtures/mson/check-bool-number-value-validity.json +++ b/test/fixtures/mson/check-bool-number-value-validity.json @@ -303,7 +303,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 65 @@ -317,7 +317,7 @@ }, "column": { "element": "number", - "content": 15 + "content": 16 } }, "content": 14 @@ -367,7 +367,7 @@ }, "column": { "element": "number", - "content": 6 + "content": 7 } }, "content": 98 @@ -381,7 +381,7 @@ }, "column": { "element": "number", - "content": 31 + "content": 32 } }, "content": 26 @@ -431,7 +431,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 126 @@ -445,7 +445,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 12 @@ -495,7 +495,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 140 @@ -509,7 +509,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 11 @@ -559,7 +559,7 @@ }, "column": { "element": "number", - "content": 1 + "content": 2 } }, "content": 186 @@ -573,7 +573,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 diff --git a/test/fixtures/mson/check-default-without-value.json b/test/fixtures/mson/check-default-without-value.json index e86286996..b4e0d51af 100644 --- a/test/fixtures/mson/check-default-without-value.json +++ b/test/fixtures/mson/check-default-without-value.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 66 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 25 } }, "content": 15 diff --git a/test/fixtures/mson/check-sample-without-value.json b/test/fixtures/mson/check-sample-without-value.json index 29d2fd9f1..19ac3ce2b 100644 --- a/test/fixtures/mson/check-sample-without-value.json +++ b/test/fixtures/mson/check-sample-without-value.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 66 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 23 + "content": 24 } }, "content": 14 diff --git a/test/fixtures/mson/enum-empty-default.json b/test/fixtures/mson/enum-empty-default.json index aa3d86a90..37263aa9c 100644 --- a/test/fixtures/mson/enum-empty-default.json +++ b/test/fixtures/mson/enum-empty-default.json @@ -341,7 +341,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 115 @@ -355,7 +355,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 15 } }, "content": 13 diff --git a/test/fixtures/mson/enum-multiple-default.json b/test/fixtures/mson/enum-multiple-default.json index 3f7770ff5..1f45c66a0 100644 --- a/test/fixtures/mson/enum-multiple-default.json +++ b/test/fixtures/mson/enum-multiple-default.json @@ -303,7 +303,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 69 @@ -317,7 +317,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 10 @@ -336,7 +336,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 83 @@ -350,7 +350,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 @@ -369,7 +369,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 95 @@ -383,7 +383,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 @@ -433,7 +433,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 122 @@ -447,7 +447,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 10 @@ -466,7 +466,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 136 @@ -480,7 +480,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 @@ -499,7 +499,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 149 @@ -513,7 +513,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 10 @@ -532,7 +532,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 163 @@ -546,7 +546,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 @@ -596,7 +596,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 175 @@ -610,7 +610,7 @@ }, "column": { "element": "number", - "content": 28 + "content": 29 } }, "content": 27 diff --git a/test/fixtures/mson/enum-variants.json b/test/fixtures/mson/enum-variants.json index 6952edd5a..53af2bd8c 100644 --- a/test/fixtures/mson/enum-variants.json +++ b/test/fixtures/mson/enum-variants.json @@ -1670,7 +1670,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 145 @@ -1684,7 +1684,7 @@ }, "column": { "element": "number", - "content": 73 + "content": 74 } }, "content": 72 @@ -1734,7 +1734,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 1133 @@ -1748,7 +1748,7 @@ }, "column": { "element": "number", - "content": 37 + "content": 38 } }, "content": 36 @@ -1798,7 +1798,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 1188 @@ -1812,7 +1812,7 @@ }, "column": { "element": "number", - "content": 39 + "content": 40 } }, "content": 38 @@ -1862,7 +1862,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 1440 @@ -1876,7 +1876,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 10 @@ -1895,7 +1895,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 1454 @@ -1909,7 +1909,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 @@ -1928,7 +1928,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 1466 @@ -1942,7 +1942,7 @@ }, "column": { "element": "number", - "content": 11 + "content": 12 } }, "content": 8 diff --git a/test/fixtures/mson/mixin-nonexistent.json b/test/fixtures/mson/mixin-nonexistent.json index 51e6189ca..ac25374ec 100644 --- a/test/fixtures/mson/mixin-nonexistent.json +++ b/test/fixtures/mson/mixin-nonexistent.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 282 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 12 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 282 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 13 + "content": 14 } }, "content": 12 diff --git a/test/fixtures/mson/number-wrong-value.json b/test/fixtures/mson/number-wrong-value.json index 5478366b8..9ba0db5d5 100644 --- a/test/fixtures/mson/number-wrong-value.json +++ b/test/fixtures/mson/number-wrong-value.json @@ -108,7 +108,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 334 @@ -122,7 +122,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 30 diff --git a/test/fixtures/mson/primitive-with-members.json b/test/fixtures/mson/primitive-with-members.json index c7521e438..95ea7e438 100644 --- a/test/fixtures/mson/primitive-with-members.json +++ b/test/fixtures/mson/primitive-with-members.json @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 74 @@ -165,7 +165,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -215,7 +215,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 74 @@ -229,7 +229,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -279,7 +279,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 105 @@ -293,7 +293,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -343,7 +343,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 105 @@ -357,7 +357,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -407,7 +407,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 134 @@ -421,7 +421,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -471,7 +471,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 134 @@ -485,7 +485,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 @@ -535,7 +535,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 165 @@ -549,7 +549,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 15 } }, "content": 15 @@ -599,7 +599,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 165 @@ -613,7 +613,7 @@ }, "column": { "element": "number", - "content": 14 + "content": 15 } }, "content": 15 @@ -663,7 +663,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 180 @@ -677,7 +677,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 6 diff --git a/test/fixtures/mson/regression-269.json b/test/fixtures/mson/regression-269.json index 37f945253..86880cc77 100644 --- a/test/fixtures/mson/regression-269.json +++ b/test/fixtures/mson/regression-269.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 19 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 9 + "content": 10 } }, "content": 10 diff --git a/test/fixtures/mson/resource-primitive-mixin.json b/test/fixtures/mson/resource-primitive-mixin.json index 440ade8c3..08ccf1eca 100644 --- a/test/fixtures/mson/resource-primitive-mixin.json +++ b/test/fixtures/mson/resource-primitive-mixin.json @@ -106,7 +106,7 @@ }, "column": { "element": "number", - "content": 6 + "content": 7 } }, "content": 45 @@ -120,7 +120,7 @@ }, "column": { "element": "number", - "content": 20 + "content": 21 } }, "content": 15 @@ -170,7 +170,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 43 @@ -184,7 +184,7 @@ }, "column": { "element": "number", - "content": 20 + "content": 21 } }, "content": 17 diff --git a/test/fixtures/mson/resource-unresolved-reference.json b/test/fixtures/mson/resource-unresolved-reference.json index f8774867a..9a79dd035 100644 --- a/test/fixtures/mson/resource-unresolved-reference.json +++ b/test/fixtures/mson/resource-unresolved-reference.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 99 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 21 + "content": 22 } }, "content": 20 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 76 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 21 diff --git a/test/fixtures/mson/type-attributes-payload.json b/test/fixtures/mson/type-attributes-payload.json index 94392761f..db6e0327b 100644 --- a/test/fixtures/mson/type-attributes-payload.json +++ b/test/fixtures/mson/type-attributes-payload.json @@ -226,7 +226,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 85 @@ -240,7 +240,7 @@ }, "column": { "element": "number", - "content": 32 + "content": 33 } }, "content": 23 diff --git a/test/fixtures/mson/type-attributes-payload.sourcemap.json b/test/fixtures/mson/type-attributes-payload.sourcemap.json index 906c23f8a..b71ccbdd5 100644 --- a/test/fixtures/mson/type-attributes-payload.sourcemap.json +++ b/test/fixtures/mson/type-attributes-payload.sourcemap.json @@ -449,7 +449,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 85 @@ -463,7 +463,7 @@ }, "column": { "element": "number", - "content": 32 + "content": 33 } }, "content": 23 diff --git a/test/fixtures/mson/type-attributes.json b/test/fixtures/mson/type-attributes.json index 2f7c7d6d3..036014f4d 100644 --- a/test/fixtures/mson/type-attributes.json +++ b/test/fixtures/mson/type-attributes.json @@ -128,7 +128,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -142,7 +142,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -192,7 +192,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -206,7 +206,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -256,7 +256,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -270,7 +270,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -320,7 +320,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -334,7 +334,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 diff --git a/test/fixtures/mson/type-attributes.sourcemap.json b/test/fixtures/mson/type-attributes.sourcemap.json index 16471bec3..fa6a4c7fe 100644 --- a/test/fixtures/mson/type-attributes.sourcemap.json +++ b/test/fixtures/mson/type-attributes.sourcemap.json @@ -201,7 +201,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -215,7 +215,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -265,7 +265,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -279,7 +279,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -329,7 +329,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -343,7 +343,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 @@ -393,7 +393,7 @@ }, "column": { "element": "number", - "content": 2 + "content": 3 } }, "content": 24 @@ -407,7 +407,7 @@ }, "column": { "element": "number", - "content": 63 + "content": 64 } }, "content": 62 diff --git a/test/fixtures/parse-result/blueprint.json b/test/fixtures/parse-result/blueprint.json index aa0871045..8ae4e9bc0 100644 --- a/test/fixtures/parse-result/blueprint.json +++ b/test/fixtures/parse-result/blueprint.json @@ -137,7 +137,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 87 @@ -151,7 +151,7 @@ }, "column": { "element": "number", - "content": 23 + "content": 24 } }, "content": 24 diff --git a/test/fixtures/parse-result/blueprint.sourcemap.json b/test/fixtures/parse-result/blueprint.sourcemap.json index a30fe3cff..5717ad5ba 100644 --- a/test/fixtures/parse-result/blueprint.sourcemap.json +++ b/test/fixtures/parse-result/blueprint.sourcemap.json @@ -337,7 +337,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 87 @@ -351,7 +351,7 @@ }, "column": { "element": "number", - "content": 23 + "content": 24 } }, "content": 24 diff --git a/test/fixtures/parse-result/error-warning.json b/test/fixtures/parse-result/error-warning.json index a705758b7..08db9975b 100644 --- a/test/fixtures/parse-result/error-warning.json +++ b/test/fixtures/parse-result/error-warning.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 55 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 8 + "content": 9 } }, "content": 9 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 8 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 diff --git a/test/fixtures/parse-result/error-warning.sourcemap.json b/test/fixtures/parse-result/error-warning.sourcemap.json index a705758b7..08db9975b 100644 --- a/test/fixtures/parse-result/error-warning.sourcemap.json +++ b/test/fixtures/parse-result/error-warning.sourcemap.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 55 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 8 + "content": 9 } }, "content": 9 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 8 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 diff --git a/test/fixtures/parse-result/warning.json b/test/fixtures/parse-result/warning.json index ba169e2da..2c625b551 100644 --- a/test/fixtures/parse-result/warning.json +++ b/test/fixtures/parse-result/warning.json @@ -130,7 +130,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 24 @@ -144,7 +144,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 diff --git a/test/fixtures/parse-result/warning.sourcemap.json b/test/fixtures/parse-result/warning.sourcemap.json index 1330be8fd..4831b1239 100644 --- a/test/fixtures/parse-result/warning.sourcemap.json +++ b/test/fixtures/parse-result/warning.sourcemap.json @@ -253,7 +253,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 24 @@ -267,7 +267,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 diff --git a/test/fixtures/parse-result/warnings.json b/test/fixtures/parse-result/warnings.json index f9f5b3b85..0035c7371 100644 --- a/test/fixtures/parse-result/warnings.json +++ b/test/fixtures/parse-result/warnings.json @@ -146,7 +146,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 24 @@ -160,7 +160,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 @@ -210,7 +210,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 37 @@ -224,7 +224,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 27 diff --git a/test/fixtures/parse-result/warnings.sourcemap.json b/test/fixtures/parse-result/warnings.sourcemap.json index d36b7faf3..7b45e29df 100644 --- a/test/fixtures/parse-result/warnings.sourcemap.json +++ b/test/fixtures/parse-result/warnings.sourcemap.json @@ -294,7 +294,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 24 @@ -308,7 +308,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 13 @@ -358,7 +358,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 37 @@ -372,7 +372,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 27 diff --git a/test/fixtures/render/enum-default-multiple.json b/test/fixtures/render/enum-default-multiple.json index 75936cea7..7f6263eaf 100644 --- a/test/fixtures/render/enum-default-multiple.json +++ b/test/fixtures/render/enum-default-multiple.json @@ -281,7 +281,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 115 @@ -295,7 +295,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 25 } }, "content": 13 @@ -314,7 +314,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 140 @@ -328,7 +328,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 25 } }, "content": 13 @@ -347,7 +347,7 @@ }, "column": { "element": "number", - "content": 12 + "content": 13 } }, "content": 165 @@ -361,7 +361,7 @@ }, "column": { "element": "number", - "content": 24 + "content": 25 } }, "content": 13 diff --git a/test/fixtures/render/issue-246.json b/test/fixtures/render/issue-246.json index 538689e2a..7b2c0fe6f 100644 --- a/test/fixtures/render/issue-246.json +++ b/test/fixtures/render/issue-246.json @@ -290,7 +290,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 128 @@ -304,7 +304,7 @@ }, "column": { "element": "number", - "content": 22 + "content": 23 } }, "content": 19 @@ -354,7 +354,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 161 @@ -368,7 +368,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 31 @@ -418,7 +418,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 192 @@ -432,7 +432,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 21 @@ -482,7 +482,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 213 @@ -496,7 +496,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 13 @@ -546,7 +546,7 @@ }, "column": { "element": "number", - "content": 4 + "content": 5 } }, "content": 240 @@ -560,7 +560,7 @@ }, "column": { "element": "number", - "content": 22 + "content": 23 } }, "content": 19 diff --git a/test/fixtures/render/issue-318.json b/test/fixtures/render/issue-318.json index 4e0397574..3ac7090e0 100644 --- a/test/fixtures/render/issue-318.json +++ b/test/fixtures/render/issue-318.json @@ -290,7 +290,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 118 @@ -304,7 +304,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 28 @@ -354,7 +354,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 146 @@ -368,7 +368,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 36 @@ -418,7 +418,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 182 @@ -432,7 +432,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 20 diff --git a/test/fixtures/render/issue-328-1.json b/test/fixtures/render/issue-328-1.json index 037c44ff8..75526dfe9 100644 --- a/test/fixtures/render/issue-328-1.json +++ b/test/fixtures/render/issue-328-1.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 30 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 18 diff --git a/test/fixtures/render/issue-328-2.json b/test/fixtures/render/issue-328-2.json index 15b9ebb3d..26b3f5f9a 100644 --- a/test/fixtures/render/issue-328-2.json +++ b/test/fixtures/render/issue-328-2.json @@ -37,7 +37,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 35 @@ -51,7 +51,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 18 @@ -101,7 +101,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 73 @@ -115,7 +115,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 15 diff --git a/test/fixtures/render/issue-547.json b/test/fixtures/render/issue-547.json index a97016f2b..6fbe4cac2 100644 --- a/test/fixtures/render/issue-547.json +++ b/test/fixtures/render/issue-547.json @@ -177,7 +177,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 71 @@ -191,7 +191,7 @@ }, "column": { "element": "number", - "content": 17 + "content": 18 } }, "content": 8 diff --git a/test/fixtures/render/numbers.json b/test/fixtures/render/numbers.json index f16f82b4e..bbd6011d1 100644 --- a/test/fixtures/render/numbers.json +++ b/test/fixtures/render/numbers.json @@ -455,7 +455,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 791 @@ -469,7 +469,7 @@ }, "column": { "element": "number", - "content": 46 + "content": 47 } }, "content": 37 @@ -519,7 +519,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 838 @@ -533,7 +533,7 @@ }, "column": { "element": "number", - "content": 70 + "content": 71 } }, "content": 61 @@ -583,7 +583,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 909 @@ -597,7 +597,7 @@ }, "column": { "element": "number", - "content": 50 + "content": 51 } }, "content": 41 @@ -647,7 +647,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 960 @@ -661,7 +661,7 @@ }, "column": { "element": "number", - "content": 52 + "content": 53 } }, "content": 43 @@ -711,7 +711,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 1013 @@ -725,7 +725,7 @@ }, "column": { "element": "number", - "content": 53 + "content": 54 } }, "content": 44 @@ -775,7 +775,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 1067 @@ -789,7 +789,7 @@ }, "column": { "element": "number", - "content": 47 + "content": 48 } }, "content": 38 @@ -839,7 +839,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 1115 @@ -853,7 +853,7 @@ }, "column": { "element": "number", - "content": 54 + "content": 55 } }, "content": 45 @@ -903,7 +903,7 @@ }, "column": { "element": "number", - "content": 10 + "content": 11 } }, "content": 1170 @@ -917,7 +917,7 @@ }, "column": { "element": "number", - "content": 37 + "content": 38 } }, "content": 28 diff --git a/test/fixtures/syntax/issue-350.json b/test/fixtures/syntax/issue-350.json index a6ea454c3..e60fd9d4c 100644 --- a/test/fixtures/syntax/issue-350.json +++ b/test/fixtures/syntax/issue-350.json @@ -133,7 +133,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 32 @@ -147,7 +147,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 34 @@ -197,7 +197,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 66 @@ -211,7 +211,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 44 @@ -261,7 +261,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 110 @@ -275,7 +275,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 16 From a646130faa431f527c8d50a57ac7b925b904dece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 13 Nov 2018 16:34:33 +0100 Subject: [PATCH 15/16] chore: update integrations tests --- features/fixtures/refract.json | 12 ++++++------ features/fixtures/refract.sourcemap.json | 12 ++++++------ features/fixtures/refract.sourcemap.yaml | 12 ++++++------ features/fixtures/refract.yaml | 12 ++++++------ features/validate.feature | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/features/fixtures/refract.json b/features/fixtures/refract.json index 9bc4a0169..b80b4fdcb 100644 --- a/features/fixtures/refract.json +++ b/features/fixtures/refract.json @@ -1047,7 +1047,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 685 @@ -1061,7 +1061,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -1111,7 +1111,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 992 @@ -1125,7 +1125,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -1175,7 +1175,7 @@ }, "column": { "element": "number", - "content": 6 + "content": 7 } }, "content": 200 @@ -1189,7 +1189,7 @@ }, "column": { "element": "number", - "content": 107 + "content": 108 } }, "content": 102 diff --git a/features/fixtures/refract.sourcemap.json b/features/fixtures/refract.sourcemap.json index 932c70497..4a61817c7 100644 --- a/features/fixtures/refract.sourcemap.json +++ b/features/fixtures/refract.sourcemap.json @@ -3219,7 +3219,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 685 @@ -3233,7 +3233,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -3283,7 +3283,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 992 @@ -3297,7 +3297,7 @@ }, "column": { "element": "number", - "content": 0 + "content": 1 } }, "content": 45 @@ -3347,7 +3347,7 @@ }, "column": { "element": "number", - "content": 6 + "content": 7 } }, "content": 200 @@ -3361,7 +3361,7 @@ }, "column": { "element": "number", - "content": 107 + "content": 108 } }, "content": 102 diff --git a/features/fixtures/refract.sourcemap.yaml b/features/fixtures/refract.sourcemap.yaml index 8903ae503..a19f67665 100644 --- a/features/fixtures/refract.sourcemap.yaml +++ b/features/fixtures/refract.sourcemap.yaml @@ -2101,7 +2101,7 @@ content: content: 39 column: element: "number" - content: 0 + content: 1 content: 685 - element: "number" @@ -2111,7 +2111,7 @@ content: content: 42 column: element: "number" - content: 0 + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2144,7 +2144,7 @@ content: content: 55 column: element: "number" - content: 0 + content: 1 content: 992 - element: "number" @@ -2154,7 +2154,7 @@ content: content: 58 column: element: "number" - content: 0 + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -2187,7 +2187,7 @@ content: content: 14 column: element: "number" - content: 6 + content: 7 content: 200 - element: "number" @@ -2197,6 +2197,6 @@ content: content: 14 column: element: "number" - content: 107 + content: 108 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" diff --git a/features/fixtures/refract.yaml b/features/fixtures/refract.yaml index 37d9951bc..b68cd1df6 100644 --- a/features/fixtures/refract.yaml +++ b/features/fixtures/refract.yaml @@ -707,7 +707,7 @@ content: content: 39 column: element: "number" - content: 0 + content: 1 content: 685 - element: "number" @@ -717,7 +717,7 @@ content: content: 42 column: element: "number" - content: 0 + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -750,7 +750,7 @@ content: content: 55 column: element: "number" - content: 0 + content: 1 content: 992 - element: "number" @@ -760,7 +760,7 @@ content: content: 58 column: element: "number" - content: 0 + content: 1 content: 45 content: "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead" - @@ -793,7 +793,7 @@ content: content: 14 column: element: "number" - content: 6 + content: 7 content: 200 - element: "number" @@ -803,6 +803,6 @@ content: content: 14 column: element: "number" - content: 107 + content: 108 content: 102 content: "invalid value format for 'number' type. please check mson specification for valid format" diff --git a/features/validate.feature b/features/validate.feature index 98266922f..9937b9559 100644 --- a/features/validate.feature +++ b/features/validate.feature @@ -42,5 +42,5 @@ Feature: Validate a blueprint Then the output should contain: """ OK. - warning: (5) unexpected header block, expected a group, resource or an action definition, e.g. '# Group ', '# []' or '# '; line 4, column 0 - line 4, column 28 + warning: (5) unexpected header block, expected a group, resource or an action definition, e.g. '# Group ', '# []' or '# '; line 4, column 1 - line 4, column 29 """ From 3e078fac7f00f966591cb470fcc42403c22a26e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kratochv=C3=ADl?= Date: Tue, 13 Nov 2018 16:40:29 +0100 Subject: [PATCH 16/16] chore: update changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 092b46300..73501ca12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ ## master * Add column/line info to anotations source maps -* change start column index from 1 to 0 in reporting. (while `-l` switch is used) ## 4.0.0-pre.1