C# Класс Microsoft.R.Core.Formatting.BraceHandler

Provides set of services for brace handling in formatting
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BraceHandler ( TokenStream tokens, TextBuilder tb ) : System
GetCloseCurlyBraceIndentSize ( RToken closeCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int

Given closing curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.

GetMatchingBraceToken ( RTokenType tokenType ) : RTokenType
GetOpenCurlyBraceIndentSize ( RToken openCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int

Given opening curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.

HandleBrace ( ) : void
IsInArguments ( ) : bool

Tells if scope is opening inside function or indexer arguments and hence user indentation of curly braces must be respected.

Приватные методы

Метод Описание
AssociateKeywordPositionWithOpenBrace ( RToken openBrace, int keywordPosition ) : void

Associates keyword with the open brace. Used when formatter needs to determine indentation level of the new formatting scope when it encounters { token.

Closing curly indentation is defined by the line that either holds the opening curly brace or the line that holds keyword that defines the expression that the curly belongs to. Examples: x <- function(a) { } x <- function(a) { } First keyword is associated with the open brace, then, when brace pair closes, association is propagated to the closing brace and then to the opening curly. When curly pair closes formatter then finds appropriate indentation based on the line that contains the keyword token.

AssociateKeywordPositionWithToken ( RToken source, RToken target ) : void

Propagates keyword association to the target token. AssociateKeywordPositionWithOpenBrace

GetNearestNonWhitespaceIndex ( ) : int
TryPopMatchingBrace ( RToken token ) : RToken

Описание методов

BraceHandler() публичный Метод

public BraceHandler ( TokenStream tokens, TextBuilder tb ) : System
tokens TokenStream
tb Microsoft.Languages.Core.Formatting.TextBuilder
Результат System

GetCloseCurlyBraceIndentSize() публичный Метод

Given closing curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.
public GetCloseCurlyBraceIndentSize ( RToken closeCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
closeCurlyBraceToken RToken
tb Microsoft.Languages.Core.Formatting.TextBuilder
options Microsoft.R.Core.Formatting.RFormatOptions
Результат int

GetMatchingBraceToken() публичный статический Метод

public static GetMatchingBraceToken ( RTokenType tokenType ) : RTokenType
tokenType RTokenType
Результат RTokenType

GetOpenCurlyBraceIndentSize() публичный Метод

Given opening curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.
public GetOpenCurlyBraceIndentSize ( RToken openCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
openCurlyBraceToken RToken
tb Microsoft.Languages.Core.Formatting.TextBuilder
options Microsoft.R.Core.Formatting.RFormatOptions
Результат int

HandleBrace() публичный Метод

public HandleBrace ( ) : void
Результат void

IsInArguments() публичный Метод

Tells if scope is opening inside function or indexer arguments and hence user indentation of curly braces must be respected.
public IsInArguments ( ) : bool
Результат bool