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

Unified Diff: runtime/vm/regexp_parser.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/regexp_parser.h ('k') | runtime/vm/report.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/regexp_parser.cc
diff --git a/runtime/vm/regexp_parser.cc b/runtime/vm/regexp_parser.cc
index 257f0fee247c9e8176be7103073c990d22c1e5a2..5d10d0872ed132d3837468cb235349a247a24272 100644
--- a/runtime/vm/regexp_parser.cc
+++ b/runtime/vm/regexp_parser.cc
@@ -2,9 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "vm/regexp_parser.h"
#include "vm/longjump.h"
#include "vm/object_store.h"
-#include "vm/regexp_parser.h"
namespace dart {
@@ -27,7 +27,6 @@ RegExpBuilder::RegExpBuilder()
{
}
-
void RegExpBuilder::FlushCharacters() {
pending_empty_ = false;
if (characters_ != NULL) {
@@ -38,7 +37,6 @@ void RegExpBuilder::FlushCharacters() {
}
}
-
void RegExpBuilder::FlushText() {
FlushCharacters();
intptr_t num_text = text_.length();
@@ -55,7 +53,6 @@ void RegExpBuilder::FlushText() {
text_.Clear();
}
-
void RegExpBuilder::AddCharacter(uint16_t c) {
pending_empty_ = false;
if (characters_ == NULL) {
@@ -65,12 +62,10 @@ void RegExpBuilder::AddCharacter(uint16_t c) {
LAST(ADD_CHAR);
}
-
void RegExpBuilder::AddEmpty() {
pending_empty_ = true;
}
-
void RegExpBuilder::AddAtom(RegExpTree* term) {
if (term->IsEmpty()) {
AddEmpty();
@@ -86,19 +81,16 @@ void RegExpBuilder::AddAtom(RegExpTree* term) {
LAST(ADD_ATOM);
}
-
void RegExpBuilder::AddAssertion(RegExpTree* assert) {
FlushText();
terms_.Add(assert);
LAST(ADD_ASSERT);
}
-
void RegExpBuilder::NewAlternative() {
FlushTerms();
}
-
void RegExpBuilder::FlushTerms() {
FlushText();
intptr_t num_terms = terms_.length();
@@ -120,7 +112,6 @@ void RegExpBuilder::FlushTerms() {
LAST(ADD_NONE);
}
-
RegExpTree* RegExpBuilder::ToRegExp() {
FlushTerms();
intptr_t num_alternatives = alternatives_.length();
@@ -138,7 +129,6 @@ RegExpTree* RegExpBuilder::ToRegExp() {
return new (Z) RegExpDisjunction(alternatives);
}
-
void RegExpBuilder::AddQuantifierToAtom(
intptr_t min,
intptr_t max,
@@ -215,7 +205,6 @@ RegExpParser::RegExpParser(const String& in, String* error, bool multiline)
Advance();
}
-
uint32_t RegExpParser::Next() {
if (has_next()) {
return in().CharAt(next_pos_);
@@ -224,7 +213,6 @@ uint32_t RegExpParser::Next() {
}
}
-
void RegExpParser::Advance() {
if (next_pos_ < in().Length()) {
current_ = in().CharAt(next_pos_);
@@ -235,25 +223,21 @@ void RegExpParser::Advance() {
}
}
-
void RegExpParser::Reset(intptr_t pos) {
next_pos_ = pos;
has_more_ = (pos < in().Length());
Advance();
}
-
void RegExpParser::Advance(intptr_t dist) {
next_pos_ += dist - 1;
Advance();
}
-
bool RegExpParser::simple() {
return simple_;
}
-
void RegExpParser::ReportError(const char* message) {
failed_ = true;
*error_ = String::New(message);
@@ -266,7 +250,6 @@ void RegExpParser::ReportError(const char* message) {
UNREACHABLE();
}
-
// Pattern ::
// Disjunction
RegExpTree* RegExpParser::ParsePattern() {
@@ -280,7 +263,6 @@ RegExpTree* RegExpParser::ParsePattern() {
return result;
}
-
// Disjunction ::
// Alternative
// Alternative | Disjunction
@@ -632,7 +614,6 @@ RegExpTree* RegExpParser::ParseDisjunction() {
}
}
-
#ifdef DEBUG
// Currently only used in an ASSERT.
static bool IsSpecialClassEscape(uint32_t c) {
@@ -650,7 +631,6 @@ static bool IsSpecialClassEscape(uint32_t c) {
}
#endif
-
// In order to know whether an escape is a backreference or not we have to scan
// the entire regexp and find the number of capturing parentheses. However we
// don't want to scan the regexp twice unless it is necessary. This mini-parser
@@ -689,12 +669,10 @@ void RegExpParser::ScanForCaptures() {
is_scanned_for_captures_ = true;
}
-
static inline bool IsDecimalDigit(int32_t c) {
return '0' <= c && c <= '9';
}
-
bool RegExpParser::ParseBackReferenceIndex(intptr_t* index_out) {
ASSERT('\\' == current());
ASSERT('1' <= Next() && Next() <= '9');
@@ -731,7 +709,6 @@ bool RegExpParser::ParseBackReferenceIndex(intptr_t* index_out) {
return true;
}
-
// QuantifierPrefix ::
// { DecimalDigits }
// { DecimalDigits , }
@@ -799,7 +776,6 @@ bool RegExpParser::ParseIntervalQuantifier(intptr_t* min_out,
return true;
}
-
uint32_t RegExpParser::ParseOctalLiteral() {
ASSERT(('0' <= current() && current() <= '7') || current() == kEndMarker);
// For compatibility with some other browsers (not all), we parse
@@ -817,7 +793,6 @@ uint32_t RegExpParser::ParseOctalLiteral() {
return value;
}
-
// Returns the value (0 .. 15) of a hexadecimal character c.
// If c is not a legal hexadecimal character, returns a value < 0.
static inline intptr_t HexValue(uint32_t c) {
@@ -828,7 +803,6 @@ static inline intptr_t HexValue(uint32_t c) {
return -1;
}
-
bool RegExpParser::ParseHexEscape(intptr_t length, uint32_t* value) {
intptr_t start = position();
uint32_t val = 0;
@@ -850,7 +824,6 @@ bool RegExpParser::ParseHexEscape(intptr_t length, uint32_t* value) {
return true;
}
-
uint32_t RegExpParser::ParseClassCharacterEscape() {
ASSERT(current() == '\\');
DEBUG_ASSERT(has_next() && !IsSpecialClassEscape(Next()));
@@ -936,7 +909,6 @@ uint32_t RegExpParser::ParseClassCharacterEscape() {
return 0;
}
-
CharacterRange RegExpParser::ParseClassAtom(uint16_t* char_class) {
ASSERT(0 == *char_class);
uint32_t first = current();
@@ -965,7 +937,6 @@ CharacterRange RegExpParser::ParseClassAtom(uint16_t* char_class) {
}
}
-
static const uint16_t kNoCharClass = 0;
// Adds range or pre-defined character class to character ranges.
@@ -981,7 +952,6 @@ static inline void AddRangeOrEscape(ZoneGrowableArray<CharacterRange>* ranges,
}
}
-
RegExpTree* RegExpParser::ParseCharacterClass() {
static const char* kUnterminated = "Unterminated character class";
static const char* kRangeOutOfOrder = "Range out of order in character class";
@@ -1039,7 +1009,6 @@ RegExpTree* RegExpParser::ParseCharacterClass() {
return new (Z) RegExpCharacterClass(ranges, is_negated);
}
-
// ----------------------------------------------------------------------------
// The Parser interface.
« no previous file with comments | « runtime/vm/regexp_parser.h ('k') | runtime/vm/report.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698