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

Unified Diff: runtime/vm/scanner.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/scanner.h ('k') | runtime/vm/scanner_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
diff --git a/runtime/vm/scanner.cc b/runtime/vm/scanner.cc
index a34439b6ab3ad33e65ab9c9932c227147dc92b80..1b146cb5e648f44e82e9ce352629a82934d69c97 100644
--- a/runtime/vm/scanner.cc
+++ b/runtime/vm/scanner.cc
@@ -19,7 +19,6 @@ namespace dart {
#define Z (zone())
#define T (thread())
-
class ScanContext : public ZoneAllocated {
public:
explicit ScanContext(Scanner* scanner)
@@ -43,11 +42,9 @@ class ScanContext : public ZoneAllocated {
const int brace_level_;
};
-
Scanner::KeywordTable Scanner::keywords_[Token::kNumKeywords];
int Scanner::keywords_char_offset_[Scanner::kNumLowercaseChars];
-
void Scanner::Reset() {
// Non-changing newline properties.
newline_token_.kind = Token::kNEWLINE;
@@ -74,7 +71,6 @@ void Scanner::Reset() {
ReadChar();
}
-
Scanner::Scanner(const String& src, const String& private_key)
: source_(src),
source_length_(src.Length()),
@@ -86,10 +82,8 @@ Scanner::Scanner(const String& src, const String& private_key)
Reset();
}
-
Scanner::~Scanner() {}
-
void Scanner::ErrorMsg(const char* msg) {
current_token_.kind = Token::kERROR;
current_token_.literal = &String::ZoneHandle(Z, Symbols::New(T, msg));
@@ -98,7 +92,6 @@ void Scanner::ErrorMsg(const char* msg) {
current_token_.offset = lookahead_pos_;
}
-
void Scanner::PushContext() {
ScanContext* ctx = new (Z) ScanContext(this);
saved_context_ = ctx;
@@ -107,7 +100,6 @@ void Scanner::PushContext() {
brace_level_ = 1; // Account for the opening ${ token.
}
-
void Scanner::PopContext() {
ASSERT(saved_context_ != NULL);
ASSERT(brace_level_ == 0);
@@ -118,49 +110,40 @@ void Scanner::PopContext() {
ASSERT(string_delimiter_ != '\0');
}
-
void Scanner::BeginStringLiteral(const char delimiter) {
string_delimiter_ = delimiter;
}
-
void Scanner::EndStringLiteral() {
string_delimiter_ = '\0';
string_is_multiline_ = false;
}
-
bool Scanner::IsLetter(int32_t c) {
return (('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z'));
}
-
bool Scanner::IsDecimalDigit(int32_t c) {
return '0' <= c && c <= '9';
}
-
bool Scanner::IsNumberStart(int32_t ch) {
return IsDecimalDigit(ch) || ch == '.';
}
-
bool Scanner::IsHexDigit(int32_t c) {
return IsDecimalDigit(c) || (('A' <= c) && (c <= 'F')) ||
(('a' <= c) && (c <= 'f'));
}
-
bool Scanner::IsIdentStartChar(int32_t c) {
return IsLetter(c) || (c == '_') || (c == '$');
}
-
bool Scanner::IsIdentChar(int32_t c) {
return IsLetter(c) || IsDecimalDigit(c) || (c == '_') || (c == '$');
}
-
bool Scanner::IsIdent(const String& str) {
if (!str.IsOneByteString()) {
return false;
@@ -176,7 +159,6 @@ bool Scanner::IsIdent(const String& str) {
return true;
}
-
// This method is used when parsing integers in Dart code. We
// are reusing the Scanner's handling of number literals in that situation.
bool Scanner::IsValidInteger(const String& str,
@@ -209,7 +191,6 @@ bool Scanner::IsValidInteger(const String& str,
return false;
}
-
void Scanner::ReadChar() {
if (lookahead_pos_ < source_length_) {
if (c0_ == '\n') {
@@ -233,7 +214,6 @@ void Scanner::ReadChar() {
}
}
-
// Look ahead 'how_many' characters. Returns the character, or '\0' if
// the lookahead position is beyond the end of the string. Does not
// normalize line end characters into '\n'.
@@ -246,14 +226,12 @@ int32_t Scanner::LookaheadChar(int how_many) {
return lookahead_char;
}
-
void Scanner::ConsumeWhiteSpace() {
while (c0_ == ' ' || c0_ == '\t' || c0_ == '\n') {
ReadChar();
}
}
-
void Scanner::ConsumeLineComment() {
ASSERT(c0_ == '/');
while (c0_ != '\n' && c0_ != '\0') {
@@ -263,7 +241,6 @@ void Scanner::ConsumeLineComment() {
current_token_.kind = Token::kWHITESP;
}
-
void Scanner::ConsumeBlockComment() {
ASSERT(c0_ == '*');
ReadChar();
@@ -290,7 +267,6 @@ void Scanner::ConsumeBlockComment() {
(nesting_level == 0) ? Token::kWHITESP : Token::kILLEGAL;
}
-
void Scanner::ScanIdentChars(bool allow_dollar) {
ASSERT(IsIdentStartChar(c0_));
ASSERT(allow_dollar || (c0_ != '$'));
@@ -339,7 +315,6 @@ void Scanner::ScanIdentChars(bool allow_dollar) {
current_token_.literal = &literal;
}
-
// Parse integer or double number literal of format:
// NUMBER = INTEGER | DOUBLE
// INTEGER = D+ | (("0x" | "0X") H+)
@@ -393,14 +368,12 @@ void Scanner::ScanNumber(bool dec_point_seen) {
}
}
-
void Scanner::SkipLine() {
while (c0_ != '\n' && c0_ != '\0') {
ReadChar();
}
}
-
void Scanner::ScanScriptTag() {
ReadChar();
ASSERT(c0_ == '!');
@@ -410,7 +383,6 @@ void Scanner::ScanScriptTag() {
SkipLine();
}
-
void Scanner::ScanLiteralString(bool is_raw) {
ASSERT(!IsScanningString());
ASSERT(c0_ == '"' || c0_ == '\'');
@@ -427,7 +399,6 @@ void Scanner::ScanLiteralString(bool is_raw) {
ScanLiteralStringChars(is_raw, string_is_multiline_);
}
-
bool Scanner::ScanHexDigits(int digits, int32_t* value) {
*value = 0;
for (int i = 0; i < digits; ++i) {
@@ -442,7 +413,6 @@ bool Scanner::ScanHexDigits(int digits, int32_t* value) {
return true;
}
-
bool Scanner::ScanHexDigits(int min_digits, int max_digits, int32_t* value) {
*value = 0;
ReadChar();
@@ -461,7 +431,6 @@ bool Scanner::ScanHexDigits(int min_digits, int max_digits, int32_t* value) {
return true;
}
-
void Scanner::ScanEscapedCodePoint(int32_t* code_point) {
ASSERT(c0_ == 'u' || c0_ == 'x');
bool is_valid;
@@ -484,7 +453,6 @@ void Scanner::ScanEscapedCodePoint(int32_t* code_point) {
}
}
-
void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) {
GrowableArray<int32_t> string_chars(64);
@@ -606,7 +574,6 @@ void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) {
}
}
-
void Scanner::Scan() {
newline_seen_ = false;
@@ -880,7 +847,6 @@ void Scanner::Scan() {
} while (current_token_.kind == Token::kWHITESP);
}
-
void Scanner::ScanAll(TokenCollector* collector) {
Reset();
do {
@@ -905,7 +871,6 @@ void Scanner::ScanAll(TokenCollector* collector) {
} while (current_token_.kind != Token::kEOS);
}
-
void Scanner::ScanTo(intptr_t token_index) {
ASSERT(token_index >= 0);
intptr_t index = 0;
@@ -930,7 +895,6 @@ void Scanner::ScanTo(intptr_t token_index) {
} while ((token_index >= index) && (current_token_.kind != Token::kEOS));
}
-
void Scanner::InitOnce() {
ASSERT(Isolate::Current() == Dart::vm_isolate());
for (int i = 0; i < kNumLowercaseChars; i++) {
« no previous file with comments | « runtime/vm/scanner.h ('k') | runtime/vm/scanner_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698