Lines Matching defs:cursor

6 //! [`Cursor`] type. `Cursor` is a cheaply copyable cursor over a range of
249 // cursor derived from this `cell` is ever assigned to this `cell`.
256 // Cursor<'a> and trusts that it lives as long as the cursor currently in
265 if let Some(unexpected_span) = span_of_unexpected_ignoring_nones(self.cursor()) {
276 Display::fmt(&self.cursor().token_stream(), f)
282 Debug::fmt(&self.cursor().token_stream(), f)
303 /// input.step(|cursor| {
304 /// let mut rest = *cursor;
313 /// Err(cursor.error("no `@` was found after this point"))
333 cursor: Cursor<'c>,
349 &self.cursor
367 error::new_at(self.scope, self.cursor, message)
382 cursor: Cursor,
388 cell: Cell::new(unsafe { mem::transmute::<Cursor, Cursor<'static>>(cursor) }),
440 fn span_of_unexpected_ignoring_nones(mut cursor: Cursor) -> Option<Span> {
441 if cursor.eof() {
444 while let Some((inner, _span, rest)) = cursor.group(Delimiter::None) {
448 cursor = rest;
450 if cursor.eof() {
453 Some(cursor.span())
578 T::Token::peek(self.cursor())
617 if let Some(group) = buffer.cursor().group(Delimiter::None) {
622 buffer.cursor().skip().map_or(false, peek)
632 if let Some(group) = buffer.cursor().group(Delimiter::None) {
638 .cursor()
790 self.cursor().eof()
835 lookahead::new(self.scope, self.cursor())
1004 error::new_at(self.scope, self.cursor(), message)
1025 /// input.step(|cursor| {
1026 /// let mut rest = *cursor;
1035 /// Err(cursor.error("no `@` was found after this point"))
1075 cursor: self.cell.get(),
1086 let cursor = self.cursor();
1087 if cursor.eof() {
1090 crate::buffer::open_span_of_group(cursor)
1097 /// Cursors are immutable so no operations you perform against the cursor
1113 /// let begin = input.cursor();
1115 /// let end = input.cursor();
1124 /// let mut cursor = begin;
1126 /// while cursor < end {
1127 /// let (token, next) = cursor.token_tree().unwrap();
1129 /// cursor = next;
1151 pub fn cursor(&self) -> Cursor<'a> {
1173 if T::peek(input.cursor()) {
1184 input.step(|cursor| Ok((cursor.token_stream(), Cursor::empty())))
1191 input.step(|cursor| match cursor.token_tree() {
1193 None => Err(cursor.error("expected token tree")),
1201 input.step(|cursor| {
1202 if let Some((group, rest)) = cursor.any_group_token() {
1207 Err(cursor.error("expected group token"))
1215 input.step(|cursor| match cursor.punct() {
1217 None => Err(cursor.error("expected punctuation token")),
1225 input.step(|cursor| match cursor.literal() {
1227 None => Err(cursor.error("expected literal token")),
1280 let cursor = tokens.begin();
1282 new_parse_buffer(scope, cursor, unexpected)
1296 if let Some(unexpected_span) = span_of_unexpected_ignoring_nones(state.cursor()) {
1306 let cursor = buf.begin();
1308 let state = new_parse_buffer(scope, cursor, unexpected);
1311 if let Some(unexpected_span) = span_of_unexpected_ignoring_nones(state.cursor()) {