Server IP : 66.29.132.122 / Your IP : 18.217.145.189 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/ruby18/share/ri/1.8/system/StringScanner/Error/ |
Upload File : |
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: [] comment: - !ruby/struct:SM::Flow::P body: "Document-class: StringScanner" - !ruby/struct:SM::Flow::P body: "StringScanner provides for lexical scanning operations on a String. Here is an example of its usage:" - !ruby/struct:SM::Flow::VERB body: " s = StringScanner.new('This is an example string')\n s.eos? # -> false\n\n p s.scan(/\\w+/) # -> "This"\n p s.scan(/\\w+/) # -> nil\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\s+/) # -> nil\n p s.scan(/\\w+/) # -> "is"\n s.eos? # -> false\n\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "an"\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "example"\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "string"\n s.eos? # -> true\n\n p s.scan(/\\s+/) # -> nil\n p s.scan(/\\w+/) # -> nil\n" - !ruby/struct:SM::Flow::P body: Scanning a string means remembering the position of a <em>scan pointer</em>, which is just an index. The point of scanning is to move forward a bit at a time, so matches are sought after the scan pointer; usually immediately after it. - !ruby/struct:SM::Flow::P body: "Given the string "test string", here are the pertinent scan pointer positions:" - !ruby/struct:SM::Flow::VERB body: " t e s t s t r i n g\n 0 1 2 ... 1\n 0\n" - !ruby/struct:SM::Flow::P body: "When you #scan for a pattern (a regular expression), the match must occur at the character after the scan pointer. If you use #scan_until, then the match can occur anywhere after the scan pointer. In both cases, the scan pointer moves <em>just beyond</em> the last character of the match, ready to scan again from the next character onwards. This is demonstrated by the example above." - !ruby/struct:SM::Flow::H level: 2 text: Method Categories - !ruby/struct:SM::Flow::P body: There are other methods besides the plain scanners. You can look ahead in the string without actually scanning. You can access the most recent match. You can modify the string being scanned, reset or terminate the scanner, find out or change the position of the scan pointer, skip ahead, and so on. - !ruby/struct:SM::Flow::H level: 3 text: Advancing the Scan Pointer - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#getch" - !ruby/struct:SM::Flow::LI label: "-" body: "#get_byte" - !ruby/struct:SM::Flow::LI label: "-" body: "#scan" - !ruby/struct:SM::Flow::LI label: "-" body: "#scan_until" - !ruby/struct:SM::Flow::LI label: "-" body: "#skip" - !ruby/struct:SM::Flow::LI label: "-" body: "#skip_until" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Looking Ahead - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#check" - !ruby/struct:SM::Flow::LI label: "-" body: "#check_until" - !ruby/struct:SM::Flow::LI label: "-" body: "#exist?" - !ruby/struct:SM::Flow::LI label: "-" body: "#match?" - !ruby/struct:SM::Flow::LI label: "-" body: "#peek" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Finding Where we Are - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#beginning_of_line? (#bol?)" - !ruby/struct:SM::Flow::LI label: "-" body: "#eos?" - !ruby/struct:SM::Flow::LI label: "-" body: "#rest?" - !ruby/struct:SM::Flow::LI label: "-" body: "#rest_size" - !ruby/struct:SM::Flow::LI label: "-" body: "#pos" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Setting Where we Are - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#reset" - !ruby/struct:SM::Flow::LI label: "-" body: "#terminate" - !ruby/struct:SM::Flow::LI label: "-" body: "#pos=" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Match Data - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#matched" - !ruby/struct:SM::Flow::LI label: "-" body: "#matched?" - !ruby/struct:SM::Flow::LI label: "-" body: "#matched_size" - !ruby/struct:SM::Flow::LI label: "-" body: "[]" - !ruby/struct:SM::Flow::LI label: "-" body: "#pre_match" - !ruby/struct:SM::Flow::LI label: "-" body: "#post_match" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Miscellaneous - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "<<" - !ruby/struct:SM::Flow::LI label: "-" body: "#concat" - !ruby/struct:SM::Flow::LI label: "-" body: "#string" - !ruby/struct:SM::Flow::LI label: "-" body: "#string=" - !ruby/struct:SM::Flow::LI label: "-" body: "#unscan" type: :BULLET - !ruby/struct:SM::Flow::P body: There are aliases to several of the methods. constants: [] full_name: StringScanner::Error includes: [] instance_methods: [] name: Error superclass: StandardError