C# 클래스 Kooboo.Commerce.Rules.Conditions.Parsing.Parser

The parser used to parse the source into expression tree (abstract syntax tree).
Grammer: expression : term [ OR term ]... term : factor [ AND factor ] factor : leaf_condition | ( expression ) comparison : identifier comparison_op comparison_value comparison_op : identifier in the available comparison operator list comparison_value : string_literal | number Notes: - leaf_condition means the condition expression without nesting expressions; - term and factor are temp non-terminals used to handle operator (AND, OR) precedence. Expressions could be simply expressed as: condition OR/AND condition, but with this grammer, we are not able to handle operator precendence. We have to split each operator: - Lower precedence operator first, and the operands should be the production rule of a higher precedence operator. - Because precedence(OR) is smaller than precendence(AND), so OR first and we write: expression: term [ OR term] - Then write the 'term' production rule with the higher precedence operator, that is, 'AND', so then we write: term: factor [ AND factor]
파일 보기 프로젝트 열기: Kooboo/Ecommerce

공개 메소드들

메소드 설명
Parse ( string source, IEnumerable registeredComparisonOperators ) : Expression

비공개 메소드들

메소드 설명
Comparison ( ) : Expression
ComparisonValue ( ) : ComparisonValueExpression
Expression ( ) : Expression
Factor ( ) : Expression
Term ( ) : Expression

메소드 상세

Parse() 공개 메소드

public Parse ( string source, IEnumerable registeredComparisonOperators ) : Expression
source string
registeredComparisonOperators IEnumerable
리턴 Kooboo.Commerce.Rules.Conditions.Expressions.Expression