From b92d01f5c85844c6c216be84f01543f75ecc6ca3 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sun, 16 Apr 2023 16:17:52 +0200 Subject: [PATCH] Support CV qualifiers in function pointer types --- btparser/keywords.h | 1 + btparser/tests/cursor.hpp | 104 +++++++++++++++++---------------- btparser/tests/cursor.hpp.pp.h | 102 ++++++++++++++++---------------- btparser/typesparser.cpp | 45 +++++++------- 4 files changed, 133 insertions(+), 119 deletions(-) diff --git a/btparser/keywords.h b/btparser/keywords.h index e8a3435..cb8c279 100644 --- a/btparser/keywords.h +++ b/btparser/keywords.h @@ -23,6 +23,7 @@ DEF_KEYWORD(typedef) DEF_KEYWORD(sizeof) DEF_KEYWORD(union) DEF_KEYWORD(const) +DEF_KEYWORD(volatile) DEF_KEYWORD(void) DEF_KEYWORD(signed) diff --git a/btparser/tests/cursor.hpp b/btparser/tests/cursor.hpp index 2c8d9ba..92037e6 100644 --- a/btparser/tests/cursor.hpp +++ b/btparser/tests/cursor.hpp @@ -1,55 +1,59 @@ -struct TTD::Replay::IReplayEngine +struct TTD::Replay::ICursor { + virtual struct TTD::Replay::MemoryRange QueryMemoryRange(enum Nirvana::GuestAddress, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual struct TTD::Replay::MemoryBuffer QueryMemoryBuffer(enum Nirvana::GuestAddress, struct TTD::TBufferViewT, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual struct TTD::Replay::MemoryBufferWithRanges QueryMemoryBufferWithRanges(enum Nirvana::GuestAddress, struct TTD::TBufferViewT, uint64_t, struct TTD::Replay::MemoryRange *, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual void SetDefaultMemoryPolicy(enum TTD::Replay::QueryMemoryPolicy) = 0; + virtual enum TTD::Replay::QueryMemoryPolicy GetDefaultMemoryPolicy() const = 0; + virtual void * UnsafeGetReplayEngine(struct _GUID const &) const = 0; virtual void const * UnsafeAsInterface(struct _GUID const &) const = 0; virtual void * UnsafeAsInterface(struct _GUID const &) = 0; - virtual enum Nirvana::GuestAddress GetPebAddress() const = 0; - virtual struct TTD::SystemInfo const & GetSystemInfo() const = 0; - virtual struct TTD::Replay::PositionRange const & GetLifetime() const = 0; - virtual struct TTD::Replay::Position const & GetLastPosition() const = 0; - virtual struct TTD::Replay::Position const & GetFirstPosition() const = 0; - virtual enum TTD::Replay::RecordingType GetRecordingType() const = 0; - virtual struct TTD::Replay::ThreadInfo const & GetThreadInfo(enum TTD::Replay::UniqueThreadId) const = 0; - virtual uint64_t GetThreadCount() const = 0; - virtual struct TTD::Replay::ThreadInfo const * GetThreadList() const = 0; - virtual uint64_t const * GetThreadFirstPositionIndex() const = 0; - virtual uint64_t const * GetThreadLastPositionIndex() const = 0; - virtual uint64_t const * GetThreadLifetimeFirstPositionIndex() const = 0; - virtual uint64_t const * GetThreadLifetimeLastPositionIndex() const = 0; - virtual uint64_t GetThreadCreatedEventCount() const = 0; - virtual struct TTD::Replay::ThreadCreatedEvent const * GetThreadCreatedEventList() const = 0; - virtual uint64_t GetThreadTerminatedEventCount() const = 0; - virtual struct TTD::Replay::ThreadTerminatedEvent const * GetThreadTerminatedEventList() const = 0; + virtual struct TTD::Replay::ThreadInfo const & GetThreadInfo(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetTebAddress(enum TTD::ThreadId) const = 0; + virtual struct TTD::Replay::Position const & GetPosition(enum TTD::ThreadId) const = 0; + virtual struct TTD::Replay::Position const & GetPreviousPosition(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetProgramCounter(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetStackPointer(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetFramePointer(enum TTD::ThreadId) const = 0; + virtual uint64_t GetBasicReturnValue(enum TTD::ThreadId) const = 0; + virtual union TTD::Replay::RegisterContext GetCrossPlatformContext(enum TTD::ThreadId) const = 0; + virtual union TTD::Replay::ExtendedRegisterContext GetAvxExtendedContext(enum TTD::ThreadId) const = 0; virtual uint64_t GetModuleCount() const = 0; - virtual struct TTD::Replay::Module const * GetModuleList() const = 0; - virtual uint64_t GetModuleInstanceCount() const = 0; - virtual struct TTD::Replay::ModuleInstance const * GetModuleInstanceList() const = 0; - virtual uint64_t const * GetModuleInstanceUnloadIndex() const = 0; - virtual uint64_t GetModuleLoadedEventCount() const = 0; - virtual struct TTD::Replay::ModuleLoadedEvent const * GetModuleLoadedEventList() const = 0; - virtual uint64_t GetModuleUnloadedEventCount() const = 0; - virtual struct TTD::Replay::ModuleUnloadedEvent const * GetModuleUnloadedEventList() const = 0; - virtual uint64_t GetExceptionEventCount() const = 0; - virtual struct TTD::Replay::ExceptionEvent const * GetExceptionEventList() const = 0; - virtual struct TTD::Replay::ExceptionEvent const * GetExceptionAtOrAfterPosition(struct TTD::Replay::Position const &) const = 0; - virtual uint64_t GetKeyframeCount() const = 0; - virtual struct TTD::Replay::Position const * GetKeyframeList() const = 0; - virtual uint64_t GetRecordClientCount() const = 0; - virtual struct TTD::Replay::RecordClient const * GetRecordClientList() const = 0; - virtual struct TTD::Replay::RecordClient const & GetRecordClient(enum TTD::RecordClientId) const = 0; - virtual uint64_t GetCustomEventCount() const = 0; - virtual struct TTD::Replay::CustomEvent const * GetCustomEventList() const = 0; - virtual uint64_t GetActivityCount() const = 0; - virtual struct TTD::Replay::Activity const * GetActivityList() const = 0; - virtual uint64_t GetIslandCount() const = 0; - virtual struct TTD::Replay::Island const * GetIslandList() const = 0; - virtual class TTD::Replay::ICursor * NewCursor(struct _GUID const &) = 0; - virtual enum TTD::Replay::IndexStatus BuildIndex(void (*)(void const *, struct TTD::Replay::IndexBuildProgressType const *), void const *, enum TTD::Replay::IndexBuildFlags) = 0; - virtual enum TTD::Replay::IndexStatus GetIndexStatus() const = 0; - virtual struct TTD::Replay::IndexFileStats GetIndexFileStats() const = 0; - virtual void RegisterDebugModeAndLogging(enum TTD::Replay::DebugModeType, class TTD::ErrorReporting *) = 0; - virtual class TTD::Replay::IEngineInternals const * GetInternals() const = 0; - virtual class TTD::Replay::IEngineInternals * GetInternals() = 0; - virtual ~IReplayEngine() = 0; + virtual struct TTD::Replay::ModuleInstance const * GetModuleList() const = 0; + virtual uint64_t GetThreadCount() const = 0; + virtual struct TTD::Replay::ActiveThreadInfo const * GetThreadList() const = 0; + virtual void SetEventMask(enum TTD::Replay::EventMask) = 0; + virtual enum TTD::Replay::EventMask GetEventMask() const = 0; + virtual void SetGapKindMask(enum TTD::Replay::GapKindMask) = 0; + virtual enum TTD::Replay::GapKindMask GetGapKindMask() const = 0; + virtual void SetGapEventMask(enum TTD::Replay::GapEventMask) = 0; + virtual enum TTD::Replay::GapEventMask GetGapEventMask() const = 0; + virtual void SetExceptionMask(enum TTD::Replay::ExceptionMask) = 0; + virtual enum TTD::Replay::ExceptionMask GetExceptionMask() const = 0; + virtual void SetReplayFlags(enum TTD::Replay::ReplayFlags) = 0; + virtual enum TTD::Replay::ReplayFlags GetReplayFlags() const = 0; + virtual bool AddMemoryWatchpoint(struct TTD::Replay::MemoryWatchpointData const &) = 0; + virtual bool RemoveMemoryWatchpoint(struct TTD::Replay::MemoryWatchpointData const &) = 0; + virtual bool AddPositionWatchpoint(struct TTD::Replay::PositionWatchpointData const &) = 0; + virtual bool RemovePositionWatchpoint(struct TTD::Replay::PositionWatchpointData const &) = 0; + virtual void Clear() = 0; + virtual void SetPosition(struct TTD::Replay::Position const &) = 0; + virtual void SetPositionOnThread(enum TTD::Replay::UniqueThreadId, struct TTD::Replay::Position const &) = 0; + virtual void SetMemoryWatchpointCallback(bool (*const)(uint64_t, struct TTD::Replay::ICursorView::MemoryWatchpointResult const &, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetPositionWatchpointCallback(bool (*const)(uint64_t, struct TTD::Replay::Position const &, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetGapEventCallback(bool (*const)(uint64_t, enum TTD::Replay::GapKind, enum TTD::Replay::GapEventType, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetThreadContinuityBreakCallback(void (*const)(uint64_t), uint64_t) = 0; + virtual void SetReplayProgressCallback(void (*const)(uint64_t, struct TTD::Replay::Position const &), uint64_t) = 0; + virtual void SetFallbackCallback(void (*const)(uint64_t, bool, enum Nirvana::GuestAddress, uint64_t, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetCallReturnCallback(void (*const)(uint64_t, enum Nirvana::GuestAddress, enum Nirvana::GuestAddress, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetIndirectJumpCallback(void (*const)(uint64_t, enum Nirvana::GuestAddress, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetRegisterChangedCallback(void (*const)(uint64_t, unsigned char, void const *, void const *, uint64_t, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual struct TTD::Replay::ICursorView::ReplayResult ReplayForward(struct TTD::Replay::Position, enum TTD::Replay::StepCount) = 0; + virtual struct TTD::Replay::ICursorView::ReplayResult ReplayBackward(struct TTD::Replay::Position, enum TTD::Replay::StepCount) = 0; + virtual void InterruptReplay() = 0; + virtual class TTD::Replay::ICursorInternals * GetInternals() = 0; + virtual class TTD::Replay::ICursorInternals const * GetInternals() const = 0; + virtual uint64_t GetInternalData(enum TTD::Replay::ICursorView::InternalDataId, void *, uint64_t) const = 0; + virtual ~ICursor() = 0; virtual void Destroy() = 0; - virtual bool Initialize(wchar_t const *) = 0; -}; \ No newline at end of file +}; diff --git a/btparser/tests/cursor.hpp.pp.h b/btparser/tests/cursor.hpp.pp.h index d95f1bc..420b2e2 100644 --- a/btparser/tests/cursor.hpp.pp.h +++ b/btparser/tests/cursor.hpp.pp.h @@ -1,55 +1,59 @@ -struct TTD::Replay::IReplayEngine +struct TTD::Replay::ICursor { + virtual struct TTD::Replay::MemoryRange QueryMemoryRange(enum Nirvana::GuestAddress, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual struct TTD::Replay::MemoryBuffer QueryMemoryBuffer(enum Nirvana::GuestAddress, struct TTD::TBufferViewT, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual struct TTD::Replay::MemoryBufferWithRanges QueryMemoryBufferWithRanges(enum Nirvana::GuestAddress, struct TTD::TBufferViewT, uint64_t, struct TTD::Replay::MemoryRange *, enum TTD::Replay::QueryMemoryPolicy) const = 0; + virtual void SetDefaultMemoryPolicy(enum TTD::Replay::QueryMemoryPolicy) = 0; + virtual enum TTD::Replay::QueryMemoryPolicy GetDefaultMemoryPolicy() const = 0; + virtual void * UnsafeGetReplayEngine(struct _GUID const &) const = 0; virtual void const * UnsafeAsInterface(struct _GUID const &) const = 0; virtual void * UnsafeAsInterface(struct _GUID const &) = 0; - virtual enum Nirvana::GuestAddress GetPebAddress() const = 0; - virtual struct TTD::SystemInfo const & GetSystemInfo() const = 0; - virtual struct TTD::Replay::PositionRange const & GetLifetime() const = 0; - virtual struct TTD::Replay::Position const & GetLastPosition() const = 0; - virtual struct TTD::Replay::Position const & GetFirstPosition() const = 0; - virtual enum TTD::Replay::RecordingType GetRecordingType() const = 0; - virtual struct TTD::Replay::ThreadInfo const & GetThreadInfo(enum TTD::Replay::UniqueThreadId) const = 0; - virtual uint64_t GetThreadCount() const = 0; - virtual struct TTD::Replay::ThreadInfo const * GetThreadList() const = 0; - virtual uint64_t const * GetThreadFirstPositionIndex() const = 0; - virtual uint64_t const * GetThreadLastPositionIndex() const = 0; - virtual uint64_t const * GetThreadLifetimeFirstPositionIndex() const = 0; - virtual uint64_t const * GetThreadLifetimeLastPositionIndex() const = 0; - virtual uint64_t GetThreadCreatedEventCount() const = 0; - virtual struct TTD::Replay::ThreadCreatedEvent const * GetThreadCreatedEventList() const = 0; - virtual uint64_t GetThreadTerminatedEventCount() const = 0; - virtual struct TTD::Replay::ThreadTerminatedEvent const * GetThreadTerminatedEventList() const = 0; + virtual struct TTD::Replay::ThreadInfo const & GetThreadInfo(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetTebAddress(enum TTD::ThreadId) const = 0; + virtual struct TTD::Replay::Position const & GetPosition(enum TTD::ThreadId) const = 0; + virtual struct TTD::Replay::Position const & GetPreviousPosition(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetProgramCounter(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetStackPointer(enum TTD::ThreadId) const = 0; + virtual enum Nirvana::GuestAddress GetFramePointer(enum TTD::ThreadId) const = 0; + virtual uint64_t GetBasicReturnValue(enum TTD::ThreadId) const = 0; + virtual union TTD::Replay::RegisterContext GetCrossPlatformContext(enum TTD::ThreadId) const = 0; + virtual union TTD::Replay::ExtendedRegisterContext GetAvxExtendedContext(enum TTD::ThreadId) const = 0; virtual uint64_t GetModuleCount() const = 0; - virtual struct TTD::Replay::Module const * GetModuleList() const = 0; - virtual uint64_t GetModuleInstanceCount() const = 0; - virtual struct TTD::Replay::ModuleInstance const * GetModuleInstanceList() const = 0; - virtual uint64_t const * GetModuleInstanceUnloadIndex() const = 0; - virtual uint64_t GetModuleLoadedEventCount() const = 0; - virtual struct TTD::Replay::ModuleLoadedEvent const * GetModuleLoadedEventList() const = 0; - virtual uint64_t GetModuleUnloadedEventCount() const = 0; - virtual struct TTD::Replay::ModuleUnloadedEvent const * GetModuleUnloadedEventList() const = 0; - virtual uint64_t GetExceptionEventCount() const = 0; - virtual struct TTD::Replay::ExceptionEvent const * GetExceptionEventList() const = 0; - virtual struct TTD::Replay::ExceptionEvent const * GetExceptionAtOrAfterPosition(struct TTD::Replay::Position const &) const = 0; - virtual uint64_t GetKeyframeCount() const = 0; - virtual struct TTD::Replay::Position const * GetKeyframeList() const = 0; - virtual uint64_t GetRecordClientCount() const = 0; - virtual struct TTD::Replay::RecordClient const * GetRecordClientList() const = 0; - virtual struct TTD::Replay::RecordClient const & GetRecordClient(enum TTD::RecordClientId) const = 0; - virtual uint64_t GetCustomEventCount() const = 0; - virtual struct TTD::Replay::CustomEvent const * GetCustomEventList() const = 0; - virtual uint64_t GetActivityCount() const = 0; - virtual struct TTD::Replay::Activity const * GetActivityList() const = 0; - virtual uint64_t GetIslandCount() const = 0; - virtual struct TTD::Replay::Island const * GetIslandList() const = 0; - virtual class TTD::Replay::ICursor * NewCursor(struct _GUID const &) = 0; - virtual enum TTD::Replay::IndexStatus BuildIndex(void (*)(void const *, struct TTD::Replay::IndexBuildProgressType const *), void const *, enum TTD::Replay::IndexBuildFlags) = 0; - virtual enum TTD::Replay::IndexStatus GetIndexStatus() const = 0; - virtual struct TTD::Replay::IndexFileStats GetIndexFileStats() const = 0; - virtual void RegisterDebugModeAndLogging(enum TTD::Replay::DebugModeType, class TTD::ErrorReporting *) = 0; - virtual class TTD::Replay::IEngineInternals const * GetInternals() const = 0; - virtual class TTD::Replay::IEngineInternals * GetInternals() = 0; - virtual ~IReplayEngine() = 0; + virtual struct TTD::Replay::ModuleInstance const * GetModuleList() const = 0; + virtual uint64_t GetThreadCount() const = 0; + virtual struct TTD::Replay::ActiveThreadInfo const * GetThreadList() const = 0; + virtual void SetEventMask(enum TTD::Replay::EventMask) = 0; + virtual enum TTD::Replay::EventMask GetEventMask() const = 0; + virtual void SetGapKindMask(enum TTD::Replay::GapKindMask) = 0; + virtual enum TTD::Replay::GapKindMask GetGapKindMask() const = 0; + virtual void SetGapEventMask(enum TTD::Replay::GapEventMask) = 0; + virtual enum TTD::Replay::GapEventMask GetGapEventMask() const = 0; + virtual void SetExceptionMask(enum TTD::Replay::ExceptionMask) = 0; + virtual enum TTD::Replay::ExceptionMask GetExceptionMask() const = 0; + virtual void SetReplayFlags(enum TTD::Replay::ReplayFlags) = 0; + virtual enum TTD::Replay::ReplayFlags GetReplayFlags() const = 0; + virtual bool AddMemoryWatchpoint(struct TTD::Replay::MemoryWatchpointData const &) = 0; + virtual bool RemoveMemoryWatchpoint(struct TTD::Replay::MemoryWatchpointData const &) = 0; + virtual bool AddPositionWatchpoint(struct TTD::Replay::PositionWatchpointData const &) = 0; + virtual bool RemovePositionWatchpoint(struct TTD::Replay::PositionWatchpointData const &) = 0; + virtual void Clear() = 0; + virtual void SetPosition(struct TTD::Replay::Position const &) = 0; + virtual void SetPositionOnThread(enum TTD::Replay::UniqueThreadId, struct TTD::Replay::Position const &) = 0; + virtual void SetMemoryWatchpointCallback(bool (*const)(uint64_t, struct TTD::Replay::ICursorView::MemoryWatchpointResult const &, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetPositionWatchpointCallback(bool (*const)(uint64_t, struct TTD::Replay::Position const &, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetGapEventCallback(bool (*const)(uint64_t, enum TTD::Replay::GapKind, enum TTD::Replay::GapEventType, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetThreadContinuityBreakCallback(void (*const)(uint64_t), uint64_t) = 0; + virtual void SetReplayProgressCallback(void (*const)(uint64_t, struct TTD::Replay::Position const &), uint64_t) = 0; + virtual void SetFallbackCallback(void (*const)(uint64_t, bool, enum Nirvana::GuestAddress, uint64_t, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetCallReturnCallback(void (*const)(uint64_t, enum Nirvana::GuestAddress, enum Nirvana::GuestAddress, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetIndirectJumpCallback(void (*const)(uint64_t, enum Nirvana::GuestAddress, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual void SetRegisterChangedCallback(void (*const)(uint64_t, unsigned char, void const *, void const *, uint64_t, class TTD::Replay::IThreadView const *), uint64_t) = 0; + virtual struct TTD::Replay::ICursorView::ReplayResult ReplayForward(struct TTD::Replay::Position, enum TTD::Replay::StepCount) = 0; + virtual struct TTD::Replay::ICursorView::ReplayResult ReplayBackward(struct TTD::Replay::Position, enum TTD::Replay::StepCount) = 0; + virtual void InterruptReplay() = 0; + virtual class TTD::Replay::ICursorInternals * GetInternals() = 0; + virtual class TTD::Replay::ICursorInternals const * GetInternals() const = 0; + virtual uint64_t GetInternalData(enum TTD::Replay::ICursorView::InternalDataId, void *, uint64_t) const = 0; + virtual ~ICursor() = 0; virtual void Destroy() = 0; - virtual bool Initialize(wchar_t const *) = 0; }; diff --git a/btparser/typesparser.cpp b/btparser/typesparser.cpp index 9e79c99..8f691d1 100644 --- a/btparser/typesparser.cpp +++ b/btparser/typesparser.cpp @@ -81,7 +81,7 @@ struct Parser bool parseVariable(const std::vector& tlist, QualifiedType& type, std::string& name, Lexer::Token kind) { std::string stype; // TODO: get rid of this variable - type = QualifiedType(); + type = QualifiedType(); switch (kind) { case Lexer::tok_struct: @@ -109,10 +109,10 @@ struct Parser const auto& t = tlist[i]; if (t.Is(Lexer::tok_const)) { - if(i == 0 || type.pointers.empty()) - type.isConst = true; - else - type.pointers.back().isConst = true; + if (i == 0 || type.pointers.empty()) + type.isConst = true; + else + type.pointers.back().isConst = true; continue; } @@ -166,10 +166,10 @@ struct Parser return false; } - if(!sawPointer) - type.name = stype; + if (!sawPointer) + type.name = stype; - type.pointers.emplace_back(); + type.pointers.emplace_back(); // Apply the pointer to the type on the left stype += '*'; @@ -183,8 +183,8 @@ struct Parser } if (stype.empty()) __debugbreak(); - if(!sawPointer) - type.name = stype; + if (!sawPointer) + type.name = stype; return true; } @@ -217,6 +217,9 @@ struct Parser } index++; + while (isToken(Lexer::tok_const) || isToken(Lexer::tok_volatile)) + index++; + if (!isToken(Lexer::tok_identifier)) { if (isToken(Lexer::tok_parclose)) @@ -363,14 +366,16 @@ struct Parser { auto startToken = curToken(); index++; - + // Function pointer argument to a function Function subfn; subfn.typeonly = true; - if(!parseFunction(kind, tlist, subfn, true)) + if (!parseFunction(kind, tlist, subfn, true)) + { return false; + } kind = Lexer::tok_eof; - + // Create fake tokens auto typeToken = tlist.back(); typeToken.Token = Lexer::tok_identifier; @@ -385,9 +390,9 @@ struct Parser tlist.push_back(typeToken); tlist.push_back(nameToken); - // Add the function to the model - subfn.name = typeToken.IdentifierStr; - model.functions.push_back(subfn); + // Add the function to the model + subfn.name = typeToken.IdentifierStr; + model.functions.push_back(subfn); } else { @@ -556,9 +561,9 @@ struct Parser tlist.push_back(typeToken); tlist.push_back(nameToken); - // Add the function to the model - subfn.name = typeToken.IdentifierStr; - model.functions.push_back(subfn); + // Add the function to the model + subfn.name = typeToken.IdentifierStr; + model.functions.push_back(subfn); return true; } @@ -669,7 +674,7 @@ struct Parser structUnions.emplace(su.name, model.structUnions.size()); model.structUnions.push_back(su); } - + if (!isToken(Lexer::tok_semic)) { errLine(curToken(), "expected semicolon!");