Exemple #1
0
        public static ImmutableList <ParserChar> ToParserChar(this IEnumerable <char> input)
        {
            int line = 1;
            int col  = 1;

            var list = new List <ParserChar>();

            foreach (var c in input)
            {
                if (c == '\r')
                {
                    continue;
                }

                list.Add(new ParserChar(c, SrcLoc.Return(line, col)));

                if (c == '\n')
                {
                    line++;
                    col = 1;
                }
                col++;
            }

            return(new ImmutableList <ParserChar>(list));
        }