Changeset e97c5d05 for perl/lib/BarnOwl/Completion
- Timestamp:
- Sep 30, 2009, 1:02:36 AM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- b06a888
- Parents:
- 9e5b5fd
- git-author:
- Nelson Elhage <nelhage@mit.edu> (09/14/09 09:57:55)
- git-committer:
- David Benjamin <davidben@mit.edu> (09/30/09 01:02:36)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Completion/Context.pm
r7be5d8b re97c5d05 40 40 41 41 use base qw(Class::Accessor::Fast); 42 use Carp qw(croak); 42 43 43 44 __PACKAGE__->mk_ro_accessors(qw(line point words word word_point … … 64 65 }; 65 66 return bless($self, $class); 67 } 68 69 =head2 shift_words N 70 71 Returns a new C<Context> object, with the leading C<N> words 72 stripped. All fields are updated as appopriate. If C<N> > C<< 73 $self->word >>, C<croak>s with an error message. 74 75 =cut 76 77 sub shift_words { 78 my $self = shift; 79 my $n = shift; 80 81 if($n > $self->word) { 82 croak "Context::shift: Unable to shift $n words"; 83 } 84 85 my $before = substr($self->line, 0, $self->point); 86 my $after = substr($self->line, $self->point); 87 88 return BarnOwl::Completion::Context->new(BarnOwl::skiptokens($before, $n), 89 $after); 66 90 } 67 91
Note: See TracChangeset
for help on using the changeset viewer.