[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: documents or examples on defining / adding a new syntax?



Zhang Weiwu writes:
> 1. is there a module that introduces a new syntax, from which I could 
> observe how that is done?
>
> 2. Is there any document on what-to-be-aware-of if you design a new syntax?

servers/slapd/schema_init.c documents how to write syntaxes and matching
rules, and defines most built-ins.  If it's unclear, please tell how to
improve the doc.  servers/slapd/overlays/accesslog.c defines its own
syntax.  contrib/slapd-modules/passwd/radius.c is a small module you can
see for general module setup.

> 3. Do I need to design a new syntax at all? My requirement is the following:
> 
>  	I need a new syntax for ranged-values. Examples are:
> 
>  	- netWeight: 12~13kg
>  	- ISOSensitivity: 800~1600
>  	- heightAdjustableRange: 1.2m~1.5m
> 
>  	The spec of ranged-value is a numeric, optionally followed by a
>  	measurement unit, followed by a tild as seperator+, followed by
>  	another measurement.

LDAP syntaxes often use '$' or '#' as separators, but it's up to you.
See e.g. RFC 4517 3.3.28 Postal Address, 3.3.21 Name and Optional UID.

>  	The syntax needs its own comparison rules, so that you can filter a
>  	range, and get entries who offer values ranging in that range.

Then you need a syntax and matching rule(s) for it.

-- 
Hallvard