1%%-*-erlang-*-
2%%--------------------------------------------------------------------
3%% %CopyrightBegin%
4%%
5%% Copyright Ericsson AB 2008-2017. All Rights Reserved.
6%%
7%% Licensed under the Apache License, Version 2.0 (the "License");
8%% you may not use this file except in compliance with the License.
9%% You may obtain a copy of the License at
10%%
11%%     http://www.apache.org/licenses/LICENSE-2.0
12%%
13%% Unless required by applicable law or agreed to in writing, software
14%% distributed under the License is distributed on an "AS IS" BASIS,
15%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16%% See the License for the specific language governing permissions and
17%% limitations under the License.
18%%
19%% %CopyrightEnd%
20%%----------------------------------------------------------------------
21%% File    : xmerl_sax_parser_list.erl
22%% Description :
23%%
24%% Created : 25 Apr 2008
25%%----------------------------------------------------------------------
26-module(xmerl_sax_parser_list).
27
28%%----------------------------------------------------------------------
29%% Macros
30%%----------------------------------------------------------------------
31-define(STRING_EMPTY, []).
32-define(STRING(MatchStr), MatchStr).
33-define(STRING_REST(MatchStr, Rest), MatchStr ++ Rest).
34-define(APPEND_STRING(Rest, New), Rest ++ New).
35-define(TO_INPUT_FORMAT(Val), Val).
36
37%%  In the list case we can't use a '++' when matchin against an unbound variable
38-define(STRING_UNBOUND_REST(MatchChar, Rest), [MatchChar | Rest]).
39
40-define(PARSE_BYTE_ORDER_MARK(Bytes, State),
41        parse_byte_order_mark(Bytes, State) ->
42               parse_xml_decl(Bytes, State)).
43
44-define(PARSE_XML_DECL(Bytes, State),
45        parse_xml_decl(Bytes, State) ->
46               parse_prolog(Bytes, State)).
47
48-define(WHITESPACE(Bytes, State, Acc),
49        whitespace(?STRING_UNBOUND_REST(_C, _) = Bytes, State, Acc) ->
50               {lists:reverse(Acc), Bytes, State}).
51
52-define(PARSE_EXTERNAL_ENTITY_BYTE_ORDER_MARK(Bytes, State),
53        parse_external_entity_byte_order_mark(Bytes, State) ->
54               parse_external_entity_1(Bytes, State)).
55