| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Tools for generating code in analyzer and analysis server. | 6 * Tools for generating code in analyzer and analysis server. |
| 7 */ | 7 */ |
| 8 library analyzer.src.codegen.tools; | 8 library analyzer.src.codegen.tools; |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (containsOnlyWhitespace(docs)) { | 148 if (containsOnlyWhitespace(docs)) { |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 write(codeGeneratorSettings.lineCommentLineLeader); | 151 write(codeGeneratorSettings.lineCommentLineLeader); |
| 152 int width = codeGeneratorSettings.commentLineLength; | 152 int width = codeGeneratorSettings.commentLineLength; |
| 153 indentBy(codeGeneratorSettings.lineCommentLineLeader, () { | 153 indentBy(codeGeneratorSettings.lineCommentLineLeader, () { |
| 154 write(nodesToText(docs, width - _state.indent.length, false)); | 154 write(nodesToText(docs, width - _state.indent.length, false)); |
| 155 }); | 155 }); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void outputHeader({bool javaStyle: false}) { | 158 void outputHeader({bool javaStyle: false, String year = null}) { |
| 159 String header; | 159 String header; |
| 160 if (codeGeneratorSettings.languageName == 'java') { | 160 if (codeGeneratorSettings.languageName == 'java') { |
| 161 header = ''' | 161 header = ''' |
| 162 /* | 162 /* |
| 163 * Copyright (c) 2015, the Dart project authors. | 163 * Copyright (c) ${year ?? '2015'}, the Dart project authors. |
| 164 * | 164 * |
| 165 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 165 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 166 * in compliance with the License. You may obtain a copy of the License at | 166 * in compliance with the License. You may obtain a copy of the License at |
| 167 * | 167 * |
| 168 * http://www.eclipse.org/legal/epl-v10.html | 168 * http://www.eclipse.org/legal/epl-v10.html |
| 169 * | 169 * |
| 170 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 170 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 171 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 171 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 172 * or implied. See the License for the specific language governing permissions a
nd limitations under | 172 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 173 * the License. | 173 * the License. |
| 174 * | 174 * |
| 175 * This file has been automatically generated. Please do not edit it manually. | 175 * This file has been automatically generated. Please do not edit it manually. |
| 176 * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generat
e_files". | 176 * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generat
e_files". |
| 177 */'''; | 177 */'''; |
| 178 } else if (codeGeneratorSettings.languageName == 'python') { | 178 } else if (codeGeneratorSettings.languageName == 'python') { |
| 179 header = ''' | 179 header = ''' |
| 180 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 180 # Copyright (c) ${year ?? '2014'}, the Dart project authors. Please see the AUT
HORS file |
| 181 # for details. All rights reserved. Use of this source code is governed by a | 181 # for details. All rights reserved. Use of this source code is governed by a |
| 182 # BSD-style license that can be found in the LICENSE file. | 182 # BSD-style license that can be found in the LICENSE file. |
| 183 # | 183 # |
| 184 # This file has been automatically generated. Please do not edit it manually. | 184 # This file has been automatically generated. Please do not edit it manually. |
| 185 # To regenerate the file, use the script | 185 # To regenerate the file, use the script |
| 186 # "pkg/analysis_server/tool/spec/generate_files". | 186 # "pkg/analysis_server/tool/spec/generate_files". |
| 187 '''; | 187 '''; |
| 188 } else { | 188 } else { |
| 189 header = ''' | 189 header = ''' |
| 190 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 190 // Copyright (c) ${year ?? '2014'}, the Dart project authors. Please see the AU
THORS file |
| 191 // for details. All rights reserved. Use of this source code is governed by a | 191 // for details. All rights reserved. Use of this source code is governed by a |
| 192 // BSD-style license that can be found in the LICENSE file. | 192 // BSD-style license that can be found in the LICENSE file. |
| 193 // | 193 // |
| 194 // This file has been automatically generated. Please do not edit it manually. | 194 // This file has been automatically generated. Please do not edit it manually. |
| 195 // To regenerate the file, use the script | 195 // To regenerate the file, use the script |
| 196 // "pkg/analysis_server/tool/spec/generate_files". | 196 // "pkg/analysis_server/tool/spec/generate_files". |
| 197 '''; | 197 '''; |
| 198 } | 198 } |
| 199 writeln(header.trim()); | 199 writeln(header.trim()); |
| 200 } | 200 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 if (lines.last.isEmpty) { | 600 if (lines.last.isEmpty) { |
| 601 lines.removeLast(); | 601 lines.removeLast(); |
| 602 buffer.add(new dom.Text(lines.join('\n$indent') + '\n')); | 602 buffer.add(new dom.Text(lines.join('\n$indent') + '\n')); |
| 603 indentNeeded = true; | 603 indentNeeded = true; |
| 604 } else { | 604 } else { |
| 605 buffer.add(new dom.Text(lines.join('\n$indent'))); | 605 buffer.add(new dom.Text(lines.join('\n$indent'))); |
| 606 indentNeeded = false; | 606 indentNeeded = false; |
| 607 } | 607 } |
| 608 } | 608 } |
| 609 } | 609 } |
| OLD | NEW |