OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.verbs.implementation; | 5 library dartino_compiler.verbs.implementation; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future, | 8 Future, |
9 StreamIterator; | 9 StreamIterator; |
10 | 10 |
11 export 'dart:async' show | 11 export 'dart:async' show |
12 Future, | 12 Future, |
13 StreamIterator; | 13 StreamIterator; |
14 | 14 |
15 // Don't export this. | 15 // Don't export this. |
(...skipping 24 matching lines...) Expand all Loading... |
40 | 40 |
41 import '../hub/client_commands.dart' show | 41 import '../hub/client_commands.dart' show |
42 CommandSender, | 42 CommandSender, |
43 ClientCommand; | 43 ClientCommand; |
44 | 44 |
45 export '../hub/client_commands.dart' show | 45 export '../hub/client_commands.dart' show |
46 CommandSender, | 46 CommandSender, |
47 ClientCommand; | 47 ClientCommand; |
48 | 48 |
49 import '../hub/session_manager.dart' show | 49 import '../hub/session_manager.dart' show |
50 FletchCompiler, | 50 DartinoCompiler, |
51 FletchDelta, | 51 DartinoDelta, |
52 IncrementalCompiler, | 52 IncrementalCompiler, |
53 WorkerConnection, | 53 WorkerConnection, |
54 Session, | 54 Session, |
55 SessionState, | 55 SessionState, |
56 UserSession, | 56 UserSession, |
57 currentSession; | 57 currentSession; |
58 | 58 |
59 export '../hub/session_manager.dart' show | 59 export '../hub/session_manager.dart' show |
60 FletchCompiler, | 60 DartinoCompiler, |
61 FletchDelta, | 61 DartinoDelta, |
62 IncrementalCompiler, | 62 IncrementalCompiler, |
63 WorkerConnection, | 63 WorkerConnection, |
64 Session, | 64 Session, |
65 SessionState, | 65 SessionState, |
66 UserSession, | 66 UserSession, |
67 currentSession; | 67 currentSession; |
68 | 68 |
69 export '../diagnostic.dart' show | 69 export '../diagnostic.dart' show |
70 DiagnosticKind, | 70 DiagnosticKind, |
71 throwFatalError; | 71 throwFatalError; |
(...skipping 28 matching lines...) Expand all Loading... |
100 import 'options.dart' show | 100 import 'options.dart' show |
101 Options; | 101 Options; |
102 | 102 |
103 export 'options.dart' show | 103 export 'options.dart' show |
104 Options; | 104 Options; |
105 | 105 |
106 import 'documentation.dart' show | 106 import 'documentation.dart' show |
107 helpDocumentation; | 107 helpDocumentation; |
108 | 108 |
109 import '../guess_configuration.dart' show | 109 import '../guess_configuration.dart' show |
110 fletchVersion; | 110 dartinoVersion; |
111 | 111 |
112 void reportErroneousTarget(ErrorTarget target) { | 112 void reportErroneousTarget(ErrorTarget target) { |
113 throwFatalError(target.errorKind, userInput: target.userInput); | 113 throwFatalError(target.errorKind, userInput: target.userInput); |
114 } | 114 } |
115 | 115 |
116 AnalyzedSentence helpSentence(String message) { | 116 AnalyzedSentence helpSentence(String message) { |
117 Future<int> printHelp(_,__) async { | 117 Future<int> printHelp(_,__) async { |
118 print(message); | 118 print(message); |
119 return 0; | 119 return 0; |
120 } | 120 } |
121 Action contextHelp = new Action(printHelp, null); | 121 Action contextHelp = new Action(printHelp, null); |
122 return new AnalyzedSentence( | 122 return new AnalyzedSentence( |
123 new Verb("?", contextHelp), null, null, null, null, null, null, | 123 new Verb("?", contextHelp), null, null, null, null, null, null, |
124 null, null, null, null); | 124 null, null, null, null); |
125 } | 125 } |
126 | 126 |
127 AnalyzedSentence analyzeSentence(Sentence sentence, Options options) { | 127 AnalyzedSentence analyzeSentence(Sentence sentence, Options options) { |
128 // Check the sentence's version matches the persistent process' version. | 128 // Check the sentence's version matches the persistent process' version. |
129 if (sentence.version != null && sentence.version != fletchVersion) { | 129 if (sentence.version != null && sentence.version != dartinoVersion) { |
130 throwFatalError( | 130 throwFatalError( |
131 DiagnosticKind.compilerVersionMismatch, | 131 DiagnosticKind.compilerVersionMismatch, |
132 userInput: fletchVersion, | 132 userInput: dartinoVersion, |
133 additionalUserInput: sentence.version); | 133 additionalUserInput: sentence.version); |
134 } | 134 } |
135 if (options != null && options.version) { | 135 if (options != null && options.version) { |
136 return helpSentence(fletchVersion); | 136 return helpSentence(dartinoVersion); |
137 } | 137 } |
138 if (sentence.verb.isErroneous) { | 138 if (sentence.verb.isErroneous) { |
139 sentence.verb.action.perform(null, null); | 139 sentence.verb.action.perform(null, null); |
140 } | 140 } |
141 | 141 |
142 sentence.targets.where((Target t) => t.isErroneous) | 142 sentence.targets.where((Target t) => t.isErroneous) |
143 .forEach(reportErroneousTarget); | 143 .forEach(reportErroneousTarget); |
144 sentence.prepositions.map((p) => p.target).where((Target t) => t.isErroneous) | 144 sentence.prepositions.map((p) => p.target).where((Target t) => t.isErroneous) |
145 .forEach(reportErroneousTarget); | 145 .forEach(reportErroneousTarget); |
146 | 146 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 this.programName, | 451 this.programName, |
452 this.targetUri, | 452 this.targetUri, |
453 this.toTargetUri, | 453 this.toTargetUri, |
454 this.withUri, | 454 this.withUri, |
455 this.options); | 455 this.options); |
456 | 456 |
457 Future<int> performVerb(VerbContext context) { | 457 Future<int> performVerb(VerbContext context) { |
458 return verb.action.perform(this, context); | 458 return verb.action.perform(this, context); |
459 } | 459 } |
460 } | 460 } |
OLD | NEW |