done: while()

in src/parser/cssParser.ts [1149:1213]


		done: while (true) {
			switch (this.token.type) {
				case TokenType.SemiColon:
					if (isTopLevel()) {
						break done;
					}
					break;
				case TokenType.EOF:
					if (curlyDepth > 0) {
						return this.finish(node, ParseError.RightCurlyExpected);
					} else if (bracketsDepth > 0) {
						return this.finish(node, ParseError.RightSquareBracketExpected);
					} else if (parensDepth > 0) {
						return this.finish(node, ParseError.RightParenthesisExpected);
					} else {
						return this.finish(node);
					}
				case TokenType.CurlyL:
					curlyLCount++;
					curlyDepth++;
					break;
				case TokenType.CurlyR:
					curlyDepth--;
					// End of at-rule, consume CurlyR and return node
					if (curlyLCount > 0 && curlyDepth === 0) {
						this.consumeToken();

						if (bracketsDepth > 0) {
							return this.finish(node, ParseError.RightSquareBracketExpected);
						} else if (parensDepth > 0) {
							return this.finish(node, ParseError.RightParenthesisExpected);
						}
						break done;
					}
					if (curlyDepth < 0) {
						// The property value has been terminated without a semicolon, and
						// this is the last declaration in the ruleset.
						if (parensDepth === 0 && bracketsDepth === 0) {
							break done;
						}
						return this.finish(node, ParseError.LeftCurlyExpected);
					}
					break;
				case TokenType.ParenthesisL:
					parensDepth++;
					break;
				case TokenType.ParenthesisR:
					parensDepth--;
					if (parensDepth < 0) {
						return this.finish(node, ParseError.LeftParenthesisExpected);
					}
					break;
				case TokenType.BracketL:
					bracketsDepth++;
					break;
				case TokenType.BracketR:
					bracketsDepth--;
					if (bracketsDepth < 0) {
						return this.finish(node, ParseError.LeftSquareBracketExpected);
					}
					break;
			}

			this.consumeToken();
		}