Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/source.dart

Issue 12197019: Drop of generated scanner and example scanner driver. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information.
3
4 library engine.source;
5
6 import 'java_core.dart';
7
8 /**
9 * The interface {@code Source} defines the behavior of objects representing sou rce code that can be
10 * compiled.
11 */
12 abstract class Source {
13 /**
14 * Return {@code true} if the given object is a source that represents the sam e source code as
15 * this source.
16 * @param object the object to be compared with this object
17 * @return {@code true} if the given object is a source that represents the sa me source code as
18 * this source
19 * @see Object#equals(Object)
20 */
21 bool operator ==(Object object);
22 /**
23 * Get the contents of this source and pass it to the given receiver. Exactly one of the methods
24 * defined on the receiver will be invoked unless an exception is thrown. The method that will be
25 * invoked depends on which of the possible representations of the contents is the most efficient.
26 * Whichever method is invoked, it will be invoked before this method returns.
27 * @param receiver the content receiver to which the content of this source wi ll be passed
28 * @throws Exception if the contents of this source could not be accessed
29 */
30 void getContents(Source_ContentReceiver receiver);
31 /**
32 * Return the full (long) version of the name that can be displayed to the use r to denote this
33 * source. For example, for a source representing a file this would typically be the absolute path
34 * of the file.
35 * @return a name that can be displayed to the user to denote this source
36 */
37 String get fullName;
38 /**
39 * Return a short version of the name that can be displayed to the user to den ote this source. For
40 * example, for a source representing a file this would typically be the name of the file.
41 * @return a name that can be displayed to the user to denote this source
42 */
43 String get shortName;
44 /**
45 * Return a hash code for this source.
46 * @return a hash code for this source
47 * @see Object#hashCode()
48 */
49 int get hashCode;
50 /**
51 * Return {@code true} if this source is in one of the system libraries.
52 * @return {@code true} if this is in a system library
53 */
54 bool isInSystemLibrary();
55 /**
56 * Resolve the given URI relative to the location of this source.
57 * @param uri the URI to be resolved against this source
58 * @return a source representing the resolved URI
59 */
60 Source resolve(String uri);
61 }
62 /**
63 * The interface {@code ContentReceiver} defines the behavior of objects that ca n receive the
64 * content of a source.
65 */
66 abstract class Source_ContentReceiver {
67 /**
68 * Accept the contents of a source represented as a character buffer.
69 * @param contents the contents of the source
70 */
71 accept(CharBuffer contents);
72 /**
73 * Accept the contents of a source represented as a string.
74 * @param contents the contents of the source
75 */
76 void accept2(String contents);
77 }
78 /**
79 * Instances of the class {@code LineInfo} encapsulate information about line an d column information
80 * within a source file.
81 */
82 class LineInfo {
83 /**
84 * An array containing the offsets of the first character of each line in the source code.
85 */
86 List<int> _lineStarts;
87 /**
88 * Initialize a newly created set of line information to represent the data en coded in the given
89 * array.
90 * @param lineStarts the offsets of the first character of each line in the so urce code
91 */
92 LineInfo(List<int> lineStarts) {
93 if (lineStarts == null) {
94 throw new IllegalArgumentException("lineStarts must be non-null");
95 } else if (lineStarts.length < 1) {
96 throw new IllegalArgumentException("lineStarts must be non-empty");
97 }
98 this._lineStarts = lineStarts;
99 }
100 /**
101 * Return the location information for the character at the given offset.
102 * @param offset the offset of the character for which location information is to be returned
103 * @return the location information for the character at the given offset
104 */
105 LineInfo_Location getLocation(int offset) {
106 int lineCount = _lineStarts.length;
107 for (int i = 1; i < lineCount; i++) {
108 if (offset < _lineStarts[i]) {
109 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1);
110 }
111 }
112 return new LineInfo_Location(lineCount, offset - _lineStarts[lineCount - 1] + 1);
113 }
114 }
115 /**
116 * Instances of the class {@code Location} represent the location of a character as a line and
117 * column pair.
118 */
119 class LineInfo_Location {
120 /**
121 * The one-based index of the line containing the character.
122 */
123 int _lineNumber = 0;
124 /**
125 * The one-based index of the column containing the character.
126 */
127 int _columnNumber = 0;
128 /**
129 * Initialize a newly created location to represent the location of the charac ter at the given
130 * line and column position.
131 * @param lineNumber the one-based index of the line containing the character
132 * @param columnNumber the one-based index of the column containing the charac ter
133 */
134 LineInfo_Location(int lineNumber, int columnNumber) {
135 this._lineNumber = lineNumber;
136 this._columnNumber = columnNumber;
137 }
138 /**
139 * Return the one-based index of the column containing the character.
140 * @return the one-based index of the column containing the character
141 */
142 int get columnNumber => _columnNumber;
143 /**
144 * Return the one-based index of the line containing the character.
145 * @return the one-based index of the line containing the character
146 */
147 int get lineNumber => _lineNumber;
148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698