Skip to content

Commit

Permalink
Fix bug when parsing character sets in patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
rvirding committed Jun 8, 2014
1 parent fa7a134 commit 3d22db5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/luerl_lib_basic.erl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ load(As, St) ->
end.

loadfile(As, St) ->
case luerl_lib:conv_list(As, [string,lua_strinf,lua_any]) of
case luerl_lib:conv_list(As, [string,lua_string,lua_any]) of
[F|_] ->
Ret = luerl_comp:file(F), %Compile the file
load_ret(Ret, St);
Expand Down
12 changes: 8 additions & 4 deletions src/luerl_lib_string.erl
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,14 @@ char_set(Cs0, Sd, Sn, P, Tag) ->
char_set([$]|Cs]) -> char_set(Cs, [$]]); %Must special case this
char_set(Cs) -> char_set(Cs, []).

char_set([$%,C|Cs], Set) -> char_set(Cs, [char_class(C)|Set]);
char_set([C1,$-,C2|Cs], Set) when C2 =/= $] -> char_set(Cs, [{C1,C2}|Set]);
char_set([C|Cs], Set) when C =/= $] -> char_set(Cs, [C|Set]);
char_set(Cs, Set) -> {Set,Cs}.
char_set([$]|_]=Cs, Set) -> {Set,Cs}; %We are at the end
char_set([$%,C|Cs], Set) ->
char_set(Cs, [char_class(C)|Set]);
char_set([C1,$-,C2|Cs], Set) when C2 =/= $] ->
char_set(Cs, [{C1,C2}|Set]);
char_set([C|Cs], Set) ->
char_set(Cs, [C|Set]);
char_set([], Set) -> {Set,[]}. %We are at the end

%% char_class([$f,$[|Cs], Sd, Sn, P) ->
%% char_set(Cs, Sd, Sn, [frontier|P]);
Expand Down

0 comments on commit 3d22db5

Please sign in to comment.