aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parsetools/src/yecc.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2010-08-19 10:50:22 +0200
committerHans Bolinder <[email protected]>2010-08-23 15:25:24 +0200
commit859c720d1c71654be14349fd8aba7cb8454c5679 (patch)
tree1cc84b43fed5e082c2260838fb88c26abd130448 /lib/parsetools/src/yecc.erl
parent7ed6bbd4e8bb88958bd45f85e3ef8af39c9f894f (diff)
downloadotp-859c720d1c71654be14349fd8aba7cb8454c5679.tar.gz
otp-859c720d1c71654be14349fd8aba7cb8454c5679.tar.bz2
otp-859c720d1c71654be14349fd8aba7cb8454c5679.zip
Fix a problem with HiPE-compiled Yecc parsers
Diffstat (limited to 'lib/parsetools/src/yecc.erl')
-rw-r--r--lib/parsetools/src/yecc.erl18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl
index c4a47d008f..4119e2631b 100644
--- a/lib/parsetools/src/yecc.erl
+++ b/lib/parsetools/src/yecc.erl
@@ -1875,8 +1875,12 @@ format_conflict({Symbol, N, Reduce, Confl}) ->
%% - "__Stack" has been substituted for "Stack";
%% - several states can share yeccpars2_S_cont(), which reduces code size;
%% - instead if calling lists:nthtail() matching code is emitted.
+%%
+%% "1.4", parsetools-2.0.4:
+%% - yeccerror() is called when a syntax error is found (as in version 1.1).
+%% - the include file yeccpre.hrl has been changed.
--define(CODE_VERSION, "1.3").
+-define(CODE_VERSION, "1.4").
-define(YECC_BUG(M, A),
iolist_to_binary([" erlang:error({yecc_bug,\"",?CODE_VERSION,"\",",
io_lib:fwrite(M, A), "}).\n\n"])).
@@ -2106,13 +2110,11 @@ output_call_to_includefile(NewState, St) ->
fwrite(St, <<" yeccpars1(S, ~w, Ss, Stack, T, Ts, Tzr)">>,
[NewState]).
-output_state_actions_fini(State, #yecc{includefile_version = {1,1}}=St0) ->
- %% Backward compatibility.
+output_state_actions_fini(State, St0) ->
+ %% Backward compatible.
St10 = delim(St0, false),
St = fwrite(St10, <<"yeccpars2_~w(_, _, _, _, T, _, _) ->\n">>, [State]),
- fwrite(St, <<" yeccerror(T).\n\n">>, []);
-output_state_actions_fini(_State, St) ->
- fwrite(St, <<".\n\n">>, []).
+ fwrite(St, <<" yeccerror(T).\n\n">>, []).
output_reduce(St0, State, Terminal0,
#reduce{rule_nmbr = RuleNmbr,
@@ -2416,7 +2418,7 @@ include1(Line, Inport, Outport, Nmbr_of_lines) ->
include1(io:get_line(Inport, ''), Inport, Outport, Nmbr_of_lines + Incr).
includefile_version([]) ->
- {1,2};
+ {1,4};
includefile_version(Includefile) ->
case epp:open(Includefile, []) of
{ok, Epp} ->
@@ -2432,7 +2434,7 @@ includefile_version(Includefile) ->
parse_file(Epp) ->
case epp:parse_erl_form(Epp) of
{ok, {function,_Line,yeccpars1,7,_Clauses}} ->
- {1,2};
+ {1,4};
{eof,_Line} ->
{1,1};
_Form ->