microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/bounds

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

compiler/qsc_formatter/src/lib.rs

15lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! This module contains the Q# formatter, which can be used by calling
5//! the format function available from this module. The formatting algorithm
6//! uses the cooked and concrete tokens from the parser crate to create a
7//! token stream of the given source code string. It then uses a sliding window
8//! over this token stream to apply formatting rules when the selected tokens
9//! match certain patterns. The formatting algorithm uses state to help make
10//! correct decisions, particularly around indentation. Formatting rules will
11//! generate text edit objects when the format of the input string does not
12//! match the expected format, and these edits are returned on using the
13//! formatter.
14
15pub mod formatter;
16