Skip to content

Commit

Permalink
#22 Regex fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechRynczuk committed May 31, 2017
1 parent b7a554d commit 1bbebfc
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions sources/common/inc/EventSignalCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -38,12 +38,12 @@ namespace PARSER

/// The event signal creator constructor.
EventSignalCreator() :
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) e .*")
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) e *.*")
{
}

/// @copydoc SignalCreator::Create()
virtual SIGNAL::Signal *Create(const std::string &logLine,
virtual SIGNAL::Signal *Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const;

};
Expand Down
6 changes: 3 additions & 3 deletions sources/common/inc/FSignalCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -40,12 +40,12 @@ namespace PARSER

/// The real signal creator constructor.
FSignalCreator() :
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) ([[:d:][:punct:]]+) f .*")
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) ([[:d:][:punct:]]+) f *.*")
{
}

/// @copydoc SignalCreator::Create()
virtual SIGNAL::Signal *Create(const std::string &logLine,
virtual SIGNAL::Signal *Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const;

};
Expand Down
6 changes: 3 additions & 3 deletions sources/common/inc/ISignalCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -38,12 +38,12 @@ namespace PARSER
public:
/// The integer signal creator constructor.
ISignalCreator() :
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) ([[:d:]]+) ([[:d:]]+) .*")
SignalCreator("^#([[:d:]]+) ([[:graph:]]+) ([[:d:]]+) ([[:d:]]+) *.*")
{
}

/// @copydoc SignalCreator::Create()
virtual SIGNAL::Signal *Create(const std::string &logLine,
virtual SIGNAL::Signal *Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const;
};

Expand Down
12 changes: 6 additions & 6 deletions sources/common/inc/SignalCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -47,9 +47,9 @@ namespace PARSER
///
/// The constructor initializes the regular expression member variable
/// which will be matched against the log line.
/// @param signalRegEx The regular expression to be matech against the log line.
SignalCreator(const std::string &signalRegEx) :
m_SignalRegEx(signalRegEx + "\r?\n")
/// @param rSignalRegEx The regular expression to be matech against the log line.
SignalCreator(const std::string &rSignalRegEx) :
m_SignalRegEx(rSignalRegEx + "\r?$")
{
}

Expand All @@ -63,10 +63,10 @@ namespace PARSER
/// If the log line is not matching the integer object specification
/// then nullptr is returned.
///
/// @param logLine The log line serving as the creation specification.
/// @param rLogLine The log line serving as the creation specification.
/// @param sourceHandle Signal source handle.
/// @return Signal pointer if the object has been created or nullptr.
virtual SIGNAL::Signal *Create(const std::string &logLine,
virtual SIGNAL::Signal *Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const = 0;

protected:
Expand Down
6 changes: 3 additions & 3 deletions sources/common/src/EventSignalCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand All @@ -27,12 +27,12 @@
#include "EventSignalCreator.h"
#include "EventSignal.h"

SIGNAL::Signal *PARSER::EventSignalCreator::Create(const std::string &logLine,
SIGNAL::Signal *PARSER::EventSignalCreator::Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const
{
std::smatch result;

if (true == std::regex_search(logLine, result, m_SignalRegEx))
if (true == std::regex_search(rLogLine, result, m_SignalRegEx))
{
return new SIGNAL::EventSignal(result[2].str(),
std::stoll(result[1].str()),
Expand Down
6 changes: 3 additions & 3 deletions sources/common/src/FSignalCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand All @@ -27,12 +27,12 @@
#include "FSignalCreator.h"
#include "FSignal.h"

SIGNAL::Signal *PARSER::FSignalCreator::Create(const std::string &logLine,
SIGNAL::Signal *PARSER::FSignalCreator::Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const
{
std::smatch result;

if (true == std::regex_search(logLine, result, m_SignalRegEx))
if (true == std::regex_search(rLogLine, result, m_SignalRegEx))
{
return new SIGNAL::FSignal(result[2].str(),
std::stoll(result[1].str()),
Expand Down
6 changes: 3 additions & 3 deletions sources/common/src/ISignalCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// @ingroup Parser
///
/// @par Copyright (c) 2016 vcdMaker team
/// @par Copyright (c) 2017 vcdMaker team
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
Expand All @@ -27,12 +27,12 @@
#include "ISignalCreator.h"
#include "ISignal.h"

SIGNAL::Signal *PARSER::ISignalCreator::Create(const std::string &logLine,
SIGNAL::Signal *PARSER::ISignalCreator::Create(const std::string &rLogLine,
SIGNAL::SourceRegistry::HandleT sourceHandle) const
{
std::smatch result;

if (true == std::regex_search(logLine, result, m_SignalRegEx))
if (true == std::regex_search(rLogLine, result, m_SignalRegEx))
{
return new SIGNAL::ISignal(result[2].str(),
std::stoi(result[4].str()),
Expand Down

0 comments on commit 1bbebfc

Please sign in to comment.