closes #1175 The types `string_imp` and `string.iterator_imp` were supposed to be marked private, but we cannot do it because we need to provide `string_imp.mk`, `string_imp.cases_on`, `string.iterator_imp.mk` and `string.iterator_imp.cases_on` in the VM since we use a different internal representation. Note that marking them as private does not work since users can still access `string_imp.cases_on` using meta-programming. So, we need better support for private declarations. Missing feature, char literals do not support non ASCII values. That is, in the current implementation, we cannot write 'α'. This will be implemented in the future. The VM native implementation does not behave correctly for huge strings (i.e., strings with more than 4G characters). The problem is that the current implementation relies on ``` size_t force_to_size_t(vm_obj const & o, size_t def) ``` We may also have overflow problems in the string.iterator implementation code. This is not a big deal right now, since I doubt we will try to process string with more than 2^32 characters. @Kha the `core_lib` and tests seem to be working correctly, but we need more tests.
15 lines
583 B
Text
15 lines
583 B
Text
#eval ("abc" ++ "cde").length
|
||
#eval "abc".pop_back
|
||
#eval "".pop_back
|
||
#eval "abcd".pop_back
|
||
#eval ("abcd".mk_iterator.nextn 2).next_to_string
|
||
#eval ("abcd".mk_iterator.nextn 2).prev_to_string
|
||
#eval ("abcd".mk_iterator.nextn 10).next_to_string
|
||
#eval ("abcd".mk_iterator.nextn 10).prev_to_string
|
||
#eval "foo.lean".popn_back 5
|
||
#eval "foo.lean".backn 5
|
||
#eval "αβγ".pop_back
|
||
#eval "αβ".length
|
||
#eval ("αβcc".mk_iterator.next.insert "_foo_").to_string
|
||
#eval ("αβcc".mk_iterator.next.next.insert "_foo_").to_string
|
||
#eval ("αβcc".mk_iterator.next.next.prev.insert "_foo_").to_string
|