BNF Definition of Cocoa Predicates
OSXDEV
Predicates Programming Guide로 이동
이 문서는 코코아 프리디케이트를 베커스-나우어 형식의 표기법으로 정의한다.
[편집] NSPredicate
NSPredicate ::= NSComparisonPredicate | NSCompoundPredicate | "(" NSPredicate ")" | TRUEPREDICATE | FALSEPREDICATE
[편집] NSCompoundPredicate
NSCompoundPredicate ::= NSPredicate "AND" NSPredicate
| NSPredicate "OR" NSPredicate
| "NOT" NSPredicate
[편집] NSComparisonPredicate
NSComparisonPredicate ::= expression operation expression
| aggregate_qualifier NSComparisonPredicate
[편집] Operations
CONTAINS 와 IN 는 매개변수의 타입에 따라 aggregate 연산과 string 연산, 모두에 적용된다,
operation ::= "=" | "!=" | "<" | ">" | "<=" | ">="
| BETWEEN
| aggregate_operations [ "[" string_options "]" ]
aggregate_operations ::= CONTAINS | IN | string_operations
string_operations ::= BEGINSWITH | ENDSWITH | LIKE | MATCHES
string_options ::= c | d | cd
[편집] Aggregate Qualifier
aggregate_qualifier ::= ANY | ALL | NONE | SOME
[편집] Expression
expression ::= "(" expression ")"
| binary_expression
| function_expression
| assignment_expression
| index_expression
| keypath_expression
| value_expression
[편집] Value Expression
value_expression ::= literal_value | literal_aggregate
[편집] Literal Value
literal_value ::= string_value
| numeric_value
| predicate_argument
| predicate_variable
| NULL
| TRUE
| FALSE
| SELF
[편집] String Value
string_value ::= "text" | 'text'
[편집] Predicate Argument
predicate_argument ::= "%" format_argument
[편집] Format Argument
format_argument ::= "@" | "%" | "K"
printf style conversion character
[편집] Predicate Variable
predicate_variable ::= "$" identifier
[편집] Keypath Expression
keypath_expression ::= identifier | "@" identifier | expression "." expression
[편집] Literal Aggregate
literal_aggregate ::= "{" [ expression [ "," expression ... ] ] "}"
[편집] Index Expression
index_expression ::= array_expression "[" integer_expression "]"
| dictionary_expression "[" expression "]"
| aggregate_expression "[" FIRST "]"
| aggregate_expression "[" LAST "]"
| aggregate_expression "[" SIZE "]"
[편집] Aggregate Expression
aggregate_expression ::= array_expression | dictionary_expression
[편집] Assignment Expression
assignment_expression ::= predicate_variable ":=" expression
[편집] Binary Expression
binary_expression ::= expression binary_operator expression
| "-" expression
[편집] Binary Operator
binary_operator ::= "+" | "-" | "*" | "/" | "**"
[편집] Function Expression
function_expression ::= function_name "(" [ expression [ "," expression ... ] ] ")"
[편집] Function Name
function_name ::= "sum" | "count" | "min" | "max"
| "average" | "median" | "mode" | "stddev"
| "sqrt" | "log" | "ln" | "exp"
| "floor" | "ceiling" | "abs" | "trunc"
| "random" | "randomn" | "now"
[편집] Array Expression
array_expression ::= NSArray 오브젝트에 대해 평가하는 어떤 공식이든
[편집] Dictionary Expression
dictionary_expression ::= NSDictionary 오브젝트에 대해 평가하는 어떤 공식이든
[편집] Integer Expression
integer_expression ::= 정수값에 대해 평가하는 어떤 공식이든
[편집] Numeric Value
numeric_value ::= C 스타일의 숫자 상수
[편집] Identifier
identifier ::= C 스타일 인식자<sup>Identifier</sup> | "#" reserved_word




