@@ -39,6 +39,10 @@ public Optional<Integer> pointer() {
39
39
public Optional <String > pointerSpace () {
40
40
return Optional .empty ();
41
41
}
42
+
43
+ public String toString () {
44
+ return "" ;
45
+ }
42
46
};
43
47
44
48
public PositionBridge (SourcePosition pos , SourceFile src ) {
@@ -116,4 +120,58 @@ public Optional<String> pointerSpace() {
116
120
result .append (lineContent .charAt (i ) == '\t' ? '\t' : ' ' );
117
121
return Optional .of (result .toString ());
118
122
}
123
+
124
+ @ Override
125
+ public String toString () {
126
+ return pos .toString ();
127
+ }
128
+
129
+ @ Override
130
+ public Optional <Integer > startOffset () {
131
+ if (src .content ().length == 0 )
132
+ return Optional .empty ();
133
+ else
134
+ return Optional .of (pos .start ());
135
+ }
136
+
137
+ @ Override
138
+ public Optional <Integer > endOffset () {
139
+ if (src .content ().length == 0 )
140
+ return Optional .empty ();
141
+ else
142
+ return Optional .of (pos .end ());
143
+ }
144
+
145
+ @ Override
146
+ public Optional <Integer > startLine () {
147
+ if (src .content ().length == 0 )
148
+ return Optional .empty ();
149
+ else
150
+ return Optional .of (pos .startLine () + 1 );
151
+ }
152
+
153
+ @ Override
154
+ public Optional <Integer > endLine () {
155
+ if (src .content ().length == 0 )
156
+ return Optional .empty ();
157
+ else
158
+ return Optional .of (pos .endLine () + 1 );
159
+ }
160
+
161
+ @ Override
162
+ public Optional <Integer > startColumn () {
163
+ if (src .content ().length == 0 )
164
+ return Optional .empty ();
165
+ else
166
+ return Optional .of (pos .startColumn ());
167
+ }
168
+
169
+ @ Override
170
+ public Optional <Integer > endColumn () {
171
+ if (src .content ().length == 0 )
172
+ return Optional .empty ();
173
+ else
174
+ return Optional .of (pos .endColumn ());
175
+ }
176
+
119
177
}
0 commit comments