File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/libsyntax/parse/lexer Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,20 @@ impl<'a> StringReader<'a> {
217
217
self . with_str_from_to ( start, self . last_pos , f)
218
218
}
219
219
220
+ /// Create an Ident from a given offset to the current offset, each
221
+ /// adjusted 1 towards each other (assumes that on either side there is a
222
+ /// single-byte delimiter).
223
+ pub fn ident_from ( & self , start : BytePos ) -> ast:: Ident {
224
+ debug ! ( "taking an ident from {} to {}" , start, self . last_pos) ;
225
+ self . with_str_from ( start, str_to_ident)
226
+ }
227
+
228
+ /// As ident_from, with an explicit endpoint.
229
+ pub fn ident_from_to ( & self , start : BytePos , end : BytePos ) -> ast:: Ident {
230
+ debug ! ( "taking an ident from {} to {}" , start, end) ;
231
+ self . with_str_from_to ( start, end, str_to_ident)
232
+ }
233
+
220
234
/// Calls `f` with a string slice of the source text spanning from `start`
221
235
/// up to but excluding `end`.
222
236
fn with_str_from_to < T > ( & self , start : BytePos , end : BytePos , f: |s: & str | -> T ) -> T {
You can’t perform that action at this time.
0 commit comments