aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/parsetools/src/yecc.erl8
-rw-r--r--lib/parsetools/test/yecc_SUITE.erl34
2 files changed, 37 insertions, 5 deletions
diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl
index 7fb6aae31a..c4a47d008f 100644
--- a/lib/parsetools/src/yecc.erl
+++ b/lib/parsetools/src/yecc.erl
@@ -2006,14 +2006,16 @@ output_actions(St0, StateJumps, StateInfo) ->
%% Not all the clauses of the dispatcher function yeccpars2() can
%% be reached. Only when shifting, that is, calling yeccpars1(),
%% will yeccpars2() be called.
- Y2CL = [NewState || {_State,{Actions,_J}} <- StateJumps,
- {_LA, #shift{state = NewState}} <- Actions],
+ Y2CL = [NewState || {_State,{Actions,J}} <- StateJumps,
+ {_LA, #shift{state = NewState}} <-
+ (Actions
+ ++ [A || {_Tag,_To,Part} <- [J], A <- Part])],
Y2CS = ordsets:from_list([0 | Y2CL]),
Y2S = ordsets:from_list([S || {S,_} <- StateJumps]),
NY2CS = ordsets:subtract(Y2S, Y2CS),
Sel = [{S,true} || S <- ordsets:to_list(Y2CS)] ++
[{S,false} || S <- ordsets:to_list(NY2CS)],
-
+
SelS = [{State,Called} ||
{{State,_JActions}, {State,Called}} <-
lists:zip(StateJumps, lists:keysort(1, Sel))],
diff --git a/lib/parsetools/test/yecc_SUITE.erl b/lib/parsetools/test/yecc_SUITE.erl
index 2e287f413a..61e2456323 100644
--- a/lib/parsetools/test/yecc_SUITE.erl
+++ b/lib/parsetools/test/yecc_SUITE.erl
@@ -44,7 +44,7 @@
empty/1, prec/1, yeccpre/1, lalr/1, old_yecc/1,
other_examples/1,
bugs/1,
- otp_5369/1, otp_6362/1, otp_7945/1, otp_8483/1,
+ otp_5369/1, otp_6362/1, otp_7945/1, otp_8483/1, otp_8486/1,
improvements/1,
otp_7292/1, otp_7969/1]).
@@ -1284,7 +1284,7 @@ other_examples(Config) when is_list(Config) ->
ok.
bugs(suite) ->
- [otp_5369, otp_6362, otp_7945, otp_8483].
+ [otp_5369, otp_6362, otp_7945, otp_8483, otp_8486].
otp_5369(doc) ->
"OTP-5369. A bug in parse_and_scan reported on erlang questions.";
@@ -1510,6 +1510,36 @@ otp_8483(Config) when is_list(Config) ->
file:delete(Input),
ok.
+otp_8486(doc) ->
+ "OTP-8486.";
+otp_8486(suite) -> [];
+otp_8486(Config) when is_list(Config) ->
+ Ts = [{otp_8486,<<"
+ Nonterminals boolean command.
+ Terminals '(' ')' if then else true and or skip while do.
+ Rootsymbol command.
+ Left 100 or.
+ Left 200 and.
+ boolean -> '(' boolean ')' : '$2'.
+ boolean -> 'true' : b.
+ boolean -> boolean 'and' boolean : {a,'$1','$3'}.
+ boolean -> boolean 'or' boolean : {o,'$1','$3'}.
+ command -> 'skip' : s.
+ command -> 'if' boolean 'then' command 'else' command :
+ {i,'$2','$4','$6'}.
+ command -> 'while' boolean 'do' command : {w,'$2','$4'}.
+
+ Erlang code.
+ -export([t/0]).
+ t() ->
+ {ok,{i,{o,b,b},s,s}} =
+ parse([{'if',1},{'true',1},{'or',1},{'true',1},
+ {'then',1},{'skip',1},{'else',1},{'skip',1}]),
+ ok.
+ ">>,default,ok}],
+ ?line run(Config, Ts),
+ ok.
+
improvements(suite) ->
[otp_7292, otp_7969].