1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsHtml5TokenizerLoopPolicies_h
6 #define nsHtml5TokenizerLoopPolicies_h
9 * This policy does not report tokenizer transitions anywhere. To be used
10 * when _not_ viewing source.
12 struct nsHtml5SilentPolicy
{
13 static const bool reportErrors
= false;
14 static int32_t transition(nsHtml5Highlighter
* aHighlighter
, int32_t aState
,
15 bool aReconsume
, int32_t aPos
) {
18 static void completedNamedCharacterReference(
19 nsHtml5Highlighter
* aHighlighter
) {}
23 * This policy reports the tokenizer transitions to a highlighter. To be used
24 * when viewing source.
26 struct nsHtml5ViewSourcePolicy
{
27 static const bool reportErrors
= true;
28 static int32_t transition(nsHtml5Highlighter
* aHighlighter
, int32_t aState
,
29 bool aReconsume
, int32_t aPos
) {
30 return aHighlighter
->Transition(aState
, aReconsume
, aPos
);
32 static void completedNamedCharacterReference(
33 nsHtml5Highlighter
* aHighlighter
) {
34 aHighlighter
->CompletedNamedCharacterReference();
38 #endif // nsHtml5TokenizerLoopPolicies_h