Program Listing for File ZagalaSpecZagalaSpecParser.h#
↰ Return to documentation for file (ZagalaSpecImportExport/Public/Parsers/ZagalaSpecZagalaSpecParser.h)
// Copyright (c) 2026, Zagala Game Solutions. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "IR/ZagalaSpecFeatureIR.h"
#include "Parsers/ZagalaSpecBDDParser.h"
class ZAGALASPECIMPORTEXPORT_API FZagalaSpecZagalaSpecParser : public IZagalaSpecBDDParser
{
private:
enum class EStepTarget : uint8
{
None,
SharedContextExtensions,
ContextExtensions,
ScenarioSteps,
};
public:
FZagalaSpecZagalaSpecParser();
virtual FZagalaSpecParseResult ParseFile(const FString& FilePath) const override;
virtual FZagalaSpecParseResult ParseContent(const FString& Content, const FString& SourceName = TEXT("<inline>")) const override;
private:
bool TryParseTags(const FString& Line, TArray<FString>& PendingTags) const;
bool TryParseFeatureSection(const FString& Line, TArray<FString>& PendingTags, TOptional<FZagalaSpecFeatureIR>& CurrentFeature, TOptional<FZagalaSpecScenarioIR>& CurrentScenario, EStepTarget& StepTarget, FZagalaSpecParseResult& Result) const;
bool TrySetSharedContextExtensionsStepTarget(const FString& Line, FZagalaSpecZagalaSpecParser::EStepTarget& StepTarget) const;
bool TryParseScenarioSection(const FString& Line, TArray<FString>& PendingTags, TOptional<FZagalaSpecFeatureIR>& CurrentFeature, TOptional<FZagalaSpecScenarioIR>& CurrentScenario, EStepTarget& StepTarget) const;
bool TryParseScenarioContextExtensionsSection(const FString& Line, TOptional<FZagalaSpecScenarioIR>& CurrentScenario, EStepTarget& StepTarget, FZagalaSpecParseResult& Result, const FString& SourceName) const;
bool TryParseExpectationsSection(const FString& Line, TOptional<FZagalaSpecScenarioIR>& CurrentScenario, EStepTarget& StepTarget, FZagalaSpecParseResult& Result, const FString& SourceName) const;
bool TryParseStepsSection(const FString& Line, TOptional<FZagalaSpecFeatureIR>& CurrentFeature, TOptional<FZagalaSpecScenarioIR>& CurrentScenario, EStepTarget& StepTarget, FZagalaSpecParseResult& Result, const FString& SourceName) const;
EZagalaSpecStepIRPhase KeywordToPhase(const FString& Keyword) const;
bool LineIsStep(const FString& TrimmedLine) const;
FZagalaSpecStepIR ParseStepLine(const FString& TrimmedLine) const;
void FlushCurrentScenario(TOptional<FZagalaSpecScenarioIR>& CurrentScenario, TOptional<FZagalaSpecFeatureIR>& CurrentFeature) const;
const FString DisabledIdentifier;
const FString FeatureIdentifier;
const FString SharedContextExtensionsIdentifier;
const FString ScenarioIdentifier;
const FString ScenarioContextExtensionsIdentifier;
const FString ScenarioExpectationsIdentifier;
const int32 FeatureIdentifierLength;
const int32 ScenarioIdentifierLength;
const TArray<FString> StepKeywords;
};