Debian Codegraph @

src/com/google/javascript/jscomp/ErrorFormat.java

raw symbols SCIP
1 /*
2 * Copyright 2009 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.javascript.jscomp;
18
19 import com.google.javascript.jscomp.SourceExcerptProvider.SourceExcerpt;
20
21 /**
22 * Error formats available.
23 */
24 public enum ErrorFormat {
25 LEGACY {
26 @Override
27 public MessageFormatter toFormatter(
28 SourceExcerptProvider source, boolean colorize) {
29 VerboseMessageFormatter formatter = new VerboseMessageFormatter(source);
30 formatter.setColorize(colorize);
31 return formatter;
32 }
33 },
34 SINGLELINE {
35 @Override
36 public MessageFormatter toFormatter(
37 SourceExcerptProvider source, boolean colorize) {
38 LightweightMessageFormatter formatter = new LightweightMessageFormatter(
39 source);
40 formatter.setColorize(colorize);
41 return formatter;
42 }
43 },
44 MULTILINE {
45 @Override
46 public MessageFormatter toFormatter(
47 SourceExcerptProvider source, boolean colorize) {
48 LightweightMessageFormatter formatter = new LightweightMessageFormatter(
49 source, SourceExcerpt.REGION);
50 formatter.setColorize(colorize);
51 return formatter;
52 }
53 },
54 SOURCELESS {
55 @Override
56 public MessageFormatter toFormatter(
57 SourceExcerptProvider source, boolean colorize) {
58 LightweightMessageFormatter formatter =
59 LightweightMessageFormatter.withoutSource();
60 formatter.setColorize(colorize);
61 return formatter;
62 }
63 };
64
65 /**
66 * Convert to a concrete formatter.
67 */
68 public abstract MessageFormatter toFormatter(
69 SourceExcerptProvider source, boolean colorize);
70 }