aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parsetools
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parsetools')
-rw-r--r--lib/parsetools/include/yeccpre.hrl8
-rw-r--r--lib/parsetools/src/Makefile5
-rw-r--r--lib/parsetools/src/leex.erl2
-rw-r--r--lib/parsetools/src/yecc.erl6
-rw-r--r--lib/parsetools/src/yeccparser.erl4
-rw-r--r--lib/parsetools/test/leex_SUITE.erl36
-rw-r--r--lib/parsetools/test/yecc_SUITE.erl58
7 files changed, 60 insertions, 59 deletions
diff --git a/lib/parsetools/include/yeccpre.hrl b/lib/parsetools/include/yeccpre.hrl
index e4c3ba52be..855bff5fdc 100644
--- a/lib/parsetools/include/yeccpre.hrl
+++ b/lib/parsetools/include/yeccpre.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -36,7 +36,7 @@ parse_and_scan({M, F, A}) ->
-spec format_error(any()) -> [char() | list()].
format_error(Message) ->
- case io_lib:deep_unicode_char_list(Message) of
+ case io_lib:deep_char_list(Message) of
true ->
Message;
_ ->
@@ -164,9 +164,9 @@ yecctoken_location(Token) ->
yecctoken2string({atom, _, A}) -> io_lib:write(A);
yecctoken2string({integer,_,N}) -> io_lib:write(N);
yecctoken2string({float,_,F}) -> io_lib:write(F);
-yecctoken2string({char,_,C}) -> io_lib:write_unicode_char(C);
+yecctoken2string({char,_,C}) -> io_lib:write_char(C);
yecctoken2string({var,_,V}) -> io_lib:format("~s", [V]);
-yecctoken2string({string,_,S}) -> io_lib:write_unicode_string(S);
+yecctoken2string({string,_,S}) -> io_lib:write_string(S);
yecctoken2string({reserved_symbol, _, A}) -> io_lib:write(A);
yecctoken2string({_Cat, _, Val}) -> io_lib:format("~p",[Val]);
yecctoken2string({dot, _}) -> "'.'";
diff --git a/lib/parsetools/src/Makefile b/lib/parsetools/src/Makefile
index 7b63475231..2ee2285eb3 100644
--- a/lib/parsetools/src/Makefile
+++ b/lib/parsetools/src/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1996-2012. All Rights Reserved.
+# Copyright Ericsson AB 1996-2013. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -58,7 +58,8 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------
-ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(ERL_TOP)/lib/stdlib/include
+ERL_COMPILE_FLAGS += +warn_obsolete_guard -I$(ERL_TOP)/lib/stdlib/include \
+ -Werror
# ----------------------------------------------------
# Targets
diff --git a/lib/parsetools/src/leex.erl b/lib/parsetools/src/leex.erl
index bbef4053b4..32c513f56c 100644
--- a/lib/parsetools/src/leex.erl
+++ b/lib/parsetools/src/leex.erl
@@ -1669,7 +1669,7 @@ quote($\d) -> "\\\\d";
quote($\\) -> "\\\\";
quote(C) when is_integer(C) ->
%% Must remove the $ and get the \'s right.
- case io_lib:write_unicode_char(C) of
+ case io_lib:write_char(C) of
[$$,$\\|Cs] -> "\\\\" ++ Cs;
[$$|Cs] -> Cs
end;
diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl
index dbb7d025ae..2f0f70f39b 100644
--- a/lib/parsetools/src/yecc.erl
+++ b/lib/parsetools/src/yecc.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -2494,8 +2494,8 @@ pp_tokens1([T | Ts], Line0, Enc, T0) ->
pp_symbol({var,_,Var}, _Enc) -> Var;
pp_symbol({string,_,String}, latin1) ->
- io_lib:write_unicode_string_as_latin1(String);
-pp_symbol({string,_,String}, _Enc) -> io_lib:write_unicode_string(String);
+ io_lib:write_string_as_latin1(String);
+pp_symbol({string,_,String}, _Enc) -> io_lib:write_string(String);
pp_symbol({_,_,Symbol}, latin1) -> io_lib:fwrite(<<"~p">>, [Symbol]);
pp_symbol({_,_,Symbol}, _Enc) -> io_lib:fwrite(<<"~tp">>, [Symbol]);
pp_symbol({Symbol, _}, _Enc) -> Symbol.
diff --git a/lib/parsetools/src/yeccparser.erl b/lib/parsetools/src/yeccparser.erl
index e4b8b06db5..54f9ba5a58 100644
--- a/lib/parsetools/src/yeccparser.erl
+++ b/lib/parsetools/src/yeccparser.erl
@@ -17,7 +17,7 @@ line_of(Token) ->
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -178,7 +178,7 @@ yecctoken2string({integer,_,N}) -> io_lib:write(N);
yecctoken2string({float,_,F}) -> io_lib:write(F);
yecctoken2string({char,_,C}) -> io_lib:write_char(C);
yecctoken2string({var,_,V}) -> io_lib:format("~s", [V]);
-yecctoken2string({string,_,S}) -> io_lib:write_unicode_string(S);
+yecctoken2string({string,_,S}) -> io_lib:write_string(S);
yecctoken2string({reserved_symbol, _, A}) -> io_lib:write(A);
yecctoken2string({_Cat, _, Val}) -> io_lib:write(Val);
yecctoken2string({dot, _}) -> "'.'";
diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl
index 9d591c0d05..afedd79a4e 100644
--- a/lib/parsetools/test/leex_SUITE.erl
+++ b/lib/parsetools/test/leex_SUITE.erl
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
%%
%% %CopyrightBegin%
%%
@@ -888,7 +888,7 @@ otp_10302(Config) when is_list(Config) ->
ok = file:write_file(Filename,<<
"%% coding: UTF-8\n"
- "�"
+ "ä"
>>),
{error,[{_,[{2,leex,cannot_parse}]}],[]} =
leex:file(Filename, Ret),
@@ -896,7 +896,7 @@ otp_10302(Config) when is_list(Config) ->
ok = file:write_file(Filename,<<
"%% coding: UTF-8\n"
"Definitions.\n"
- "�"
+ "ä"
>>),
{error,[{_,[{3,leex,cannot_parse}]}],[]} = leex:file(Filename, Ret),
@@ -907,7 +907,7 @@ otp_10302(Config) when is_list(Config) ->
"L = [{A}-{Z}]\n"
"Z = z\n"
"Rules.\n"
- "{L}+ : {token,{list_to_atom(TokenChars),H�pp}}.\n"
+ "{L}+ : {token,{list_to_atom(TokenChars),Häpp}}.\n"
>>),
{error,[{_,[{7,leex,cannot_parse}]}],[]} = leex:file(Filename, Ret),
@@ -922,7 +922,7 @@ otp_10302(Config) when is_list(Config) ->
"Erlang code.\n"
"-export([t/0]).\n"
"t() ->\n"
- " H�pp\n"
+ " Häpp\n"
>>),
{error,[{_,[{11,leex,cannot_parse}]}],[]} = leex:file(Filename, Ret),
@@ -932,7 +932,7 @@ otp_10302(Config) when is_list(Config) ->
"{L}+ : {token,{word,TokenLine,TokenChars}}.\n"
"Erlang code.\n">>,
LeexPre = filename:join(Dir, "leexinc.hrl"),
- ?line ok = file:write_file(LeexPre, <<"%% coding: UTF-8\n �">>),
+ ?line ok = file:write_file(LeexPre, <<"%% coding: UTF-8\n ä">>),
PreErrors = run_test(Config, Mini, LeexPre),
{error,[{IncludeFile,[{2,leex,cannot_parse}]}],[]} = PreErrors,
"leexinc.hrl" = filename:basename(IncludeFile),
@@ -945,16 +945,16 @@ otp_10302(Config) when is_list(Config) ->
"Z = z\n"
"Rules.\n"
"{L}+ : {token,{list_to_atom(TokenChars),\n"
- "begin Häpp = foo, Häpp end,"
- " 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}}.\n"
+ "begin Häpp = foo, Häpp end,"
+ " 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}}.\n"
"Erlang code.\n"
"-export([t/0]).\n"
"t() ->\n"
- " %% Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"\n"
+ " %% Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"\n"
" {ok, [R], 1} = string(\"tip\"),\n"
- " {tip,foo,'Häpp',[1024,66],[246,114,110,95,1024]} = R,\n"
- " Häpp = foo,\n"
- " {tip, Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,\n"
+ " {tip,foo,'Häpp',[1024,66],[246,114,110,95,1024]} = R,\n"
+ " Häpp = foo,\n"
+ " {tip, Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,\n"
" ok.\n">>,
default,
ok},
@@ -966,16 +966,16 @@ otp_10302(Config) when is_list(Config) ->
"Z = z\n"
"Rules.\n"
"{L}+ : {token,{list_to_atom(TokenChars),\n"
- "begin H�pp = foo, H�pp end,"
- " 'H�pp',\"\\x{400}B\",\"örn_Ѐ\"}}.\n"
+ "begin Häpp = foo, Häpp end,"
+ " 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}}.\n"
"Erlang code.\n"
"-export([t/0]).\n"
"t() ->\n"
- " %% H�pp, 'H�pp',\"\\x{400}B\",\"örn_Ѐ\"\n"
+ " %% Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"\n"
" {ok, [R], 1} = string(\"tip\"),\n"
- " {tip,foo,'H�pp',[1024,66],[195,182,114,110,95,208,128]} = R,\n"
- " H�pp = foo,\n"
- " {tip, H�pp, 'H�pp',\"\\x{400}B\",\"örn_Ѐ\"} = R,\n"
+ " {tip,foo,'Häpp',[1024,66],[195,182,114,110,95,208,128]} = R,\n"
+ " Häpp = foo,\n"
+ " {tip, Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,\n"
" ok.\n">>,
default,
ok}],
diff --git a/lib/parsetools/test/yecc_SUITE.erl b/lib/parsetools/test/yecc_SUITE.erl
index c306dbe833..3d66a2a525 100644
--- a/lib/parsetools/test/yecc_SUITE.erl
+++ b/lib/parsetools/test/yecc_SUITE.erl
@@ -1,8 +1,8 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1824,7 +1824,7 @@ otp_10302(Config) when is_list(Config) ->
Filename = filename:join(Dir, "OTP-10302.yrl"),
Ret = [return, {report, true}],
Mini1 = <<"%% coding: utf-8
- Nonterminals H�pp.
+ Nonterminals Häpp.
nt -> t.">>,
ok = file:write_file(Filename, Mini1),
%% This could (and should) be refined:
@@ -1842,7 +1842,7 @@ otp_10302(Config) when is_list(Config) ->
Erlang code.
t() ->
- H�pp.">>,
+ Häpp.">>,
ok = file:write_file(Filename, Mini2),
{error,[{Filename,[{11,Mod2,Err2}]}],[]} =
yecc:file(Filename, Ret),
@@ -1858,10 +1858,10 @@ otp_10302(Config) when is_list(Config) ->
Erlang code.
t() ->
- H�pp.">>,
+ Häpp.">>,
ok = file:write_file(Filename, Mini3),
YeccPre = filename:join(Dir, "yeccpre.hrl"),
- ok = file:write_file(YeccPre, [<<"%% coding: UTF-8\n �.\n">>]),
+ ok = file:write_file(YeccPre, [<<"%% coding: UTF-8\n ä.\n">>]),
Inc = [{includefile,YeccPre}],
{error,[{_,[{2,yecc,cannot_parse}]}],[]} =
yecc:file(Filename, Inc ++ Ret),
@@ -1870,9 +1870,9 @@ otp_10302(Config) when is_list(Config) ->
<<"%% coding: UTF-8
Nonterminals Hopp.
Terminals t.
- Rootsymbol \"örn_Ѐ\".
+ Rootsymbol \"örn_Ѐ\".
Hopp -> t : '$1'.">>),
- {error,[{Filename,[{4,yecc,{bad_symbol,"�rn_"++[1024]}}]}],[]} =
+ {error,[{Filename,[{4,yecc,{bad_symbol,"örn_"++[1024]}}]}],[]} =
yecc:file(Filename, Ret),
ok = file:write_file(Filename,
@@ -1880,9 +1880,9 @@ otp_10302(Config) when is_list(Config) ->
Nonterminals Hopp.
Terminals t.
Rootsymbol Hopp.
- Endsymbol \"örn_Ѐ\".
+ Endsymbol \"örn_Ѐ\".
Hopp -> t : '$1'.">>),
- {error,[{Filename,[{5,yecc,{bad_symbol,"�rn_"++[1024]}}]}],[]} =
+ {error,[{Filename,[{5,yecc,{bad_symbol,"örn_"++[1024]}}]}],[]} =
yecc:file(Filename, Ret),
ok = file:write_file(Filename,
@@ -1890,9 +1890,9 @@ otp_10302(Config) when is_list(Config) ->
Nonterminals Hopp.
Terminals t.
Rootsymbol Hopp.
- Expect \"örn_Ѐ\".
+ Expect \"örn_Ѐ\".
Hopp -> t : '$1'.">>),
- {error,[{Filename,[{5,yecc,{bad_symbol,"�rn_"++[1024]}}]}],[]} =
+ {error,[{Filename,[{5,yecc,{bad_symbol,"örn_"++[1024]}}]}],[]} =
yecc:file(Filename, Ret),
ok = file:write_file(Filename,
@@ -1900,25 +1900,25 @@ otp_10302(Config) when is_list(Config) ->
Nonterminals Hopp.
Terminals t.
Rootsymbol Hopp.
- States \"örn_Ѐ\".
+ States \"örn_Ѐ\".
Hopp -> t : '$1'.">>),
- {error,[{Filename,[{5,yecc,{bad_symbol,"�rn_"++[1024]}}]}],[]} =
+ {error,[{Filename,[{5,yecc,{bad_symbol,"örn_"++[1024]}}]}],[]} =
yecc:file(Filename, Ret),
Ts = [{otp_10302_1,<<"
%% coding: UTF-8
- Header \"%% örn_Ѐ\" \"%% \\x{400}B\".
- Nonterminals Häpp list.
+ Header \"%% örn_Ѐ\" \"%% \\x{400}B\".
+ Nonterminals Häpp list.
Terminals element.
- Rootsymbol Häpp.
+ Rootsymbol Häpp.
- Häpp -> list : '$1'.
+ Häpp -> list : '$1'.
list -> element : '$1'.
list -> list element :
begin
- Häpp = foo,
- {Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}
+ Häpp = foo,
+ {Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}
end.
Erlang code.
@@ -1928,24 +1928,24 @@ otp_10302(Config) when is_list(Config) ->
t() ->
L = [{element, 1}, {element,2}],
{ok, R} = parse(L),
- Häpp = foo,
+ Häpp = foo,
{_,_,[1024,66],[246,114,110,95,1024]} = R,
- {Häpp,'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,
+ {Häpp,'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,
ok.
">>,default,ok},
{otp_10302_2,<<"
%% coding: Latin-1
- Nonterminals H�pp list.
+ Nonterminals Häpp list.
Terminals element.
- Rootsymbol H�pp.
+ Rootsymbol Häpp.
- H�pp -> list : '$1'.
+ Häpp -> list : '$1'.
list -> element : '$1'.
list -> list element :
begin
- H�pp = foo,
- {H�pp, 'H�pp',\"\\x{400}B\",\"örn_Ѐ\"}
+ Häpp = foo,
+ {Häpp, 'Häpp',\"\\x{400}B\",\"örn_Ѐ\"}
end.
Erlang code.
@@ -1955,9 +1955,9 @@ otp_10302(Config) when is_list(Config) ->
t() ->
L = [{element, 1}, {element,2}],
{ok, R} = parse(L),
- H�pp = foo,
+ Häpp = foo,
{_,_,[1024,66],[195,182,114,110,95,208,128]} = R,
- {H�pp,'H�pp',\"\\x{400}B\",\"örn_Ѐ\"} = R,
+ {Häpp,'Häpp',\"\\x{400}B\",\"örn_Ѐ\"} = R,
ok.
">>,default,ok}],
run(Config, Ts),