Holds a line number (Line) and a position in the line (PosInLine). This class isn't really needed in Loyc but is separated from SourcePos in case anyone might want position without a filename.
Numbering starts at one for both Line and PosInLine. Line=0 signifies nowhere in particular, or an unknown location.
Пример #1
0
 public int LineToIndex(LineAndCol pos)
 {
     if (pos is SourcePosAndIndex)
     {
         return((pos as SourcePosAndIndex).OriginalIndex);
     }
     return(_obj.LineToIndex(pos));
 }
Пример #2
0
        public override bool Equals(object obj)
        {
            LineAndCol other = obj as LineAndCol;

            if (other == null)
            {
                return(false);
            }
            return(other._line == _line && other._posInLine == _posInLine);
        }
Пример #3
0
        public int LineToIndex(LineAndCol pos)
        {
            int lineIndex = LineToIndex(pos.Line);

            if (pos.PosInLine > 0)
            {
                lineIndex += pos.PosInLine - 1;
            }
            if (_startingPos != null && pos.Line == _startingPos.Line)
            {
                return(lineIndex + (_startingPos.PosInLine - 1));
            }
            else
            {
                return(lineIndex);
            }
        }
Пример #4
0
		public int LineToIndex(LineAndCol pos)
		{
			return -1;
		}
Пример #5
0
 public int LineToIndex(LineAndCol pos)
 {
     return(-1);
 }