Exemplo n.º 1
0
        protected static BadTokenWithPositionContext TokenDetails <TToken>(
            Token <TToken> token,
            ITextIndexHelper translator)
        {
            var location = translator?.LinePosition(token.StartIndex);

            return(new BadTokenWithPositionContext(
                       token.Type.ToString(),
                       token.Value,
                       token.StartIndex,
                       location));
        }
Exemplo n.º 2
0
        protected static IList <BadTokenWithPositionContext> TokenDetails(
            IList <BadToken> tokens,
            ITextIndexHelper translator)
        {
            var details = new BadTokenWithPositionContext[tokens.Count];

            for (int i = 0; i < details.Length; ++i)
            {
                var baseDetails = tokens[i];
                var location    = translator?.LinePosition(baseDetails.StartIndex);

                details[i] = new BadTokenWithPositionContext(baseDetails, location);
            }

            return(details);
        }