1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="us-ascii"">
<title>Scanner</title>
</head>
<body bgcolor="#FFFFFF" >
<h1>StringScanner Reference Manual</h1>
<hr>
<h2>Class Methods</h2>
<dl>
<dt>new( str, dup = true )
<dd>
create new StringScanner object. 'str' is string to scan.
If DUP is true then duplicate 'str' and use it. 'str' is
going to be freezed.
</dl>
<h3>Methods</h3>
<dl>
<dt>scan( regex ): String
<dd>
tries matching with 'regex' only on the scan pointer.
If matched, advances "scan pointer" and returns matched string.
else returns nil.
<dt>skip( regex : Regexp ) : Integer
<dd>
tries matching with 'regex' only on the scan pointer.
If matched, advances "scan pointer" and returns matched length.
else return nil.
<dt>match?( regex: Regexp ): Integer
<dd>
tries matching with 'regex' only on the scan pointer.
If matched, keep "scan pointer" un-touched and returns matched length.
else return nil.
<dt>check( regex ): String
<dd>
tries matching with 'regex' only on the scan pointer.
If matched, keep "scan pointer" un-touched and returns matched string.
<dt>scan_until( regex )
<dd>
same to "scan" except this method tries matching not only
on the scan pointer.
<dt>skip_until( regex )
<dd>
same to "skip" except this method tries matching not only
on the scan pointer.
<dt>exist?( regex )
<dd>
same to "match?" except this method tries matching not only
on the scan pointer.
<dt>check_until( regex )
<dd>
same to "check" except this method tries matching not only
on the scan pointer.
<dt>getch : String
<dd>
returns a string on the scan pointer, which represents a one character.
also advances scan pointer.
<dt>get_byte : String
<dd>
returns a 1byte length of string from the scan pointer.
also advances scan pointer.
<dt>rest : String
<dd>
returns string after the byte which is pointed by "scan pointer".
<dt>rest? : Boolean
<dd>
true if the scan pointer is not at end.
<dt>empty
<dd>
true if the scan pointer is at end.
<dt>rest_size : Integer
<dd>
length of 'rest' string
<dt>unscan
<dd>
reset "scan pointer" to previous index.
This method is valid only once for one scanning method call.
<dt>matched
<dd>
returns matched string.
If previous scannnig had failed, raises ScanError exception.
<dt>matched_size
<dd>
returns length of matched string.
If previous scannnig had failed, raises ScanError exception.
<dt>self[n]
<dd>
returns N-th content of regexp register (indecated by paren in regex).
If previous scannnig had failed, raises ScanError exception.
<dt>pointer, pointer=(idx)
<dd>
index of the scan pointer.
<dt>string, string=(str)
<dd>
scanning string itself.
This string is freezed.
</dl>
<hr><p>
Copyright (c) 1999-2001 Minero Aoki
<a href="mailto:aamine@loveruby.net"> <aamine@loveruby.net></a>
</body>
</html>
|