C# 클래스 ComponentFactory.Quicksilver.Binding.Arithmetic

Accept and evaluate simple arithmetic expressions.
Top down predictive parser using an LL(1) BNF expression ::= term expression2 expression2 ::= '+' term expression2 | '-' term expression2 | {empty} term ::= factor term2 term2 ::= '*' factor term2 | '/' factor term2 | {empty} factor ::= '+' factor | '-' factor | primary primary ::= integer-literal | real-literal '(' expression ')'
파일 보기 프로젝트 열기: ComponentFactory/Quicksilver

Private Properties

프로퍼티 타입 설명

공개 메소드들

메소드 설명
Arithmetic ( ) : System

Initialize a new instance of the Arithmetic class.

Arithmetic ( System.Language language ) : System

Initialize a new instance of the Arithmetic class.

Arithmetic ( string input ) : System

Initialize a new instance of the Arithmetic class.

Arithmetic ( string input, System.Language language ) : System

Initialize a new instance of the Arithmetic class.

Evaluate ( ) : EvalResult

Evaluate and return result.

Evaluate ( object thisObject ) : EvalResult

Evaluate and return result.

Parse ( string input ) : void

Parse the provided input string.

ToString ( ) : string

Human readable version of the parsed input.

보호된 메소드들

메소드 설명
ParseExpression ( ) : EvalNode

Parse the 'expression' rule.

expression ::= term expression2

ParseExpression2 ( ) : EvalNode

Parse the 'expression2' rule.

expression2 ::= '+' term expression2 | '-' term expression2 | {empty}

ParseFactor ( ) : EvalNode

Parse the 'factor' rule.

factor ::= '+' factor | '-' factor | primary

ParsePrimary ( ) : EvalNode

Parse the 'primary' rule.

primary ::= integer-literal | real-literal '(' expression ')'

ParseTerm ( ) : EvalNode

Parse the 'term' rule.

term ::= factor term2

ParseTerm2 ( ) : EvalNode

Process the term2 rule.

term2 ::= '*' factor term2 | '/' factor term2 | {empty}

메소드 상세

Arithmetic() 공개 메소드

Initialize a new instance of the Arithmetic class.
public Arithmetic ( ) : System
리턴 System

Arithmetic() 공개 메소드

Initialize a new instance of the Arithmetic class.
public Arithmetic ( System.Language language ) : System
language System.Language Language used for parsing.
리턴 System

Arithmetic() 공개 메소드

Initialize a new instance of the Arithmetic class.
public Arithmetic ( string input ) : System
input string Input string to parse.
리턴 System

Arithmetic() 공개 메소드

Initialize a new instance of the Arithmetic class.
public Arithmetic ( string input, System.Language language ) : System
input string Input string to parse.
language System.Language Language used for parsing.
리턴 System

Evaluate() 공개 메소드

Evaluate and return result.
public Evaluate ( ) : EvalResult
리턴 EvalResult

Evaluate() 공개 메소드

Evaluate and return result.
public Evaluate ( object thisObject ) : EvalResult
thisObject object Reference to object that is exposed as 'this'.
리턴 EvalResult

Parse() 공개 메소드

Parse the provided input string.
public Parse ( string input ) : void
input string Input text.
리턴 void

ParseExpression() 보호된 메소드

Parse the 'expression' rule.
expression ::= term expression2
protected ParseExpression ( ) : EvalNode
리턴 EvalNode

ParseExpression2() 보호된 메소드

Parse the 'expression2' rule.
expression2 ::= '+' term expression2 | '-' term expression2 | {empty}
protected ParseExpression2 ( ) : EvalNode
리턴 EvalNode

ParseFactor() 보호된 메소드

Parse the 'factor' rule.
factor ::= '+' factor | '-' factor | primary
protected ParseFactor ( ) : EvalNode
리턴 EvalNode

ParsePrimary() 보호된 메소드

Parse the 'primary' rule.
primary ::= integer-literal | real-literal '(' expression ')'
protected ParsePrimary ( ) : EvalNode
리턴 EvalNode

ParseTerm() 보호된 메소드

Parse the 'term' rule.
term ::= factor term2
protected ParseTerm ( ) : EvalNode
리턴 EvalNode

ParseTerm2() 보호된 메소드

Process the term2 rule.
term2 ::= '*' factor term2 | '/' factor term2 | {empty}
protected ParseTerm2 ( ) : EvalNode
리턴 EvalNode

ToString() 공개 메소드

Human readable version of the parsed input.
public ToString ( ) : string
리턴 string