MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / Cursor

Class Cursor

tests/external/gmock-1.7.0/gtest/scripts/pump.py:87–128  ·  view source on GitHub ↗

Represents a position (line and column) in a text file.

Source from the content-addressed store, hash-verified

85
86
87class Cursor:
88 """Represents a position (line and column) in a text file."""
89
90 def __init__(self, line=-1, column=-1):
91 self.line = line
92 self.column = column
93
94 def __eq__(self, rhs):
95 return self.line == rhs.line and self.column == rhs.column
96
97 def __ne__(self, rhs):
98 return not self == rhs
99
100 def __lt__(self, rhs):
101 return self.line < rhs.line or (
102 self.line == rhs.line and self.column < rhs.column)
103
104 def __le__(self, rhs):
105 return self < rhs or self == rhs
106
107 def __gt__(self, rhs):
108 return rhs < self
109
110 def __ge__(self, rhs):
111 return rhs <= self
112
113 def __str__(self):
114 if self == Eof():
115 return 'EOF'
116 else:
117 return '%s(%s)' % (self.line + 1, self.column)
118
119 def __add__(self, offset):
120 return Cursor(self.line, self.column + offset)
121
122 def __sub__(self, offset):
123 return Cursor(self.line, self.column - offset)
124
125 def Clone(self):
126 """Returns a copy of self."""
127
128 return Cursor(self.line, self.column)
129
130
131# Special cursor to indicate the end-of-file.

Callers 8

__add__Method · 0.85
__sub__Method · 0.85
CloneMethod · 0.85
EofFunction · 0.85
FindFirstFunction · 0.85
SubStringFunction · 0.85
TokenizeLinesFunction · 0.85
TokenizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected