Skip to content

Commit ba154c0

Browse files
committed
Update protoc.js
1 parent 2d8d002 commit ba154c0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/protoc.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,12 @@ protoc.Parser = class {
558558
if (obj) {
559559
obj.file = this._file;
560560
}
561-
if (this._tokenizer.eat("{")) {
561+
if (this._tokenizer.accept("{")) {
562562
let token = '';
563563
while ((token = this._tokenizer.next()) !== "}") {
564564
ifCallback(token);
565565
}
566-
this._tokenizer.eat(";");
566+
this._tokenizer.accept(";");
567567
} else {
568568
if (elseCallback) {
569569
elseCallback();
@@ -790,7 +790,7 @@ protoc.Parser = class {
790790
}
791791

792792
_parseOption(parent, token) {
793-
const custom = this._tokenizer.eat("(");
793+
const custom = this._tokenizer.accept("(");
794794
token = this._tokenizer.next();
795795
if (!protoc.Parser._isTypeReference(token)) {
796796
throw this._parseError(token, 'name');
@@ -810,8 +810,8 @@ protoc.Parser = class {
810810
}
811811

812812
_parseOptionValue(parent, name) {
813-
if (this._tokenizer.eat('{')) {
814-
while (!this._tokenizer.eat('}')) {
813+
if (this._tokenizer.accept('{')) {
814+
while (!this._tokenizer.accept('}')) {
815815
const token = this._tokenizer.next();
816816
if (!protoc.Parser._isName(token)) {
817817
throw this._parseError(token, 'name');
@@ -826,19 +826,19 @@ protoc.Parser = class {
826826
parent.options.set(`${name}.${token}`, this._readValue());
827827
}
828828
}
829-
this._tokenizer.eat(',');
829+
this._tokenizer.accept(',');
830830
}
831831
} else {
832832
parent.options.set(name, this._readValue());
833833
}
834834
}
835835

836836
_parseInlineOptions(parent) {
837-
if (this._tokenizer.eat('[')) {
837+
if (this._tokenizer.accept('[')) {
838838
do {
839839
this._parseOption(parent, 'option');
840840
}
841-
while (this._tokenizer.eat(','));
841+
while (this._tokenizer.accept(','));
842842
this._tokenizer.expect(']');
843843
}
844844
return parent;
@@ -892,11 +892,11 @@ protoc.Parser = class {
892892
target.push(this._readString());
893893
} else {
894894
const start = this._parseId(this._tokenizer.next());
895-
const end = this._tokenizer.eat('to') ? this._parseId(this._tokenizer.next()) : start;
895+
const end = this._tokenizer.accept('to') ? this._parseId(this._tokenizer.next()) : start;
896896
target.push([start, end]);
897897
}
898898
}
899-
while (this._tokenizer.eat(','));
899+
while (this._tokenizer.accept(','));
900900
this._tokenizer.expect(';');
901901
}
902902

@@ -1075,7 +1075,7 @@ protoc.Tokenizer = class {
10751075
this.next();
10761076
}
10771077

1078-
eat(value) {
1078+
accept(value) {
10791079
const token = this.peek();
10801080
if (token === value) {
10811081
this.next();

0 commit comments

Comments
 (0)