From 7cba4a295b2b81fc627f9babcecaf4c686b6620e Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Wed, 2 Jun 2010 09:52:40 +0200 Subject: Add match_specification grammar documentation specifically for ets --- erts/doc/src/match_spec.xml | 52 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/erts/doc/src/match_spec.xml b/erts/doc/src/match_spec.xml index d6492198ca..f0390c9db8 100644 --- a/erts/doc/src/match_spec.xml +++ b/erts/doc/src/match_spec.xml @@ -60,7 +60,7 @@
Grammar -

A match_spec can be described in this informal grammar:

+

A match_spec used in tracing can be described in this informal grammar:

MatchExpression ::= [ MatchFunction, ... ] @@ -117,6 +117,52 @@ | | | + +

A match_spec used in ets can be described in this informal grammar:

+ + MatchExpression ::= [ MatchFunction, ... ] + + MatchFunction ::= { MatchHead, MatchConditions, MatchBody } + + MatchHead ::= MatchVariable | | { MatchHeadPart, ... } + + MatchHeadPart ::= term() | MatchVariable | + MatchVariable ::= '$<number>' + + MatchConditions ::= [ MatchCondition, ...] | + MatchCondition ::= { GuardFunction } | + { GuardFunction, ConditionExpression, ... } + + BoolFunction ::= | | + | | | + | | | + | | | + | | | + | | | | + | + ConditionExpression ::= ExprMatchVariable | { GuardFunction } | + { GuardFunction, ConditionExpression, ... } | TermConstruct + + ExprMatchVariable ::= MatchVariable (bound in the MatchHead) | + | + TermConstruct = {{}} | {{ ConditionExpression, ... }} | + | [ConditionExpression, ...] | NonCompositeTerm | Constant + + NonCompositeTerm ::= term() (not list or tuple) + + Constant ::= {, term()} + + GuardFunction ::= BoolFunction | | + | | | | + | | | | + | | | | + | | | | + | | | ']]> | + =']]> | | | | + | | | | + + MatchBody ::= [ ConditionExpression, ... ] +
@@ -453,8 +499,8 @@
Differences between match specifications in ETS and tracing

ETS match specifications are there to produce a return - value. Usually the expression contains one single - which defines the return value without having + value. Usually the contains one single + which defines the return value without having any side effects. Calls with side effects are not allowed in the ETS context.

When tracing there is no return value to produce, the -- cgit v1.2.3