U:RDoc::NormalClass[iI"StringScanner:ET@I" Object;To:RDoc::Markup::Document: @parts[o;;[&o:RDoc::Markup::Paragraph;[I"RStringScanner provides for lexical scanning operations on a String. Here is ;TI"an example of its usage:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim;[I"8s = StringScanner.new('This is an example string') ;TI"%s.eos? # -> false ;TI" ;TI"&p s.scan(/\w+/) # -> "This" ;TI"#p s.scan(/\w+/) # -> nil ;TI"#p s.scan(/\s+/) # -> " " ;TI"#p s.scan(/\s+/) # -> nil ;TI"$p s.scan(/\w+/) # -> "is" ;TI"%s.eos? # -> false ;TI" ;TI"#p s.scan(/\s+/) # -> " " ;TI"$p s.scan(/\w+/) # -> "an" ;TI"#p s.scan(/\s+/) # -> " " ;TI")p s.scan(/\w+/) # -> "example" ;TI"#p s.scan(/\s+/) # -> " " ;TI"(p s.scan(/\w+/) # -> "string" ;TI"$s.eos? # -> true ;TI" ;TI"#p s.scan(/\s+/) # -> nil ;TI"#p s.scan(/\w+/) # -> nil ;T: @format0o; ;[ I"PScanning a string means remembering the position of a scan pointer, ;TI"Pwhich is just an index. The point of scanning is to move forward a bit at ;TI"Oa time, so matches are sought after the scan pointer; usually immediately ;TI"after it.;T@o; ;[I"IGiven the string "test string", here are the pertinent scan pointer ;TI"positions:;T@o; ;[I" t e s t s t r i n g ;TI"0 1 2 ... 1 ;TI" 0 ;T; 0o; ;[ I"OWhen you #scan for a pattern (a regular expression), the match must occur ;TI"Pat the character after the scan pointer. If you use #scan_until, then the ;TI"Omatch can occur anywhere after the scan pointer. In both cases, the scan ;TI"Ppointer moves just beyond the last character of the match, ready to ;TI"Nscan again from the next character onwards. This is demonstrated by the ;TI"example above.;T@S:RDoc::Markup::Heading: leveli: textI"Method Categories;T@o; ;[ I"PThere are other methods besides the plain scanners. You can look ahead in ;TI"Rthe string without actually scanning. You can access the most recent match. ;TI"NYou can modify the string being scanned, reset or terminate the scanner, ;TI"Pfind out or change the position of the scan pointer, skip ahead, and so on.;T@S; ;i;I"Advancing the Scan Pointer;T@o:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0;[o; ;[I" #getch;To;;0;[o; ;[I"#get_byte;To;;0;[o; ;[I" #scan;To;;0;[o; ;[I"#scan_until;To;;0;[o; ;[I" #skip;To;;0;[o; ;[I"#skip_until;T@S; ;i;I"Looking Ahead;T@o;;;;[ o;;0;[o; ;[I" #check;To;;0;[o; ;[I"#check_until;To;;0;[o; ;[I" #exist?;To;;0;[o; ;[I" #match?;To;;0;[o; ;[I" #peek;T@S; ;i;I"Finding Where we Are;T@o;;;;[ o;;0;[o; ;[I" #beginning_of_line? (#bol?);To;;0;[o; ;[I" #eos?;To;;0;[o; ;[I" #rest?;To;;0;[o; ;[I"#rest_size;To;;0;[o; ;[I" #pos;T@S; ;i;I"Setting Where we Are;T@o;;;;[o;;0;[o; ;[I" #reset;To;;0;[o; ;[I"#terminate;To;;0;[o; ;[I" #pos=;T@S; ;i;I"Match Data;T@o;;;;[ o;;0;[o; ;[I" #matched;To;;0;[o; ;[I"#matched?;To;;0;[o; ;[I"#matched_size;To;;0;[o;;: LABEL;[o;;[I";T;[@o;;0;[o; ;[I"#pre_match;To;;0;[o; ;[I"#post_match;T@S; ;i;I"Miscellaneous;T@o;;;;[ o;;0;[o; ;[I"<<;To;;0;[o; ;[I" #concat;To;;0;[o; ;[I" #string;To;;0;[o; ;[I" #string=;To;;0;[o; ;[I" #unscan;T@o; ;[I"1There are aliases to several of the methods.;T: @fileI"ext/strscan/strscan.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[I"must_C_version;TI"ext/strscan/strscan.c;T[I"new;T@[:protected[[: private[[I" instance;T[[;[/[I"<<;T@[I"[];T@[I"beginning_of_line?;T@[I" charpos;T@[I" check;T@[I"check_until;T@[I" clear;T@[I" concat;T@[I" empty?;T@[I" eos?;T@[I" exist?;T@[I" get_byte;T@[I" getbyte;T@[I" getch;T@[I" inspect;T@[I" match?;T@[I" matched;T@[I" matched?;T@[I"matched_size;T@[I" peek;T@[I" peep;T@[I" pointer;T@[I" pointer=;T@[I"pos;T@[I" pos=;T@[I"post_match;T@[I"pre_match;T@[I" reset;T@[I" rest;T@[I" rest?;T@[I"rest_size;T@[I" restsize;T@[I" scan;T@[I"scan_full;T@[I"scan_until;T@[I"search_full;T@[I" skip;T@[I"skip_until;T@[I" string;T@[I" string=;T@[I"terminate;T@[I" unscan;T@[;[[;[[I"initialize_copy;T@[[U:RDoc::Context::Section[i0o;;[;0;0[@ö@öcRDoc::TopLevel