LEFT | RIGHT |
1 // Copyright (C) 2008 Google Inc. | 1 // Copyright (C) 2008 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 ConfigUtil.loadWhiteListFromJson( | 518 ConfigUtil.loadWhiteListFromJson( |
519 attrs.source().getUri(), resolver, mq)); | 519 attrs.source().getUri(), resolver, mq)); |
520 } catch (ParseException ex) { | 520 } catch (ParseException ex) { |
521 ex.toMessageQueue(mq); | 521 ex.toMessageQueue(mq); |
522 throw (IOException) new IOException("Failed to parse schema") | 522 throw (IOException) new IOException("Failed to parse schema") |
523 .initCause(ex); | 523 .initCause(ex); |
524 } | 524 } |
525 | 525 |
526 Writer out = new OutputStreamWriter( | 526 Writer out = new OutputStreamWriter( |
527 new FileOutputStream(output), Charsets.UTF_8.name()); | 527 new FileOutputStream(output), Charsets.UTF_8.name()); |
528 String currentDate = "" + new Date(); | |
529 if (currentDate.indexOf("*/") >= 0) { | |
530 throw new SomethingWidgyHappenedError("Date should not contain '*/'"); | |
531 } | |
532 out.write("// Copyright Google Inc.\n"); | |
533 out.write("// Licensed under the Apache Licence Version 2.0\n"); | |
534 out.write("// Autogenerated at " + currentDate + "\n"); | |
535 out.write("// @overrides window\n"); | |
536 out.write("// @provides html4\n"); | |
537 try { | 528 try { |
| 529 String currentDate = "" + new Date(); |
| 530 if (currentDate.indexOf("*/") >= 0) { |
| 531 throw new SomethingWidgyHappenedError("Date should not contain '*/'"); |
| 532 } |
| 533 out.write("// Copyright Google Inc.\n"); |
| 534 out.write("// Licensed under the Apache Licence Version 2.0\n"); |
| 535 out.write("// Autogenerated at " + currentDate + "\n"); |
| 536 out.write("// @overrides window\n"); |
| 537 out.write("// @provides html4\n"); |
538 Block node = generateJavascriptDefinitions(schema); | 538 Block node = generateJavascriptDefinitions(schema); |
539 RenderContext rc = new RenderContext(node.makeRenderer(out, null)) | 539 RenderContext rc = new RenderContext(node.makeRenderer(out, null)) |
540 .withPropertyNameQuotingMode( | 540 .withPropertyNameQuotingMode( |
541 PropertyNameQuotingMode.PRESERVE_QUOTES); | 541 PropertyNameQuotingMode.PRESERVE_QUOTES); |
542 for (Statement s : node.children()) { | 542 for (Statement s : node.children()) { |
543 s.render(rc); | 543 s.render(rc); |
544 if (!s.isTerminal()) { rc.getOut().consume(";"); } | 544 if (!s.isTerminal()) { rc.getOut().consume(";"); } |
545 } | 545 } |
546 rc.getOut().noMoreTokens(); | 546 rc.getOut().noMoreTokens(); |
547 out.write("\n"); | 547 out.write("\n"); |
(...skipping 22 matching lines...) Expand all Loading... |
570 HtmlSchema schema = HtmlSchema.getDefault(new SimpleMessageQueue()); | 570 HtmlSchema schema = HtmlSchema.getDefault(new SimpleMessageQueue()); |
571 Block node = generateJavascriptDefinitions(schema); | 571 Block node = generateJavascriptDefinitions(schema); |
572 RenderContext rc = new RenderContext(node.makeRenderer(System.out, null)); | 572 RenderContext rc = new RenderContext(node.makeRenderer(System.out, null)); |
573 for (Statement s : node.children()) { | 573 for (Statement s : node.children()) { |
574 s.render(rc); | 574 s.render(rc); |
575 if (!s.isTerminal()) { rc.getOut().consume(";"); } | 575 if (!s.isTerminal()) { rc.getOut().consume(";"); } |
576 } | 576 } |
577 rc.getOut().noMoreTokens(); | 577 rc.getOut().noMoreTokens(); |
578 } | 578 } |
579 } | 579 } |
LEFT | RIGHT |