Debian Codegraph @

src/org/intellij/lang/annotations/PrintFormat.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*
2 * Copyright 2006 Sascha Weinreuter
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 package org.intellij.lang.annotations;
17
18 @Pattern(PrintFormatPattern.PRINT_FORMAT)
19 public @interface PrintFormat {
20 }
21
22 // split up complex regex and workaround for IDEA-9173
23 class PrintFormatPattern {
24
25 // %[argument_index$][flags][width][.precision]conversion
26
27 // Expression is taken from java.util.Formatter.fsPattern
28
29 @Language("RegExp")
30 private static final String ARG_INDEX = "(?:\\d+\\$)?";
31 @Language("RegExp")
32 private static final String FLAGS = "(?:[-#+ 0,(<]*)?";
33 @Language("RegExp")
34 private static final String WIDTH = "(?:\\d+)?";
35 @Language("RegExp")
36 private static final String PRECISION = "(?:\\.\\d+)?";
37 @Language("RegExp")
38 private static final String CONVERSION = "(?:[tT])?(?:[a-zA-Z%])";
39 @Language("RegExp")
40 private static final String TEXT = "[^%]|%%";
41
42 @Language("RegExp")
43 static final String PRINT_FORMAT = "(?:" + TEXT + "|" +
44 "(?:%" +
45 ARG_INDEX +
46 FLAGS +
47 WIDTH +
48 PRECISION +
49 CONVERSION + ")" +
50 ")*";
51 }