#
# assert 'A'.is_whitespace == false
# assert ','.is_whitespace == false
- # assert ' '.is_whitespace == true
+ # assert ' '.is_whitespace == true # space
+ # assert ' '.is_whitespace == true # non-breaking space
# assert '\t'.is_whitespace == true
fun is_whitespace: Bool
do
var i = code_point
- return i <= 0x20 or i == 0x7F
+ return i <= 0x20 or i == 0x7F or i == 0xA0
end
end
# Pointer classes are used to manipulate extern C structures.
extern class Pointer
+ # C `NULL` pointer
+ new nul `{ return NULL; `}
+
# Is the address behind this Object at NULL?
fun address_is_null: Bool `{ return self == NULL; `}
# Free the memory pointed by this pointer
fun free `{ free(self); `}
+
+ # Use the address value
+ redef fun hash `{ return (long)(intptr_t)self; `}
+
+ # Is equal to any instance pointing to the same address
+ redef fun ==(o) do return o isa Pointer and native_equals(o)
+ private fun native_equals(o: Pointer): Bool `{ return self == o; `}
end
# Task with a `main` method to be implemented by subclasses
# Main method of this task
fun main do end
end
+
+# Is this program currently running in a Windows OS?
+fun is_windows: Bool `{
+#ifdef _WIN32
+ return 1;
+#else
+ return 0;
+#endif
+`}