lib: fix typo and style in documentation
authorJean Privat <jean@pryen.org>
Thu, 15 Aug 2013 18:15:01 +0000 (14:15 -0400)
committerJean Privat <jean@pryen.org>
Thu, 15 Aug 2013 18:15:01 +0000 (14:15 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

12 files changed:
lib/standard/collection/abstract_collection.nit
lib/standard/collection/array.nit
lib/standard/collection/hash_collection.nit
lib/standard/collection/list.nit
lib/standard/collection/range.nit
lib/standard/collection/sorter.nit
lib/standard/file.nit
lib/standard/hash.nit
lib/standard/kernel.nit
lib/standard/stream.nit
lib/standard/string.nit
lib/standard/string_search.nit

index 19416a9..8d76839 100644 (file)
@@ -20,19 +20,19 @@ import kernel
 # Instances of this class offers an iterator method.
 #
 # Collections instances can use the "for" structure:
-#        var x: Collection[U]
-#         ...
+#         var x: Collection[U]
+#         # ...
 #         for u in x do
 #             # u is a U
-#             ...
+#             # ...
 #         end
 # that is equivalent with
 #         var x: Collection[U]
-#         ...
+#         # ...
 #         var i = x.iterator
 #         while i.is_ok do
 #             var u = i.item # u is a U
-#             ...
+#             # ...
 #             i.next
 #         end
 #
@@ -53,22 +53,22 @@ interface Collection[E]
                end
        end
 
-       # Is there no item in the collection ?
+       # Is there no item in the collection?
        fun is_empty: Bool is abstract 
 
        # Number of items in the collection.
        fun length: Int is abstract
 
-       # Is `item' in the collection ?
+       # Is `item` in the collection ?
        # Comparisons are done with ==
        fun has(item: E): Bool is abstract
 
-       # Is the collection contain only `item' ?
+       # Is the collection contain only `item`?
        # Comparisons are done with ==
        # Return true if the collection is empty.
        fun has_only(item: E): Bool is abstract
 
-       # How many occurrences of `item' are in the collection ?
+       # How many occurrences of `item` are in the collection?
        # Comparisons are done with ==
        fun count(item: E): Int is abstract
 
@@ -119,11 +119,11 @@ end
 # They are mainly used with collections.
 interface Iterator[E]
        # The current item.
-       # Require `is_ok'.
+       # Require `is_ok`.
        fun item: E is abstract
 
        # Jump to the next item.
-       # Require `is_ok'.
+       # Require `is_ok`.
        fun next is abstract
 
        # Is there a current item ?
@@ -182,10 +182,10 @@ interface RemovableCollection[E]
        # Remove all items
        fun clear is abstract
 
-       # Remove an occucence of `item'
+       # Remove an occucence of `item`
        fun remove(item: E) is abstract
 
-       # Remove all occurences of `item'
+       # Remove all occurences of `item`
        fun remove_all(item: E) do while has(item) do remove(item)
 end
 
@@ -203,12 +203,12 @@ end
 # Abstract sets.
 #
 # Set contains contains only one element with the same value (according to ==).
-#    var s: Set[E]
-#    var a = "Hello"
-#    var b = "Hel" + "lo"
-#    ...
-#    s.add(a)
-#    s.has(b) # --> true
+#      var s: Set[E]
+#      var a = "Hello"
+#      var b = "Hel" + "lo"
+#      # ...
+#      s.add(a)
+#      s.has(b) # --> true
 interface Set[E: Object]
        super SimpleCollection[E]
 
@@ -238,12 +238,12 @@ interface Set[E: Object]
        redef fun remove_all(item) do remove(item)
 end
 
-# MapRead are abstract associative collections: `key' -> `item'.
+# MapRead are abstract associative collections: `key` -> `item`.
 interface MapRead[K: Object, E]
-       # Get the item at `key'.
+       # Get the item at `key`.
        fun [](key: K): E is abstract
 
-       # Depreciated alias for `keys.has'
+       # Depreciated alias for `keys.has`
        fun has_key(key: K): Bool do return self.keys.has(key)
 
        # Get a new iterator on the map.
@@ -261,12 +261,12 @@ interface MapRead[K: Object, E]
        end
 
        # Return the point of view of self on the values only.
-       # Note that `self' and `values' are views on the same data;
+       # Note that `self` and `values` are views on the same data;
        # therefore any modification of one is visible on the other.
        fun values: Collection[E] is abstract
 
        # Return the point of view of self on the keys only.
-       # Note that `self' and `keys' are views on the same data;
+       # Note that `self` and `keys` are views on the same data;
        # therefore any modification of one is visible on the other.
        fun keys: Collection[K] is abstract
 
@@ -277,35 +277,35 @@ interface MapRead[K: Object, E]
        fun length: Int is abstract
 end
 
-# Maps are associative collections: `key' -> `item'.
+# Maps are associative collections: `key` -> `item`.
 #
 # The main operator over maps is [].
 #
 #     var map: Map[U, V]
-#     ...
+#     # ...
 #     map[u1] = v1      # Associate 'v1' to 'u1'
 #     map[u2] = v2      # Associate 'v2' to 'u2'
-#     map[u1]            # -> v1
-#     map[u2]            # -> v2
+#     print map[u1]     # -> v1
+#     print map[u2]     # -> v2
 #
 # Instances of maps can be used with the for structure
 #
-#     for key, value in map do ..
+#     for key, value in map do # things with `key` and `value`
 #
-# The keys and values in the map can also be manipulated directly with the `keys' and `values' methods.
+# The keys and values in the map can also be manipulated directly with the `keys` and `values` methods.
 #
 #     map.keys.has(u1)   # -> true
 #     map.keys.has(u3)   # -> false
-#     map.values.has(v1)   # -> true
-#     map.values.has(v3)   # -> false
+#     map.values.has(v1) # -> true
+#     map.values.has(v3) # -> false
 #
 interface Map[K: Object, E]
        super MapRead[K, E]
-       # Set the`item' at `key'.
+       # Set the`item` at `key`.
        fun []=(key: K, item: E) is abstract
 
-       # Add each (key,value) of `map' into `self'.
-       # If a same key exists in `map' and `self', then the value in self is discarded.
+       # Add each (key,value) of `map` into `self`.
+       # If a same key exists in `map` and `self`, then the value in self is discarded.
        fun recover_with(map: Map[K, E])
        do
                var i = map.iterator
@@ -326,21 +326,21 @@ end
 # Iterators for Map.
 interface MapIterator[K: Object, E]
        # The current item.
-       # Require `is_ok'.
+       # Require `is_ok`.
        fun item: E is abstract
 
        # The key of the current item.
-       # Require `is_ok'.
+       # Require `is_ok`.
        fun key: K is abstract
 
        # Jump to the next item.
-       # Require `is_ok'.
+       # Require `is_ok`.
        fun next is abstract
 
        # Is there a current item ?
        fun is_ok: Bool is abstract
 
-       # Set a new `item' at `key'.
+       # Set a new `item` at `key`.
        #fun item=(item: E) is abstract
 end
 
@@ -367,11 +367,11 @@ class MapValuesIterator[K: Object, V]
 end
 
 # Sequences are indexed collections.
-# The first item is 0. The last is `length'-1.
+# The first item is 0. The last is `length-1`.
 interface SequenceRead[E]
        super Collection[E]
        # Get the first item.
-       # Is equivalent with `self'[0].
+       # Is equivalent with `self[0]`.
        redef fun first
        do
                assert not_empty: not is_empty
@@ -379,20 +379,20 @@ interface SequenceRead[E]
        end
 
        # Return the index=th element of the sequence.
-       # The first element is 0 and the last if `length-1'
+       # The first element is 0 and the last if `length-1`
        # If index is invalid, the program aborts
        fun [](index: Int): E is abstract
 
        # Get the last item.
-       # Is equivalent with `self'[`length'-1].
+       # Is equivalent with `self[length-1]`.
        fun last: E
        do
                assert not_empty: not is_empty
                return self[length-1]
        end
 
-       # Return the index of the first occurrence of `item'.
-       # Return -1 if `item' is not found
+       # Return the index of the first occurrence of `item`.
+       # Return -1 if `item` is not found
        # Comparison is done with ==
        fun index_of(item: E): Int
        do
@@ -408,18 +408,18 @@ interface SequenceRead[E]
 end
 
 # Sequence are indexed collection.
-# The first item is 0. The last is `length'-1.
+# The first item is 0. The last is `length-1`.
 interface Sequence[E]
        super SequenceRead[E]
        super SimpleCollection[E]
 
        # Set the first item.
-       # Is equivalent with `self'[0] = `item'.
+       # Is equivalent with `self[0] = item`.
        fun first=(item: E)
        do self[0] = item end
 
        # Set the last item.
-       # Is equivalent with `self'[length-1] = `item'.
+       # Is equivalent with `self[length-1] = item`.
        fun last=(item: E) 
        do 
                var l = length
@@ -430,7 +430,7 @@ interface Sequence[E]
                end
        end
 
-       # A synonym of `push'
+       # A synonym of `push`
        redef fun add(e) do push(e)
 
        # Add an item after the last.
@@ -449,10 +449,10 @@ interface Sequence[E]
        # The second item become the first.
        fun shift: E is abstract
 
-       # Set the`item' at `index'.
+       # Set the `item` at `index`.
        fun []=(index: Int, item: E) is abstract
 
-       # Remove the item at `index' and shift all following elements
+       # Remove the item at `index` and shift all following elements
        fun remove_at(index: Int) is abstract
 end
 
index fab39a9..ecb29be 100644 (file)
@@ -95,7 +95,7 @@ abstract class AbstractArrayRead[E]
                return -1
        end
 
-       # Return a new array that is the reverse of `self'
+       # Return a new array that is the reverse of `self`
        #
        #     [1,2,3].reversed # -> [3, 2, 1]
        fun reversed: Array[E]
@@ -109,7 +109,7 @@ abstract class AbstractArrayRead[E]
                return result
        end
 
-       # Copy a portion of `self' to an other array.
+       # Copy a portion of `self` to an other array.
        #
        #     var a = [1, 2, 3, 4]
        #     var b = [10, 20, 30, 40, 50]
@@ -158,7 +158,7 @@ abstract class AbstractArray[E]
        super AbstractArrayRead[E]
        super Sequence[E]
 
-       # Force the capacity to be at least `cap'.
+       # Force the capacity to be at least `cap`.
        # The capacity of the array is an internal information.
        # However, this method can be used to prepare a large amount of add
        fun enlarge(cap: Int) is abstract
@@ -327,7 +327,7 @@ class Array[E]
                self.add_all(items)
        end
 
-       # Create an array with some `items'.
+       # Create an array with some `objects`.
        init with_items(objects: E...)
        do
                _items = objects._items
@@ -344,7 +344,7 @@ class Array[E]
                _length = 0
        end
 
-       # Create an array of `count' elements
+       # Create an array of `count` elements
        init filled_with(value: E, count: Int)
        do
                assert positive: count >= 0
@@ -374,7 +374,7 @@ class Array[E]
        # FIXME: Remove it once modules can intrude non local modules
        fun intern_items: NativeArray[E] do return _items.as(not null)
 
-       # The size of `_items'.
+       # The size of `_items`.
        var _capacity: Int = 0
 
        # Sort the array using the !cmp function.
@@ -384,7 +384,7 @@ class Array[E]
                sub_sort(0, length-1) !cmp(x,y) = cmp(x, y)
        end
 
-       # Sort `array' between `from' and `to' indices
+       # Sort `array` between `from` and `to` indices
        private fun sub_sort(from: Int, to: Int)
                !cmp(e1,e2: E): Int
        do
@@ -430,7 +430,7 @@ class Array[E]
        end
 end
 
-# An `Iterator' on `AbstractArray'
+# An `Iterator` on `AbstractArray`
 class ArrayIterator[E]
        super IndexedIterator[E]
 
@@ -487,7 +487,7 @@ class ArraySet[E: Object]
 
        redef fun iterator do return new ArraySetIterator[E](_array.iterator)
 
-       # Assume the capacity is at least `cap'.
+       # Assume the capacity is at least `cap`.
        fun enlarge(cap: Int) do _array.enlarge(cap)
 
        private fun remove_at(i: Int)
@@ -557,7 +557,7 @@ class ArrayMap[K: Object, E]
 
        redef fun clear do _items.clear
 
-       # Assume the capacity to be at least `cap'.
+       # Assume the capacity to be at least `cap`.
        fun enlarge(cap: Int) do _items.enlarge(cap)
 
        redef fun couple_at(key)
@@ -583,7 +583,7 @@ class ArrayMap[K: Object, E]
        # The last positive result given by a index(1) call
        var _last_index: Int = 0
 
-       # Where is the `key' in `_item'?
+       # Where is the `key` in `_item`?
        # return -1 if not found
        private fun index(key: K): Int
        do
@@ -691,7 +691,7 @@ end
 # Others tools ################################################################
 
 redef class Iterator[E]
-       # Interate on `self' and build an array
+       # Interate on `self` and build an array
        fun to_a: Array[E]
        do
                var res = new Array[E]
@@ -715,7 +715,7 @@ end
 
 # Subclasses of this class can create native arrays
 interface ArrayCapable[E]
-       # Get a new array of `size' elements.
+       # Get a new array of `size` elements.
        protected fun calloc_array(size: Int): NativeArray[E] is intern
 end
 
index 0e0638a..da782d5 100644 (file)
@@ -44,7 +44,7 @@ private abstract class HashCollection[K: Object, N: HashNode[Object]]
        # Return the node assosiated with the key
        fun node_at(k: K): nullable N
        do
-               # cache: `is' is used instead of `==' because it is a faster filter (even if not exact)
+               # cache: `is` is used instead of `==` because it is a faster filter (even if not exact)
                if k is _last_accessed_key then return _last_accessed_node
 
                var res = node_at_idx(index_at(k), k)
@@ -59,7 +59,7 @@ private abstract class HashCollection[K: Object, N: HashNode[Object]]
                var c = _array[i]
                while c != null do
                        var ck = c._key
-                       if ck is k or ck == k then # prefilter with `is' because the compiler is not smart enought yet
+                       if ck is k or ck == k then # prefilter with `is` because the compiler is not smart enought yet
                                break
                        end
                        c = c._next_in_bucklet
@@ -200,7 +200,7 @@ private abstract class HashNode[K: Object]
 end
 
 # A map implemented with a hash table.
-# Keys of such a map cannot be null and require a working `hash' method
+# Keys of such a map cannot be null and require a working `hash` method
 class HashMap[K: Object, V]
        super Map[K, V]
        super HashCollection[K, HashMapNode[K, V]]
@@ -401,8 +401,8 @@ class HashMapIterator[K: Object, V]
        end
 end
 
-# A `Set' implemented with a hash table.
-# Keys of such a map cannot be null and require a working `hash' method
+# A `Set` implemented with a hash table.
+# Keys of such a map cannot be null and require a working `hash` method
 class HashSet[E: Object]
        super Set[E]
        super HashCollection[E, HashSetNode[E]]
@@ -446,7 +446,7 @@ class HashSet[E: Object]
                enlarge(0)
        end
 
-       # Build a list filled with the items of `coll'.
+       # Build a list filled with the items of `coll`.
        init from(coll: Collection[E]) do
                init
                add_all(coll)
index 3dfac41..804c629 100644 (file)
@@ -116,7 +116,7 @@ class List[E]
                _head = node
        end
 
-       # Append `l' to `self' but clear `l'.
+       # Append `l` to `self` but clear `l`.
        ##
        # O(1)
        fun link(l: List[E])
@@ -185,7 +185,7 @@ class List[E]
        # Build an empty list.
        init do end
        
-       # Build a list filled with the items of `coll'.
+       # Build a list filled with the items of `coll`.
        init from(coll: Collection[E]) do append(coll)
 
        # The first node of the list
@@ -194,7 +194,7 @@ class List[E]
        # The last node of the list
        var _tail: nullable ListNode[E]
 
-       # Get the `i'th node. get `null' otherwise.
+       # Get the `i`th node. get `null` otherwise.
        private fun get_node(i: Int): nullable ListNode[E]
        do
                var n = _head
@@ -208,7 +208,7 @@ class List[E]
                return n 
        end
 
-       # get the first node that contains e after 'after', null otherwise
+       # get the first node that contains `e` after 'after', null otherwise
        private fun search_node_after(e: E, after: nullable ListNode[E]): nullable ListNode[E]
        do
                var n = after
@@ -265,7 +265,7 @@ class ListIterator[E]
                _index += 1
        end
 
-       # Build a new iterator from `node'.
+       # Build a new iterator for `list`.
        private init(list: List[E])
        do
                _list = list
index b8545b3..9fc44aa 100644 (file)
@@ -65,8 +65,8 @@ class Range[E: Discrete]
 
        redef fun is_empty do return _first >= _after
 
-       # Create a range [`from', `to'].
-       # The syntax [`from'..`to'[ is equivalent.
+       # Create a range [`from`, `to`].
+       # The syntax `[from..to[` is equivalent.
        init(from: E, to: E)
        do
                _first = from
@@ -74,8 +74,8 @@ class Range[E: Discrete]
                _after = to.succ
        end
 
-       # Create a range [`from', `to'[.
-       # The syntax [`from'..`to'[ is equivalent.
+       # Create a range [`from`, `to`[.
+       # The syntax `[from..to[` is equivalent.
        init without_last(from: E, to: E)
        do
                _first = from
index 0b4cd39..d023374 100644 (file)
 # another product.
 
 # This module contains classes used to sorts arrays.
-# In order to provide your own sort class you should define a subclass of AbstractSorter with
-# a custom `compare' function.
+# In order to provide your own sort class you should define a subclass of `AbstractSorter` with
+# a custom `AbstractSorter::compare` function.
 package sorter
 
 import array
 
 # This abstract class generalizes ways to sort an array
-# TODO: rename *Sorter to *Comparator
+# TODO: rename `AbstractSorter` to `Comparator`
 interface AbstractSorter[E]
-       # Compare `a' and `b'.
+       # Compare `a` and `b`.
        # Returns:
        #       -1 if a < b
        #       0  if a = b
        #       1  if a > b
        fun compare(a: E, b: E): Int is abstract
 
-       # Sort `array' using the `compare' function.
+       # Sort `array` using the `compare` function.
        fun sort(array: Array[E]) do sub_sort(array, 0, array.length-1)
 
-       # Sort `array' between `from' and `to' indices
+       # Sort `array` between `from` and `to` indices
        private fun sub_sort(array: Array[E], from: Int, to: Int)
        do
                if from >= to then
@@ -42,7 +42,7 @@ interface AbstractSorter[E]
                end
        end
 
-       # Quick-sort `array' between `from' and `to' indices
+       # Quick-sort `array` between `from` and `to` indices
        private fun quick_sort(array: Array[E], from: Int, to: Int)
        do
                var pivot = array[from]
@@ -63,7 +63,7 @@ interface AbstractSorter[E]
                sub_sort(array, i, to)
        end
        
-       # Bubble-sort `array' between `from' and `to' indices
+       # Bubble-sort `array` between `from` and `to` indices
        private fun bubble_sort(array: Array[E], from: Int, to: Int)
        do
                var i = from
@@ -88,7 +88,7 @@ interface AbstractSorter[E]
 end
 
 # This class uses the operator <=> to sort arrays.
-# You can also use the `sort' method of the `Array' class.
+# You can also use the `sort` method of the `Array` class.
 class ComparableSorter[E: Comparable]
        super AbstractSorter[E]
        # Return a <=> b
index df819c4..0d8bf2e 100644 (file)
@@ -22,26 +22,26 @@ import string_search
 redef class Object
 # Simple I/O
 
-       # Print `objects' on the standard output (`stdout').
+       # Print `objects` on the standard output (`stdout`).
        protected fun printn(objects: Object...)
        do
                stdout.write(objects.to_s)
        end
 
-       # Print an `object' on the standard output (`stdout') and add a newline.
+       # Print an `object` on the standard output (`stdout`) and add a newline.
        protected fun print(object: Object)
        do
                stdout.write(object.to_s)
                stdout.write("\n")
        end
 
-       # Read a character from the standard input (`stdin').
+       # Read a character from the standard input (`stdin`).
        protected fun getc: Char
        do
                return stdin.read_char.ascii
        end
 
-       # Read a line from the standard input (`stdin').
+       # Read a line from the standard input (`stdin`).
        protected fun gets: String
        do
                return stdin.read_line
@@ -98,7 +98,7 @@ class IFStream
        # End of file?
        redef readable var _end_reached: Bool = false
 
-       # Open the file at `path' for reading.
+       # Open the file at `path` for reading.
        init open(path: String)
        do
                _path = path
@@ -133,7 +133,7 @@ class OFStream
        # Is the file open in write mode
        var _writable: Bool
        
-       # Write `len' bytes from `native'.
+       # Write `len` bytes from `native`.
        private fun write_native(native: NativeString, len: Int)
        do
                assert _writable
@@ -144,7 +144,7 @@ class OFStream
                end
        end
        
-       # Open the file at `path' for writing.
+       # Open the file at `path` for writing.
        init open(path: String)
        do
                _file = new NativeFile.io_open_write(path.to_cstring)
@@ -242,9 +242,9 @@ redef class String
        #  * the validity of the path is not checked
        #
        #     "some/./complex/../../path/from/../to/a////file//".simplify_path  # -> "path/to/a/file"
-       #     "../dir/file" # -> "../dir/file"
-       #     "dir/../../" # -> ".."
-       #     "//absolute//path/" # -> "/absolute/path"
+       #     "../dir/file".simplify_path # -> "../dir/file"
+       #     "dir/../../".simplify_path # -> ".."
+       #     "//absolute//path/".simplify_path # -> "/absolute/path"
        fun simplify_path: String
        do
                var a = self.split_with("/")
@@ -263,7 +263,7 @@ redef class String
 
        # Correctly join two path using the directory separator.
        #
-       # Using a standard "{self}/{path}" does not work when `self' is the empty string.
+       # Using a standard "{self}/{path}" does not work when `self` is the empty string.
        # This method ensure that the join is valid.
        #
        #     "hello".join_path("world") # -> "hello/world"
@@ -271,7 +271,7 @@ redef class String
        #     "".join_path("world") # -> "world"
        #     "/hello".join_path("/world") # -> "/world"
        #
-       # Note: you may want to use `simplify_path' on the result
+       # Note: you may want to use `simplify_path` on the result
        #
        # Note: I you want to join a great number of path, you can write
        #
index f8db8e6..9687ecf 100644 (file)
@@ -20,7 +20,7 @@ redef class Object
        # The hash code of the object.
        # Assuming that a == b -> a.hash == b.hash
        ##
-       # Without redefinition, it is based on the `object_id' of the instance.
+       # Without redefinition, it is based on the `object_id` of the instance.
        fun hash: Int do return object_id / 8
 end
 
index d5f10c1..dea9da5 100644 (file)
@@ -31,17 +31,17 @@ interface Object
        # The identifier is used internally to provide a hash value.
        fun object_id: Int is intern
 
-       # Return true if `self' and `other' have the same dynamic type.
+       # Return true if `self` and `other` have the same dynamic type.
        # Unless specific code, you should not use this method.
        fun is_same_type(other: Object): Bool is intern
 
-       # Have `self' and `other' the same value?
+       # Have `self` and `other` the same value?
        ##
        # The exact meaning of "same value" is let to the subclasses.
-       # Implicitly, the default implementation, is `is'
+       # Implicitly, the default implementation, is `is`
        fun ==(other: nullable Object): Bool do return self is other
 
-       # Have `self' and `other' different values?
+       # Have `self` and `other` different values?
        ##
        # != is equivalent with "not ==".
        fun !=(other: nullable Object): Bool do return not (self == other)
@@ -64,13 +64,13 @@ interface Object
        # Quit the program with a specific return code
        protected fun exit(exit_value: Int) is intern
 
-       # Return the global sys object, the only instance of the `Sys' class.
+       # Return the global sys object, the only instance of the `Sys` class.
        protected fun sys: Sys is intern
 end
 
 # The main class of the program.
-# `Sys' is a singleton class, its only instance is `sys' defined in `Object'.
-# `sys' is used to invoke methods on the program on the system.
+# `Sys` is a singleton class, its only instance is `sys` defined in `Object`.
+# `sys` is used to invoke methods on the program on the system.
 class Sys
        # Instructions outside classes implicitly redefine this method.
        fun main do end
@@ -83,21 +83,21 @@ end
 # The ancestor of class where objects are in a total order.
 # In order to work, the method '<' has to be redefined.
 interface Comparable
-       # What `self' can be compared to?
+       # What `self` can be compared to?
        type OTHER: Comparable
 
-       # Is `self' lesser than `other'?
+       # Is `self` lesser than `other`?
        fun <(other: OTHER): Bool is abstract 
 
-       # not `other' < `self'
-       # Note, the implementation must ensure that: (x<=y) == (x<y or x==y)
+       # not `other` < `self`
+       # Note, the implementation must ensure that: `(x<=y) == (x<y or x==y)`
        fun <=(other: OTHER): Bool do return not other < self
 
-       # not `self' < `other' 
-       # Note, the implementation must ensure that: (x>=y) == (x>y or x==y)
+       # not `self` < `other`
+       # Note, the implementation must ensure that: `(x>=y) == (x>y or x==y)`
        fun >=(other: OTHER): Bool do return not self < other
 
-       # `other' < `self'
+       # `other` < `self`
        fun >(other: OTHER): Bool do return other < self
 
        # -1 if <, +1 if > and 0 otherwise
@@ -119,7 +119,7 @@ interface Comparable
                return c <= self and self <= d
        end
 
-       # The maximum between `self' and `other' (prefers `self' if equals).
+       # The maximum between `self` and `other` (prefers `self` if equals).
        fun max(other: OTHER): OTHER
        do
                if self < other then
@@ -129,7 +129,7 @@ interface Comparable
                end
        end
 
-       # The minimum between `self' and `c' (prefer `self' if equals)
+       # The minimum between `self` and `c` (prefer `self` if equals)
        fun min(c: OTHER): OTHER
        do
                if c < self then
@@ -152,15 +152,16 @@ interface Discrete
        # The previous element.
        fun prec: OTHER do return self - 1
 
-       # The `i'-th successor element.
+       # The `i`-th successor element.
        fun +(i: Int): OTHER is abstract
 
-       # The `i'-th previous element.
+       # The `i`-th previous element.
        fun -(i: Int): OTHER is abstract
 
        # The distance between self and d.
-       # 10.distance(15)       # --> 5
-       # 'Z'.distance('A')     # --> 25
+       #
+       #     10.distance(15)   # --> 5
+       #     'Z'.distance('A') # --> 25
        fun distance(d: OTHER): Int
        do
                var cursor: OTHER
@@ -189,9 +190,9 @@ end
 ###############################################################################
 
 # Native Booleans.
-# `true' and `false' are the only instances.
+# `true` and `false` are the only instances.
 # Boolean are manipulated trough three special operators:
-#       `and', `or', `not'.
+#       `and`, `or`, `not`.
 # Booleans are mainly used by conditional statement and loops.
 universal Bool
        redef fun object_id is intern
@@ -216,7 +217,7 @@ universal Float
        fun *(i: Float): Float is intern
        fun /(i: Float): Float is intern
        
-       # The integer part of `self'.
+       # The integer part of `self`.
        fun to_i: Int is intern
 end
 
@@ -244,7 +245,7 @@ universal Int
        fun lshift(i: Int): Int is intern
        fun rshift(i: Int): Int is intern   
 
-       # The float equivalent of `self'
+       # The float equivalent of `self`
        fun to_f: Float is intern
 
        redef fun succ is intern
@@ -297,10 +298,10 @@ universal Int
                end
        end
 
-       # The character whose ASCII value is `self'.
+       # The character whose ASCII value is `self`.
        fun ascii: Char is intern
 
-       # Number of digits of an integer in base `b' (plus one if negative)
+       # Number of digits of an integer in base `b` (plus one if negative)
        fun digit_count(b: Int): Int
        do
                if b == 10 then return digit_count_base_10
@@ -347,8 +348,8 @@ universal Int
        end
 
        # Return the corresponding digit character
-       # If 0 <= `self' <= 9, return the corresponding character.
-       # If 10 <= `self' <= 36, return the corresponding letter [a..z].
+       # If 0 <= `self` <= 9, return the corresponding character.
+       # If 10 <= `self` <= 36, return the corresponding letter [a..z].
        fun to_c: Char
        do
                assert self >= 0 and self <= 36 # TODO plan for this
@@ -395,7 +396,7 @@ end
 
 # Native characters.
 # Characters are denoted with simple quote.
-# eg. 'a' or '\n'.
+# eg. `'a'` or `'\n'`.
 universal Char
        super Discrete
        redef type OTHER: Char
@@ -423,7 +424,7 @@ universal Char
                end
        end
 
-       # If `self' is a digit then return this digit else return -1.
+       # If `self` is a digit then return this digit else return -1.
        fun to_i: Int
        do
 
index 968cc8b..806ecee 100644 (file)
@@ -61,7 +61,7 @@ interface IStream
                return s.to_s
        end
 
-       # Read a string until the end of the line and append it to `s'.
+       # Read a string until the end of the line and append it to `s`.
        fun append_line_to(s: Buffer)
        do
                loop
@@ -195,7 +195,7 @@ abstract class BufferedIStream
        # Is the last fill_buffer reach the end 
        protected fun end_reached: Bool is abstract
 
-       # Allocate a `_buffer' for a given `capacity'.
+       # Allocate a `_buffer` for a given `capacity`.
        protected fun prepare_buffer(capacity: Int)
        do
                _buffer = new Buffer.with_capacity(capacity)
index 0f4ce26..c25f6e3 100644 (file)
@@ -35,10 +35,10 @@ abstract class AbstractString
 
        # Create a substring.
        #
-       # "abcd".substring(1, 2)        # --> "bc"
-       # "abcd".substring(-1, 2)       # --> "a"
-       # "abcd".substring(1, 0)     # --> ""
-       # "abcd".substring(2, 5)     # --> "cd"
+       #     "abcd".substring(1, 2)    # --> "bc"
+       #     "abcd".substring(-1, 2)   # --> "a"
+       #     "abcd".substring(1, 0)     # --> ""
+       #     "abcd".substring(2, 5)     # --> "cd"
        fun substring(from: Int, count: Int): String
        do
                assert count >= 0
@@ -57,21 +57,21 @@ abstract class AbstractString
                end
        end
 
-       # Create a substring from `self' beginning at the 'from' position
+       # Create a substring from `self` beginning at the `from` position
        #
-       # "abcd".substring(1)   # --> "bcd"
-       # "abcd".substring(-1)  # --> "abcd"
-       # "abcd".substring(2)     # --> "cd"
+       #     "abcd".substring_from(1)  # --> "bcd"
+       #     "abcd".substring_from(-1) # --> "abcd"
+       #     "abcd".substring_from(2)     # --> "cd"
        fun substring_from(from: Int): String
        do
                assert from < length
                return substring(from, length - from)
        end
 
-       # Does self have a substring 'str' starting from position 'pos
+       # Does self have a substring `str` starting from position `pos`?
        #
-       # "abcd".has_substring("bc",1)  # --> true
-       # "abcd".has_substring("bc",2)  # --> false
+       #     "abcd".has_substring("bc",1)      # --> true
+       #     "abcd".has_substring("bc",2)      # --> false
        fun has_substring(str: String, pos: Int): Bool
        do
                var itsindex = str.length - 1
@@ -89,36 +89,36 @@ abstract class AbstractString
                return true
        end
 
-       # Is this string prefixed by 'prefix'
+       # Is this string prefixed by `prefix`?
        #
-       # "abc".is_prefix("abcd")       # --> true
-       # "bc".is_prefix("abcd")        # --> false
+       #     "abc".has_prefix("abcd")  # --> true
+       #     "bc".has_prefix("abcd")   # --> false
        fun has_prefix(prefix: String): Bool do return has_substring(prefix,0)
 
-       # Is this string suffixed by 'suffix'
+       # Is this string suffixed by `suffix`?
        #
-       # "abcd".has_suffix("abc")      # --> false
-       # "abcd".has_suffix("bcd")      # --> true
+       #     "abcd".has_suffix("abc")  # --> false
+       #     "abcd".has_suffix("bcd")  # --> true
        fun has_suffix(suffix: String): Bool do return has_substring(suffix, length - suffix.length)
 
-       # If `self' contains only digits, return the corresponding integer
+       # If `self` contains only digits, return the corresponding integer
        fun to_i: Int
        do
                # Shortcut
                return to_s.to_cstring.atoi
        end
 
-       # If `self' contains a float, return the corresponding float
+       # If `self` contains a float, return the corresponding float
        fun to_f: Float
        do
                # Shortcut
                return to_s.to_cstring.atof
        end
 
-       # If `self' contains only digits and alpha <= 'f', return the corresponding integer.
+       # If `self` contains only digits and alpha <= 'f', return the corresponding integer.
        fun to_hex: Int do return a_to(16)
 
-       # If `self' contains only digits and letters, return the corresponding integer in a given base
+       # If `self` contains only digits and letters, return the corresponding integer in a given base
        fun a_to(base: Int) : Int
        do
                var i = 0
@@ -146,7 +146,7 @@ abstract class AbstractString
                end
        end
 
-       # Returns true if the string contains only Numeric values (and one "," or one "." character)
+       # Returns `true` if the string contains only Numeric values (and one "," or one "." character)
        fun is_numeric: Bool
        do
                var has_point_or_comma = false
@@ -165,7 +165,7 @@ abstract class AbstractString
                return true
        end
 
-       # A upper case version of `self'
+       # A upper case version of `self`
        fun to_upper: String
        do
                var s = new Buffer.with_capacity(length)
@@ -173,7 +173,7 @@ abstract class AbstractString
                return s.to_s
        end
 
-       # A lower case version of `self'
+       # A lower case version of `self`
        fun to_lower : String
        do
                var s = new Buffer.with_capacity(length)
@@ -241,14 +241,14 @@ class String
 
        # Create a substring.
        #
-       # "abcd".substring(1, 2)        # --> "bc"
-       # "abcd".substring(-1, 2)       # --> "a"
-       # "abcd".substring(1, 0)    # --> ""
-       # "abcd".substring(2, 5)    # --> "cd"
+       #     "abcd".substring(1, 2)    # --> "bc"
+       #     "abcd".substring(-1, 2)   # --> "a"
+       #     "abcd".substring(1, 0)    # --> ""
+       #     "abcd".substring(2, 5)    # --> "cd"
        #
-       # A "from" index < 0 will be replaced by 0
-       # Unless a count value is > 0 at the same time
-       # In this case, from += count and count -= from
+       # A `from` index < 0 will be replaced by 0
+       # Unless a `count` value is > 0 at the same time
+       # In this case, `from += count` and `count -= from`
        #
        redef fun substring(from: Int, count: Int): String
        do
@@ -269,11 +269,11 @@ class String
                return new String.from_substring(realFrom, realFrom + count - 1, _items)
        end
 
-       # Create a substring from `self' beginning at the 'from' position
+       # Create a substring from `self` beginning at the `from` position
        #
-       # "abcd".substring_from(1)      # --> "bcd"
-       # "abcd".substring_from(-1)     # --> "abcd"
-       # "abcd".substring_from(2)  # --> "cd"
+       #     "abcd".substring_from(1)  # --> "bcd"
+       #     "abcd".substring_from(-1) # --> "abcd"
+       #     "abcd".substring_from(2)  # --> "cd"
        #
        # As with substring, a "from" index < 0 will be replaced by 0
        #
@@ -284,10 +284,10 @@ class String
                return substring(from, _length)
        end
 
-       # Does self have a substring 'str' starting from position 'pos
+       # Does self have a substring `str` starting from position 'pos
        #
-       # "abcd".has_substring("bc",1)  # --> true
-       # "abcd".has_substring("bc",2)  # --> false
+       #     "abcd".has_substring("bc",1)      # --> true
+       #     "abcd".has_substring("bc",2)      # --> false
        redef fun has_substring(str: String, pos: Int): Bool
        do
                var itsindex = str._length - 1
@@ -312,7 +312,7 @@ class String
                return true
        end
 
-       # A upper case version of `self'
+       # A upper case version of `self`
        redef fun to_upper: String
        do
                var outstr = calloc_string(self._length + 1)
@@ -333,7 +333,7 @@ class String
                return new String.with_native(outstr, self._length)
        end
 
-       # A lower case version of `self'
+       # A lower case version of `self`
        redef fun to_lower : String
        do
                var outstr = calloc_string(self._length + 1)
@@ -472,7 +472,8 @@ class String
        end
 
        # The comparison between two strings is done on a lexicographical basis
-       # Eg : "aa" < "b" => true
+       #
+       #     "aa" < "b" # => true
        redef fun <(other)
        do
                if self.object_id == other.object_id then return false
@@ -507,7 +508,7 @@ class String
                return my_length < its_length
        end
 
-       # The concatenation of `self' with `r'
+       # The concatenation of `self` with `s`
        fun +(s: String): String
        do
                var my_length = self._length
@@ -523,7 +524,7 @@ class String
                return new String.with_native(target_string, my_length + its_length)
        end
 
-       # i repetitions of self
+       # `i` repetitions of `self`
        fun *(i: Int): String
        do
                assert i >= 0
@@ -692,7 +693,7 @@ class Buffer
                return true
        end
 
-       readable private var _capacity: Int 
+       readable private var _capacity: Int
 end
 
 ###############################################################################
@@ -700,19 +701,16 @@ end
 ###############################################################################
 
 redef class Object
-       # User readable representation of `self'.
+       # User readable representation of `self`.
        fun to_s: String do return inspect
 
        # The class name of the object in NativeString format.
        private fun native_class_name: NativeString is intern
 
        # The class name of the object.
-       # FIXME: real type information is not available at runtime.
-       # Therefore, for instance, an instance of List[Bool] has just
-       # "List" for class_name
        fun class_name: String do return new String.from_cstring(native_class_name)
 
-       # Developer readable representation of `self'.
+       # Developer readable representation of `self`.
        # Usually, it uses the form "<CLASSNAME:#OBJECTID bla bla bla>"
        fun inspect: String
        do
@@ -744,9 +742,9 @@ redef class Bool
 end
 
 redef class Int
-       fun fill_buffer(s: Buffer, base: Int, signed: Bool)
-       # Fill `s' with the digits in base 'base' of `self' (and with the '-' sign if 'signed' and negative).
+       # Fill `s` with the digits in base `base` of `self` (and with the '-' sign if 'signed' and negative).
        # assume < to_c max const of char
+       fun fill_buffer(s: Buffer, base: Int, signed: Bool)
        do
                var n: Int
                # Sign
@@ -809,7 +807,7 @@ redef class Float
                return str
        end
 
-       # `self' representation with `nb' digits after the '.'.
+       # `self` representation with `nb` digits after the '.'.
        fun to_precision(nb: Int): String
        do
                if nb == 0 then return self.to_i.to_s
@@ -887,7 +885,7 @@ redef class Collection[E]
                return s.to_s
        end
 
-       # Concatenate and separate each elements with `sep'. 
+       # Concatenate and separate each elements with `sep`.
        fun join(sep: String): String
        do
                if is_empty then return ""
@@ -929,8 +927,8 @@ end
 
 redef class Map[K,V]
        # Concatenate couple of 'key value'.
-       # key and value are separated by 'couple_sep'.
-       # each couple is separated each couple with `sep'.
+       # key and value are separated by `couple_sep`.
+       # each couple is separated each couple with `sep`.
        fun join(sep: String, couple_sep: String): String
        do
                if is_empty then return ""
@@ -997,7 +995,7 @@ redef class Sys
                return new String.from_cstring(native_argv(0))
        end
 
-       # Initialize `args' with the contents of `native_argc' and `native_argv'.
+       # Initialize `args` with the contents of `native_argc` and `native_argv`.
        private fun init_args
        do
                var argc = native_argc
index e15740d..8249bac 100644 (file)
@@ -15,18 +15,18 @@ package string_search
 
 import string
 
-# Patterns are abstract string motifs (include `String' and `Char').
+# Patterns are abstract string motifs (include `String` and `Char`).
 interface Pattern
-       # Search `self' into `s' from a certain position.
+       # Search `self` into `s` from a certain position.
        # Return the position of the first character of the matching section.
        # Return -1 if not found.
        fun search_index_in(s: String, from: Int): Int is abstract
 
-       # Search `self' into `s' from a certain position.
+       # Search `self` into `s` from a certain position.
        # Return null if not found.
        fun search_in(s: String, from: Int): nullable Match is abstract
 
-       # Search all `self' occurrences into `s'.
+       # Search all `self` occurrences into `s`.
        fun search_all_in(s: String): Array[Match]
        do
                var res = new Array[Match] # Result
@@ -38,7 +38,7 @@ interface Pattern
                return res
        end
 
-       # Split `s' using `self' is separator.
+       # Split `s` using `self` is separator.
        fun split_in(s: String): Array[Match]
        do
                var res = new Array[Match] # Result
@@ -66,7 +66,7 @@ class BM_Pattern
 
        redef fun to_s do return _motif
 
-       # boyer-moore search gives the position of the first occurrence of a pattern starting at position `from'
+       # boyer-moore search gives the position of the first occurrence of a pattern starting at position `from`
        redef fun search_index_in(s, from)
        do
                assert from >= 0
@@ -93,7 +93,7 @@ class BM_Pattern
                return -1 # found nothing
        end
 
-       # boyer-moore search. Return null if not found 
+       # boyer-moore search. Return null if not found
        redef fun search_in(s, from)
        do
                var to = search_index_in(s, from)
@@ -104,7 +104,7 @@ class BM_Pattern
                end
        end
 
-       # Compile a new motif 
+       # Compile a new motif
        init(motif: String)
        do
                _motif = motif
@@ -217,7 +217,7 @@ class Match
        # The contents of the matching part
        redef fun to_s do return _string.substring(_from, _length)
 
-       # Matches `len' characters of `s' from `f'.
+       # Matches `len` characters of `s` from `f`.
        init(s: String, f: Int, len: Int)
        do
                assert positive_length: len >= 0
@@ -281,25 +281,26 @@ redef class String
                end
        end
 
-       # Like `search_from' but from the first character.
+       # Like `search_from` but from the first character.
        fun search(p: Pattern): nullable Match do return p.search_in(self, 0)
 
        # Search the given pattern into self from a.
-       # The search starts at `from'.
+       # The search starts at `from`.
        # Return null if not found.
        fun search_from(p: Pattern, from: Int): nullable Match do return p.search_in(self, from)
 
        # Search all occurrences of p into self.
        #
-       #   var a = new Array[Int]
-       #   for i in "hello world".searches('o') do
-       #       a.add(i.from)
-       #   end
-       #   a    # -> [4, 7]
+       #     var a = new Array[Int]
+       #     for i in "hello world".search_all('o') do
+       #         a.add(i.from)
+       #     end
+       #     a    # -> [4, 7]
        fun search_all(p: Pattern): Array[Match] do return p.search_all_in(self)
 
        # Split `self` using `p` as separator.
-       #   "hello world".split('o')     # -> ["hell", " w", "rld"]
+       #
+       #     "hello world".split('o')     # -> ["hell", " w", "rld"]
        fun split(p: Pattern): Array[String]
        do
                var matches = p.split_in(self)
@@ -313,8 +314,8 @@ redef class String
 
        # Replace all occurences of a pattern with a string
        #
-       #   "hlelo".replace("le", "el") # -> "hello"
-       #   "hello".replace('l', "")    # -> "heo"
+       #     "hlelo".replace("le", "el")       # -> "hello"
+       #     "hello".replace('l', "")  # -> "heo"
        fun replace(p: Pattern, string: String): String
        do
                return self.split_with(p).join(string)
@@ -322,7 +323,7 @@ redef class String
 
        # Escape the four characters < > & and " with their html counterpart
        #
-       #    "a&b->\"x\"".html_escape # -> "a&amp;b-&gt;&quot;x&quot;"
+       #     "a&b->\"x\"".html_escape # -> "a&amp;b-&gt;&quot;x&quot;"
        fun html_escape: String
        do
                var ret = self