C# 클래스 Crisis.CommandLine.Lexer

Provides tokenization of command lines. Used by the CommandLineParser.
파일 보기 프로젝트 열기: teeknofil/Crisis-Wordlist-Generator 1 사용 예제들

Private Properties

프로퍼티 타입 설명
FillCharacterBuffer int
GetNextValueToken ValueToken
IsAssignmentCharacter bool
IsEscapeCharacter bool
IsWhiteSpace bool
LA int
MatchAssignmentCharacter Token
MatchEndOption Token
MatchFileOption Token
MatchGroupedOptionNames Token
MatchLongOptionName Token
MatchLongUnixOption Token
MatchPlusOption Token
MatchQuotedValue Token
MatchShortUnixOption Token
MatchUnquotedValue Token
MatchValue Token
MatchWindowsOption Token
ReadCharacter int
ReadPossiblyEscapedCharacter int
SkipCharacters bool

공개 메소드들

메소드 설명
GetNextToken ( ) : Token

Gets the next token from the input.

Lexer ( TextReader input, ICollection escapeCharacters, QuotationInfo>.IDictionary quotations, OptionStyles>.IDictionary assignmentCharacters ) : System

Initializes a new instance of the Lexer class.

Lexer ( TextReader input, Lexer parent ) : System

비공개 메소드들

메소드 설명
FillCharacterBuffer ( ) : int

Fills up the character buffer with as many character as fits or are available, whichever is the least.

GetNextValueToken ( ) : ValueToken
IsAssignmentCharacter ( int ch ) : bool

Determines whether the specified character is an assignment character for the OptionStyles currently being parsed.

IsEscapeCharacter ( int ch ) : bool

Determines whether the specified character is a character used to escape other characters, such as the backslash '\' in C# strings.

The escape character in use is not context sensitive.

IsWhiteSpace ( int ch ) : bool

Determines whether the specified character is a white space character.

LA ( int offset ) : int

Returns the lookahead character for the specified offset.

This is the last character that will be read by ReadCharacter if it is called offset number of times.

MatchAssignmentCharacter ( ) : Token

Matches an assignment character within the current context.

MatchEndOption ( ) : Token

Matches the end of options token, represented by a double-dash ('--').

This method does not make the lexer stop parsing options. The calling application needs to set EnabledOptionStyles to OptionStyles.None for that to happen, which can be done in response to this token being returned.

MatchFileOption ( ) : Token
MatchGroupedOptionNames ( ) : Token

Matches one or more options in sequence with a one-character name.

This method is called by the other methods that start with "MatchShort". Even though this method only returns the first option read, the mTokenQueue is filled up with the rest of them.

MatchLongOptionName ( ) : Token

Matches a long option name with the current option style.

MatchLongUnixOption ( ) : Token

Matches a long option name with the OptionStyles.LongUnix style. This may be preceeded by either a single ('-') or a double ('--') dash.

MatchPlusOption ( ) : Token

Matches an option name (or names depending on the option styles enabled) preceeded by the '+' sign.

This method calls MatchGroupedOptionNames if the OptionStyles.Group style is enabled, otherwise MatchLongOptionName.

MatchQuotedValue ( ) : Token

Matches a quoted value.

A quoted value is any string that starts with a quote character

MatchShortUnixOption ( ) : Token

Matches an option name (or names depending on the option styles enabled) preceeded by the '-' sign.

This method calls MatchGroupedOptionNames if the OptionStyles.Group style is enabled, otherwise MatchLongOptionName.

MatchUnquotedValue ( ) : Token

Matches an unquoted value. An unquoted value is any string that is terminated by an unescaped white space or the end of input.

MatchValue ( ) : Token

Matches a value.

This method determines whether the value to be read is quoted or not and calls the appropriate method to do the parsing.

MatchWindowsOption ( ) : Token

Matches a long option name with the OptionStyles.Windows style. This must be preceeded a single slash ('/').

ReadCharacter ( ) : int

Reads the next character from the input and moves the position of the input stream (or buffer depending on from where the character was read) one step forward.

ReadPossiblyEscapedCharacter ( char currentQuote ) : int

Reads a character from the input stream which may be escaped within the specified context.

The context is determined by the currentQuote argument, which indicates the type of quotes that were used for quoting the value currently being parsed. The special value of -1 indicates that no quotes were used. If an escape character is found this method will actually read two characters and convert it to the replacement specified.

SkipCharacters ( int count ) : bool

Skips ahead the specified number of characters in the input stream (or buffer).

This has the same effect as calling ReadCharacter count number of times.

메소드 상세

GetNextToken() 공개 메소드

Gets the next token from the input.
public GetNextToken ( ) : Token
리턴 Token

Lexer() 공개 메소드

Initializes a new instance of the Lexer class.
public Lexer ( TextReader input, ICollection escapeCharacters, QuotationInfo>.IDictionary quotations, OptionStyles>.IDictionary assignmentCharacters ) : System
input TextReader The to use for input. This need not be seekable.
escapeCharacters ICollection The escape characters that should be recognized.
quotations QuotationInfo>.IDictionary The quotations that should be recognized.
assignmentCharacters OptionStyles>.IDictionary The assignment characters that should be recognized.
리턴 System

Lexer() 공개 메소드

public Lexer ( TextReader input, Lexer parent ) : System
input TextReader
parent Lexer
리턴 System