YamlDotNet.Core.Scanner.ScanDirectiveName C# (CSharp) Method

ScanDirectiveName() private method

Scan the directive name. Scope: %YAML 1.1 # a comment \n ^^^^ %TAG !yaml! tag:yaml.org,2002: \n ^^^
private ScanDirectiveName ( YamlDotNet.Core.Mark start ) : string
start YamlDotNet.Core.Mark
return string
        private string ScanDirectiveName(Mark start)
        {
            var name = new StringBuilder();

            // Consume the directive name.

            while (analyzer.IsAlphaNumericDashOrUnderscore())
            {
                name.Append(ReadCurrentCharacter());
            }

            // Check if the name is empty.

            if (name.Length == 0)
            {
                throw new SyntaxErrorException(start, cursor.Mark(), "While scanning a directive, could not find expected directive name.");
            }

            // Check for an blank character after the name.

            if (!analyzer.IsWhiteBreakOrZero())
            {
                throw new SyntaxErrorException(start, cursor.Mark(), "While scanning a directive, find unexpected non-alphabetical character.");
            }

            return name.ToString();
        }