10.2.8.5 Rewrite Statements

The Rewrite statements are: expressions, assignments, conditional
statements, and return statements. A statement is terminated by a semicolon.

Expressions

An expression is one of the following:

A variable identifier

A type coercion expression

An arithmetic expression

A boolean expression

An assignment

A function call

A delete statement

Type coercion

The type coercion is like a type cast in C. Its syntax is

‘(’ type ‘)’ ident

The result of type coercion is as follows:

type

Variable type

Resulting conversion

integer

integer

No conversion. This results in the same integer value.

integer

string

If the string value of the variable is a valid ASCII representation
of the integer number (either decimal, octal, or hex), it is converted to
the integer; otherwise the result of the conversion is undefined.

string

integer

The ASCII representation (in decimal) of the integer number.

string

string

No conversion. This results in the same string value.

Assignment

An assignment is

ident = expression ;

The variable ident is assigned the value of expression.

Function calls

These take the form

ident ( arg-list )

where ident is the identifier representing the function, and
arg-list is a comma-separated list of expressions supplying
actual arguments to the function. The number of the expressions
must correspond exactly to the number of formal parameters in the
function definition. The function that ident
references can be either a compiled function or a built-in
function.

‘delete’ statement

The ‘delete’ statement is used to delete an attribute or attributes
from the incoming request. Its syntax is:

delete attribute-name;
delete attribute-name(n);

The first variant deletes all the attributes of the given type.
The second variant deletes only the nth occurrence of the matching
attribute.