<commit_before>﻿using System;
using System.Collections.Immutable;




namespace sly.lexer

{
    public class LexerPosition : IComparable
    {

        public LexerPosition() : this (0,0,0)
        {
        }
        
        public LexerPosition(int index, int line, int column, string mode = ModeAttribute.DefaultLexerMode)
        {
            Index = index;
            Line = line;
            Column = column;
            Indentations = ImmutableStack<string>.Empty;
            Mode = mode;
        }
        
        public LexerPosition(int index, int line, int column, ImmutableStack<string> indentations, string mode = ModeAttribute.DefaultLexerMode) : this(index, line, column, mode)
        {
            Indentations = indentations;
        }
        
        public LexerPosition(int index, int line, int column, ImmutableStack<string> indentations, int currentIndentation, string mode = ModeAttribute.DefaultLexerMode) : this(index, line, column, indentations, mode)
        {
            CurrentIndentation = currentIndentation;
        }

        public bool IsStartOfLine => Column == 0;


        public ImmutableStack<string> Indentations { get; set; }
        public int CurrentIndentation { get; set; }

        public int Column { get; set; }
        public int Index { get; set; }
        public int Line { get; set; }
        
        public string Mode { get; set; }

        public override string ToString()
        {
            return $"line {Line}, column {Column}";
        }

        public int CompareTo(object obj)
        {
            if (obj != null)
            {
                if (obj is LexerPosition position)
                {
                    if (Line < position.Line)
                    {
                        return -1;
                    }
                    if (Line == position.Line)
                    {
                        return Column.CompareTo(position.Column);
                    }
                }
            }

            return 1;
        }

        public LexerPosition Clone()
        {
            return new LexerPosition(Index, Line, Column, Indentations, CurrentIndentation)
            {
                Mode = Mode<commit_msg>Update LexerPosition.cs<commit_after>﻿using System;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;

namespace sly.lexer

{
    public class LexerPosition : IComparable
    {

        public LexerPosition() : this (0,0,0)
        {
        }
        
        public LexerPosition(int index, int line, int column, string mode = ModeAttribute.DefaultLexerMode)
        {
            Index = index;
            Line = line;
            Column = column;
            Indentations = ImmutableStack<string>.Empty;
            Mode = mode;
        }
        
        public LexerPosition(int index, int line, int column, ImmutableStack<string> indentations, string mode = ModeAttribute.DefaultLexerMode) : this(index, line, column, mode)
        {
            Indentations = indentations;
        }
        
        public LexerPosition(int index, int line, int column, ImmutableStack<string> indentations, int currentIndentation, string mode = ModeAttribute.DefaultLexerMode) : this(index, line, column, indentations, mode)
        {
            CurrentIndentation = currentIndentation;
        }

        public bool IsStartOfLine => Column == 0;


        public ImmutableStack<string> Indentations { get; set; }
        public int CurrentIndentation { get; set; }

        public int Column { get; set; }
        public int Index { get; set; }
        public int Line { get; set; }
        
        public string Mode { get; set; }

        public override string ToString()
        {
            return $"line {Line}, column {Column}";
        }

        [ExcludeFromCodeCoverage]
        public int CompareTo(object obj)
        {
            if (obj != null)
            {
                if (obj is LexerPosition position)
                {
                    if (Line < position.Line)
                    {
                        return -1;
                    }
                    if (Line == position.Line)
                    {
                        return Column.CompareTo(position.Column);
                    }
                }
            }

            return 1;
        }

        public LexerPosition Clone()
        {
            return new LexerPosition(Index, Line, Column, Indentations, CurrentIndentation)
            {
                Mode = Mode
{'fraction_non_alphanumeric': 0.07890070921985816, 'fraction_numerical': 0.0026595744680851063, 'mean_word_length': 1.5058300943920044, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2981874', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1115, 'n_words': 309}