icparse.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 1,180 行 · 第 1/5 页
ERL
1,180 行
-module(icparse).-file("/ldisk/daily_build/otp_prebuild_r11b.2007-06-11_19/otp_src_R11B-5/lib/ic/src/icyeccpre.hrl", 0).%% ``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%% compliance with the License. You should have received a copy of the%% Erlang Public License along with this software. If not, it can be%% retrieved via the world wide web at http://www.erlang.org/.%% %% Software distributed under the License is distributed on an "AS IS"%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See%% the License for the specific language governing rights and limitations%% under the License.%% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings%% AB. All Rights Reserved.''%% %% $Id$%%-export([parse/1, parse_and_scan/1, format_error/1]).-import(lists, [reverse/1]).-ifdef(JAM).-compile([{parse_transform,jam_yecc_pj},pj]).-endif.-include("icforms.hrl").%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The parser generator will insert appropriate declarations before this line.%parse(Tokens) -> case catch yeccpars1(Tokens, false, 0, [], []) of error -> Errorline = if Tokens == [] -> 0; true -> element(2, hd(Tokens)) end, {error, {Errorline, ?MODULE, "syntax error at or after this line."}}; Other -> Other end.parse_and_scan({Mod, Fun, Args}) -> case apply(Mod, Fun, Args) of {eof, _} -> {ok, eof}; {error, Descriptor, _} -> {error, Descriptor}; {ok, Tokens, _} -> yeccpars1(Tokens, {Mod, Fun, Args}, 0, [], []) end.format_error(Message) -> case io_lib:deep_char_list(Message) of true -> Message; _ -> io_lib:write(Message) end.% To be used in grammar files to throw an error message to the parser toplevel.% Doesn't have to be exported!return_error(Line, Message) -> throw({error, {Line, ?MODULE, Message}}).% Don't change yeccpars1/6 too much, it is called recursively by yeccpars2/8!yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) -> yeccpars2(State, element(1, Token), States, Vstack, Token, Tokens, Tokenizer);yeccpars1([], {M, F, A}, State, States, Vstack) -> case catch apply(M, F, A) of {eof, Endline} -> {error, {Endline, ?MODULE, "end_of_file"}}; {error, Descriptor, Endline} -> {error, Descriptor}; {'EXIT', Reason} -> {error, {0, ?MODULE, Reason}}; {ok, Tokens, Endline} -> case catch yeccpars1(Tokens, {M, F, A}, State, States, Vstack) of error -> Errorline = element(2, hd(Tokens)), {error, {Errorline, ?MODULE, "syntax error at or after this line."}}; Other -> Other end end;yeccpars1([], false, State, States, Vstack) -> yeccpars2(State, '$end', States, Vstack, {'$end', 999999}, [], false).% For internal use only.yeccerror(Token) -> {error, {element(2, Token), ?MODULE, ["syntax error before: ", yecctoken2string(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_char(C);yecctoken2string({var,_,V}) -> io_lib:format('~s', [V]);yecctoken2string({string,_,S}) -> io_lib:write_string(S);yecctoken2string({reserved_symbol, _, A}) -> io_lib:format('~w', [A]);yecctoken2string({'dot', _}) -> io_lib:format('~w', ['.']);yecctoken2string({'$end', _}) -> [];yecctoken2string({Other, _}) when atom(Other) -> io_lib:format('~w', [Other]);yecctoken2string({_, _, Other}) when list(Other), number(hd(Other)) -> Other;yecctoken2string({_, _, Other}) -> io_lib:format('~p', [Other]);yecctoken2string(Other) -> io_lib:write(Other).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-file("icparse.yrl", 858).%%------------------------------------------------------------file("./icparse.erl", 132).yeccpars2(0, '#', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 17, [0 | __Ss], [__T | __Stack]);yeccpars2(0, const, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 18, [0 | __Ss], [__T | __Stack]);yeccpars2(0, enum, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 19, [0 | __Ss], [__T | __Stack]);yeccpars2(0, exception, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 20, [0 | __Ss], [__T | __Stack]);yeccpars2(0, interface, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 21, [0 | __Ss], [__T | __Stack]);yeccpars2(0, module, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 22, [0 | __Ss], [__T | __Stack]);yeccpars2(0, struct, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 23, [0 | __Ss], [__T | __Stack]);yeccpars2(0, typedef, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 24, [0 | __Ss], [__T | __Stack]);yeccpars2(0, union, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 25, [0 | __Ss], [__T | __Stack]);yeccpars2(0, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(1, '#', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 17, [1 | __Ss], [__T | __Stack]);yeccpars2(1, const, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 18, [1 | __Ss], [__T | __Stack]);yeccpars2(1, enum, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 19, [1 | __Ss], [__T | __Stack]);yeccpars2(1, exception, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 20, [1 | __Ss], [__T | __Stack]);yeccpars2(1, interface, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 21, [1 | __Ss], [__T | __Stack]);yeccpars2(1, module, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 22, [1 | __Ss], [__T | __Stack]);yeccpars2(1, struct, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 23, [1 | __Ss], [__T | __Stack]);yeccpars2(1, typedef, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 24, [1 | __Ss], [__T | __Stack]);yeccpars2(1, union, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 25, [1 | __Ss], [__T | __Stack]);yeccpars2(1, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> __NewStack = yeccpars2_1_(__Stack), yeccpars2(yeccgoto('<specification>', hd(__Ss)), __Cat, __Ss, __NewStack, __T, __Ts, __Tzr);yeccpars2(2, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<definition>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(3, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<definition>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(4, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<type_dcl>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(5, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 342, [5 | __Ss], [__T | __Stack]);yeccpars2(5, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(6, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<type_dcl>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(7, '$end', _, __Stack, _, _, _) -> {ok, hd(__Stack)};yeccpars2(7, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(8, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 341, [8 | __Ss], [__T | __Stack]);yeccpars2(8, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(9, '{', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 270, [9 | __Ss], [__T | __Stack]);yeccpars2(9, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(10, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<interface>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(11, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 269, [11 | __Ss], [__T | __Stack]);yeccpars2(11, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(12, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<interface>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(13, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 268, [13 | __Ss], [__T | __Stack]);yeccpars2(13, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(14, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars2(yeccgoto('<type_dcl>', hd(__Ss)), __Cat, __Ss, __Stack, __T, __Ts, __Tzr);yeccpars2(15, __Cat, __Ss, __Stack, __T, __Ts, __Tzr) -> __NewStack = yeccpars2_15_(__Stack), yeccpars2(yeccgoto('OorM_<definition>', hd(__Ss)), __Cat, __Ss, __NewStack, __T, __Ts, __Tzr);yeccpars2(16, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 267, [16 | __Ss], [__T | __Stack]);yeccpars2(16, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(17, '#', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 260, [17 | __Ss], [__T | __Stack]);yeccpars2(17, '<integer_literal>', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 261, [17 | __Ss], [__T | __Stack]);yeccpars2(17, _, _, _, __T, _, _) -> yeccerror(__T);yeccpars2(18, '::', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 41, [18 | __Ss], [__T | __Stack]);yeccpars2(18, '<identifier>', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 42, [18 | __Ss], [__T | __Stack]);yeccpars2(18, boolean, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 43, [18 | __Ss], [__T | __Stack]);yeccpars2(18, char, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 44, [18 | __Ss], [__T | __Stack]);yeccpars2(18, double, __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 103, [18 | __Ss], [__T | __Stack]);yeccpars2(18, fixed, __Ss, __Stack, __T, __Ts, __Tzr) ->
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?