diff options
author | Hans Bolinder <[email protected]> | 2019-03-12 12:26:03 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-03-20 15:26:35 +0100 |
commit | 8b7312b1a8b8b0177693a8a7aa29083ddbef5f34 (patch) | |
tree | c117de5152c842e77155ff2ada4cb3104162986f /lib/stdlib/src | |
parent | 0ffc8346553a5fc9322a75d4d8be5417dad67f29 (diff) | |
download | otp-8b7312b1a8b8b0177693a8a7aa29083ddbef5f34.tar.gz otp-8b7312b1a8b8b0177693a8a7aa29083ddbef5f34.tar.bz2 otp-8b7312b1a8b8b0177693a8a7aa29083ddbef5f34.zip |
stdlib: Fix a bug in string:lexemes()
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/string.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/stdlib/src/string.erl b/lib/stdlib/src/string.erl index 2939e78d9d..1f8bdc5432 100644 --- a/lib/stdlib/src/string.erl +++ b/lib/stdlib/src/string.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2018. All Rights Reserved. +%% Copyright Ericsson AB 1996-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -1247,18 +1247,20 @@ split_1(Bin, [_C|_]=Needle, Start, Where, Curr0, Acc) -> end end. -lexemes_m([CP|_]=Cs0, {GCs,CPs,_}=Seps, Ts) when is_integer(CP) -> +lexemes_m([CP|_]=Cs0, {GCs,CPs,_}=Seps0, Ts) when is_integer(CP) -> case lists:member(CP, CPs) of true -> [GC|Cs2] = unicode_util:gc(Cs0), case lists:member(GC, GCs) of true -> - lexemes_m(Cs2, Seps, Ts); + lexemes_m(Cs2, Seps0, Ts); false -> + Seps = search_compile(Seps0), {Lexeme,Rest} = lexeme_pick(Cs0, Seps, []), lexemes_m(Rest, Seps, [Lexeme|Ts]) end; false -> + Seps = search_compile(Seps0), {Lexeme,Rest} = lexeme_pick(Cs0, Seps, []), lexemes_m(Rest, Seps, [Lexeme|Ts]) end; |