Files
TextParser/TextParser/Schema/BuildingBlocks/StringBlock.cs
Simon Diesenreiter d41d9f1791
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 28s
CI / tests_linux (9.0.X, ubuntu-latest) (push) Successful in 1m16s
Revert "feat: add two dimensional data walker, refs: NOISSUE"
This reverts commit 414c74be84.
2025-10-26 19:16:29 +01:00

50 lines
1.1 KiB
C#

namespace Parsing.Schema.BuildingBlocks;
using Parsing.Tokenization;
class StringBlock : BuildingBlockBase
{
public StringBlock()
{
}
public override List<IToken> ParseWord(InputProvider inputs)
{
return new List<IToken>() { new StringToken(inputs.YieldWord()) };
}
public override bool CanParseWord(InputProvider inputs)
{
string word = string.Empty;
using (inputs.GetLookaheadContext())
{
word = inputs.YieldWord();
}
return this.CanParseWord(word);
}
public override bool CanParseWord(string word)
{
// Here we need to ensure we are not matching any non-string tokens, since string can match pretty much anything
LongBlock longBlock = new LongBlock();
if (longBlock.CanParseWord(word))
{
return false;
}
IntegerBlock intBlock = new IntegerBlock();
if (intBlock.CanParseWord(word))
{
return false;
}
return true;
}
public override BlockType GetBlockType()
{
return BlockType.String;
}
}