Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
realHannes committed Jul 8, 2024
1 parent ed7fad5 commit f951979
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
49 changes: 24 additions & 25 deletions src/parser/TurtleParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "parser/NormalizedString.h"
#include "parser/RdfEscaping.h"
#include "util/Conversions.h"
#include "util/DateYearDuration.h"
#include "util/OnDestructionDontThrowDuringStackUnwinding.h"

using namespace std::chrono_literals;
Expand Down Expand Up @@ -417,19 +418,19 @@ TripleComponent TurtleParser<T>::literalAndDatatypeToTripleComponentImpl(
parser->parseDoubleConstant(normalizedLiteralContent);
} else if (type == XSD_DATETIME_TYPE) {
parser->lastParseResult_ =
DateOrLargeYear::parseXsdDatetime(normalizedLiteralContent);
DateYearOrDuration::parseXsdDatetime(normalizedLiteralContent);
} else if (type == XSD_DATE_TYPE) {
parser->lastParseResult_ =
DateOrLargeYear::parseXsdDate(normalizedLiteralContent);
DateYearOrDuration::parseXsdDate(normalizedLiteralContent);
} else if (type == XSD_GYEARMONTH_TYPE) {
parser->lastParseResult_ =
DateOrLargeYear::parseGYearMonth(normalizedLiteralContent);
DateYearOrDuration::parseGYearMonth(normalizedLiteralContent);
} else if (type == XSD_GYEAR_TYPE) {
parser->lastParseResult_ =
DateOrLargeYear::parseGYear(normalizedLiteralContent);
} else if (type == XSD_DAYTIME_DURATION_TYPE) {
parser->lastParseResult_ =
DateYearOrDuration::parseXsdDayTimeDuration(strippedLiteral);
DateYearOrDuration::parseGYear(normalizedLiteralContent);
} else if (type == XSD_DAYTIME_DURATION_TYPE) {
parser->lastParseResult_ =
DateYearOrDuration::parseXsdDayTimeDuration(normalizedLiteralContent);
} else {
literal.addDatatype(typeIri);
parser->lastParseResult_ = std::move(literal);
Expand All @@ -450,24 +451,22 @@ TripleComponent TurtleParser<T>::literalAndDatatypeToTripleComponentImpl(
"instead"
<< std::endl;
parser->lastParseResult_ = std::move(literal);
} catch (const DurationParseException&) {
LOG(DEBUG)
<< strippedLiteral
<< " could not be parsed as a duration object of type " << type
<< ". It is treated as a plain string literal without datatype "
"instead"
<< std::endl;
parser->lastParseResult_ = std::move(previous);
} catch (const DurationOverflowException& ex) {
LOG(DEBUG)
<< strippedLiteral
<< " could not be parsed as duration object for the following "
"reason: "
<< ex.what()
<< ". It is treated as a plain string literal without datatype "
"instead"
<< std::endl;
parser->lastParseResult_ = std::move(previous);
} catch (const DurationParseException&) {
LOG(DEBUG) << normalizedLiteralContent
<< " could not be parsed as a duration object of type " << type
<< ". It is treated as a plain string literal without datatype "
"instead"
<< std::endl;
parser->lastParseResult_ = std::move(literal);
} catch (const DurationOverflowException& ex) {
LOG(DEBUG) << normalizedLiteralContent
<< " could not be parsed as duration object for the following "
"reason: "
<< ex.what()
<< ". It is treated as a plain string literal without datatype "
"instead"
<< std::endl;
parser->lastParseResult_ = std::move(literal);
} catch (const std::exception& e) {
parser->raise(e.what());
}
Expand Down
1 change: 1 addition & 0 deletions src/util/Date.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <bit>
#include <cmath>
#include <cstdint>
#include <exception>
#include <sstream>
#include <variant>
Expand Down
13 changes: 7 additions & 6 deletions src/util/Duration.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <bit>
#include <cmath>
#include <cstdint>
#include <exception>
#include <optional>
#include <sstream>
Expand Down Expand Up @@ -48,12 +49,12 @@ class DurationParseException : public std::runtime_error {
// `DateYearOrDuration` is constructed with the given `DayTimeDuration` object
// as an argument, and passed to Id::makeFromDate(). The provided values to this
// class (days, hours, minutes, seconds) will be factorized to a total
// millisecond value, which is then stored in the reseved bits (48 bits). The
// operations == and <=> will be performed directly on the underlying bit, which
// is highly efficient. If the provided values for hours, minutes and seconds
// are larger than their typical limits given by a daytime (hence hours > 23,
// minutes > 59 or seconds >59.999), they will be internally normalized over the
// conversion procedure.
// millisecond value, which is then stored in the reserved bits (48 bits). The
// operations == and <=> will be performed directly on the underlying bit
// representation, which is highly efficient. If the provided values for hours,
// minutes and seconds are larger than their typical limits given by a daytime
// (hence hours > 23, minutes > 59 or seconds > 59.999), they will be internally
// normalized over the conversion procedure.
class DayTimeDuration {
public:
// seconds, minutes, hours (multiplier for conversion to milliseconds)
Expand Down

0 comments on commit f951979

Please sign in to comment.