Skip to content

Commit 7afcaba

Browse files
parser: improve formatting of the comments (#2759)
1 parent fe3040f commit 7afcaba

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

src/language/parser.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,7 @@ export class Parser {
14011401
// Core parsing utility functions
14021402

14031403
/**
1404-
* Returns a location object, used to identify the place in
1405-
* the source that created a given parsed object.
1404+
* Returns a location object, used to identify the place in the source that created a given parsed object.
14061405
*/
14071406
loc(startToken: Token): Location | void {
14081407
if (this._options?.noLocation !== true) {
@@ -1422,8 +1421,8 @@ export class Parser {
14221421
}
14231422

14241423
/**
1425-
* If the next token is of the given kind, return that token after advancing
1426-
* the lexer. Otherwise, do not change the parser state and throw an error.
1424+
* If the next token is of the given kind, return that token after advancing the lexer.
1425+
* Otherwise, do not change the parser state and throw an error.
14271426
*/
14281427
expectToken(kind: TokenKindEnum): Token {
14291428
const token = this._lexer.token;
@@ -1440,8 +1439,8 @@ export class Parser {
14401439
}
14411440

14421441
/**
1443-
* If the next token is of the given kind, return that token after advancing
1444-
* the lexer. Otherwise, do not change the parser state and return undefined.
1442+
* If the next token is of the given kind, return that token after advancing the lexer.
1443+
* Otherwise, do not change the parser state and return undefined.
14451444
*/
14461445
expectOptionalToken(kind: TokenKindEnum): ?Token {
14471446
const token = this._lexer.token;
@@ -1470,8 +1469,8 @@ export class Parser {
14701469
}
14711470

14721471
/**
1473-
* If the next token is a given keyword, return "true" after advancing
1474-
* the lexer. Otherwise, do not change the parser state and return "false".
1472+
* If the next token is a given keyword, return "true" after advancing the lexer.
1473+
* Otherwise, do not change the parser state and return "false".
14751474
*/
14761475
expectOptionalKeyword(value: string): boolean {
14771476
const token = this._lexer.token;
@@ -1483,8 +1482,7 @@ export class Parser {
14831482
}
14841483

14851484
/**
1486-
* Helper function for creating an error when an unexpected lexed token
1487-
* is encountered.
1485+
* Helper function for creating an error when an unexpected lexed token is encountered.
14881486
*/
14891487
unexpected(atToken?: ?Token): GraphQLError {
14901488
const token = atToken ?? this._lexer.token;
@@ -1496,10 +1494,9 @@ export class Parser {
14961494
}
14971495

14981496
/**
1499-
* Returns a possibly empty list of parse nodes, determined by
1500-
* the parseFn. This list begins with a lex token of openKind
1501-
* and ends with a lex token of closeKind. Advances the parser
1502-
* to the next lex token after the closing token.
1497+
* Returns a possibly empty list of parse nodes, determined by the parseFn.
1498+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
1499+
* Advances the parser to the next lex token after the closing token.
15031500
*/
15041501
any<T>(
15051502
openKind: TokenKindEnum,
@@ -1516,10 +1513,9 @@ export class Parser {
15161513

15171514
/**
15181515
* Returns a list of parse nodes, determined by the parseFn.
1519-
* It can be empty only if open token is missing otherwise it will always
1520-
* return non-empty list that begins with a lex token of openKind and ends
1521-
* with a lex token of closeKind. Advances the parser to the next lex token
1522-
* after the closing token.
1516+
* It can be empty only if open token is missing otherwise it will always return non-empty list
1517+
* that begins with a lex token of openKind and ends with a lex token of closeKind.
1518+
* Advances the parser to the next lex token after the closing token.
15231519
*/
15241520
optionalMany<T>(
15251521
openKind: TokenKindEnum,
@@ -1537,10 +1533,9 @@ export class Parser {
15371533
}
15381534

15391535
/**
1540-
* Returns a non-empty list of parse nodes, determined by
1541-
* the parseFn. This list begins with a lex token of openKind
1542-
* and ends with a lex token of closeKind. Advances the parser
1543-
* to the next lex token after the closing token.
1536+
* Returns a non-empty list of parse nodes, determined by the parseFn.
1537+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
1538+
* Advances the parser to the next lex token after the closing token.
15441539
*/
15451540
many<T>(
15461541
openKind: TokenKindEnum,
@@ -1557,15 +1552,15 @@ export class Parser {
15571552
}
15581553

15591554
/**
1560-
* A helper function to describe a token as a string for debugging
1555+
* A helper function to describe a token as a string for debugging.
15611556
*/
15621557
function getTokenDesc(token: Token): string {
15631558
const value = token.value;
15641559
return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : '');
15651560
}
15661561

15671562
/**
1568-
* A helper function to describe a token kind as a string for debugging
1563+
* A helper function to describe a token kind as a string for debugging.
15691564
*/
15701565
function getTokenKindDesc(kind: TokenKindEnum): string {
15711566
return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;

0 commit comments

Comments
 (0)