Пример #1
0
        protected LexerBase(SpecialTokenConfig specialTokens, IReadOnlyList <MatchableTokenKindSpec> tokenKindSpecs)
        {
            ArgumentCheck.NotNullOrEmptyOrWithNulls(tokenKindSpecs, nameof(tokenKindSpecs));

            var tokenKinds = new List <MatchableTokenKind>(tokenKindSpecs.Count);

            foreach (var tokenKindSpec in tokenKindSpecs)
            {
                var tokenKind = tokenKindSpec.TokenKind;

                tokenKinds.Add(tokenKind);

                if (tokenKindSpec.Skipped)
                {
                    SkippableTokenKinds.Add(tokenKind);
                }
            }

            TokenKinds = tokenKinds;

            _unknown = specialTokens?.Unknown ?? TokenKind.Unknown;
        }
Пример #2
0
 public SpecialTokenConfig(SpecialTokenKind unknown)
 {
     Unknown = unknown;
 }