1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
---input---
public class Quine {
public static void main(String[] args) {
String textBlockQuotes = new String(new char[]{'"', '"', '"'});
char newLine = 10;
String teststring = "test123\n";
String source = """
public class Quine {
public static void main(String[] args) {
String textBlockQuotes = new String(new char[]{'"', '"', '"'});
char newLine = 10;
String teststringinside = "hello my name is...\n\r";
String source = %s;
System.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes));
}
}
""";
System.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes));
String teststring2 = "Hello\n";
}
}
---tokens---
'public' Keyword.Declaration
' ' Text.Whitespace
'class' Keyword.Declaration
' ' Text
'Quine' Name.Class
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
'\t' Text.Whitespace
'public' Keyword.Declaration
' ' Text.Whitespace
'static' Keyword.Declaration
' ' Text.Whitespace
'void' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
'String' Name
'[' Operator
']' Operator
' ' Text.Whitespace
'args' Name
')' Punctuation
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
'\t\t' Text.Whitespace
'String' Name
' ' Text.Whitespace
'textBlockQuotes' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'new' Keyword
' ' Text.Whitespace
'String' Name
'(' Punctuation
'new' Keyword
' ' Text.Whitespace
'char' Keyword.Type
'[' Operator
']' Operator
'{' Punctuation
'\'"\'' Literal.String.Char
',' Punctuation
' ' Text.Whitespace
'\'"\'' Literal.String.Char
',' Punctuation
' ' Text.Whitespace
'\'"\'' Literal.String.Char
'}' Punctuation
')' Punctuation
';' Punctuation
'\n' Text.Whitespace
'\t\t' Text.Whitespace
'char' Keyword.Type
' ' Text.Whitespace
'newLine' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'10' Literal.Number.Integer
';' Punctuation
'\n' Text.Whitespace
'\t\t' Text.Whitespace
'String' Name
' ' Text.Whitespace
'teststring' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'"' Literal.String
'test123' Literal.String
'\\' Literal.String
'n' Literal.String
'"' Literal.String
';' Punctuation
'\n' Text.Whitespace
'\t ' Text.Whitespace
'String' Name
' ' Text.Whitespace
'source' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'"""\n' Literal.String
"public class Quine {\n\tpublic static void main(String[] args) {\n\t\tString textBlockQuotes = new String(new char[]{'" Literal.String
'"' Literal.String
"', '" Literal.String
'"' Literal.String
"', '" Literal.String
'"' Literal.String
"'});\n\t\tchar newLine = 10;\n\t\tString teststringinside = " Literal.String
'"' Literal.String
'hello my name is...' Literal.String
'\\' Literal.String
'n' Literal.String
'\\' Literal.String
'r' Literal.String
'"' Literal.String
';\n\t\tString source = %s;\n\t\tSystem.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes));\n\t}\n}\n' Literal.String
'"""' Literal.String
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'System' Name
'.' Punctuation
'out' Name.Attribute
'.' Punctuation
'println' Name.Attribute
'(' Punctuation
'source' Name
'.' Punctuation
'formatted' Name.Attribute
'(' Punctuation
'textBlockQuotes' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'newLine' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'source' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'textBlockQuotes' Name
')' Punctuation
')' Punctuation
';' Punctuation
'\n' Text.Whitespace
'\t' Text.Whitespace
'String' Name
' ' Text.Whitespace
'teststring2' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'"' Literal.String
'Hello' Literal.String
'\\' Literal.String
'n' Literal.String
'"' Literal.String
';' Punctuation
'\n' Text.Whitespace
'\t' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
|