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

Side by Side Diff: runtime/vm/scanner.h

Issue 9240014: Set breakpoint at url, line number (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/scanner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Scanner class for the Dart language. The scanner reads source text 5 // Scanner class for the Dart language. The scanner reads source text
6 // and produces a stream of tokens which is used by the parser. 6 // and produces a stream of tokens which is used by the parser.
7 // 7 //
8 8
9 #ifndef VM_SCANNER_H_ 9 #ifndef VM_SCANNER_H_
10 #define VM_SCANNER_H_ 10 #define VM_SCANNER_H_
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Character used to indicate a private identifier. 44 // Character used to indicate a private identifier.
45 static const char kPrivateIdentifierStart = '_'; 45 static const char kPrivateIdentifierStart = '_';
46 46
47 // Character used to separate the private identifier from the key. 47 // Character used to separate the private identifier from the key.
48 static const char kPrivateKeySeparator = '@'; 48 static const char kPrivateKeySeparator = '@';
49 49
50 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream; 50 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream;
51 51
52 // Initializes scanner to scan string source. 52 // Initializes scanner to scan string source.
53 Scanner(const String& source, const String& private_key); 53 Scanner(const String& source, const String& private_key);
54 ~Scanner();
54 55
55 // Scans one token at a time. 56 // Scans one token at a time.
56 void Scan(); 57 void Scan();
57 58
58 // Scans to specified token position. 59 // Scans to specified token position.
59 // Use CurrentPosition() to extract position. 60 // Use CurrentPosition() to extract position.
60 void ScanTo(intptr_t token_index); 61 void ScanTo(intptr_t token_index);
61 62
63 // Returns token index of first token on or after given line number.
64 // Returns negative value if no token exists on or after the line.
65 intptr_t TokenIndexAtLine(intptr_t line_number);
66
62 // Scans entire source and returns a stream of tokens. 67 // Scans entire source and returns a stream of tokens.
63 // Should be called only once. 68 // Should be called only once.
64 const GrowableTokenStream& GetStream(); 69 const GrowableTokenStream& GetStream();
65 70
66 // Info about most recently recognized token. 71 // Info about most recently recognized token.
67 const TokenDescriptor& current_token() const { return current_token_; } 72 const TokenDescriptor& current_token() const { return current_token_; }
68 73
69 // Was there a line break before the current token? 74 // Was there a line break before the current token?
70 bool NewlineBeforeToken() const { return newline_seen_; } 75 bool NewlineBeforeToken() const { return newline_seen_; }
71 76
(...skipping 18 matching lines...) Expand all
90 int brace_level; 95 int brace_level;
91 }; 96 };
92 97
93 struct KeywordTable { 98 struct KeywordTable {
94 Token::Kind kind; 99 Token::Kind kind;
95 const char* keyword_chars; 100 const char* keyword_chars;
96 int keyword_len; 101 int keyword_len;
97 String* keyword_symbol; 102 String* keyword_symbol;
98 }; 103 };
99 104
105 // Rewind scanner position to token 0.
106 void Reset();
107
100 // Initialize Scanner tables. 108 // Initialize Scanner tables.
101 void InitKeywordTable(); 109 void InitKeywordTable();
102 110
103 // Reads next lookahead character. 111 // Reads next lookahead character.
104 void ReadChar(); 112 void ReadChar();
105 113
106 // Read and discard characters up to end of line. 114 // Read and discard characters up to end of line.
107 void SkipLine(); 115 void SkipLine();
108 116
109 // Recognizes token 'kind' and reads next character in input. 117 // Recognizes token 'kind' and reads next character in input.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const String& private_key_; 205 const String& private_key_;
198 206
199 SourcePosition c0_pos_; // Source position of lookahead character c0_. 207 SourcePosition c0_pos_; // Source position of lookahead character c0_.
200 KeywordTable keywords_[Token::numKeywords]; 208 KeywordTable keywords_[Token::numKeywords];
201 }; 209 };
202 210
203 211
204 } // namespace dart 212 } // namespace dart
205 213
206 #endif // VM_SCANNER_H_ 214 #endif // VM_SCANNER_H_
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698