C# Class Microsoft.Silverlight.Testing.Harness.TagManager.ExpressionEvaluator

Evaluate tag expressions.
Tag expressions are derived from the following EBNF grammar: {Expression} := {Expression} + {Term} | {Expression} - {Term} | {Term} {Term} := {Term} * {Factor} | {Factor} {Factor} := !{Factor} | ({Expression}) | {Tag} {Tag} := All | [^InvalidCharacters]+ The non-terminals for {Expression} and {Term} will be left factored in the recursive descent parser below.
显示文件 Open project: garyjohnson/wpnest

Public Methods

Method Description
Evaluate ( TagManager owner, string tagExpression ) : IEnumerable

Evaluate a tag expression.

Private Methods

Method Description
CreateEmptyList ( ) : List

Creates a new empty collection.

Evaluate ( ) : IEnumerable

Evaluate an expression.

ExpressionEvaluator ( TagManager owner, string tagExpression ) : System

Create an expression evaluator.

Match ( string expected ) : void

Match a sequence of characters.

ReadExpression ( ) : IEnumerable

Evaluate an expression.

We need to factor out left recursion, so: {Expression} := {Expression} + {Term} | {Expression} - {Term} | {Term} becomes: {Expression} := {Term}{Expression'} {Expression'} := #empty# + {Term}{Expression'} - {Term}{Expression'}

ReadExpression ( IEnumerable term ) : IEnumerable

Evaluate an expression.

Non-terminal created for left-factoring: {Expression'} := #empty# + {Term}{Expression'} - {Term}{Expression'}

ReadFactor ( ) : IEnumerable

Evaluate a factor.

{Factor} := !{Factor} | ({Expression}) | {Tag}

ReadTag ( ) : IEnumerable

Evaluate a tag.

{Tag} := All | [^InvalidCharacters]+

ReadTerm ( ) : IEnumerable

Evaluate a term.

We need to factor out left recursion, so: {Term} := {Factor} * {Term} | {Factor} becomes: {Term} := {Factor}{Term'} {Term'} := #empty# ^ {Factor}{Term'}

ReadTerm ( IEnumerable factor ) : IEnumerable

Evaluate a term.

Non-terminal created for left-factoring: {Term'} := #empty# ^ {Factor}{Term'}

TryMatch ( string expected ) : bool

Try to match a sequence of characters.

Method Details

Evaluate() public static method

Evaluate a tag expression.
public static Evaluate ( TagManager owner, string tagExpression ) : IEnumerable
owner TagManager The owner object.
tagExpression string Tag expression.
return IEnumerable