extension keyword

extension id --> operations

id identifier Unique identifier for the extension rule.

operations A sequence of shape operations to execute.

The extension keyword marks a rule as an extension point of the current ruleset, i.e. the cga file.

Similarly to attr, extension rules can be redefined in an import statement. See the import page for detailed information (syntax 6) and examples.

If an extension point should not generate anything by default, just use one NIL operation: extension Rule --> NIL.

Extension rules cannot be defined in styles other than the Default style.

Extension rules with same id but different number of parameters, overloading, are not allowed.

Related

Example

Redefine an extension rule

// rule.cga

extension Roof(angle) --> roofHip(angle)

Init --> Roof(22)
// main.cga

import rule : "rule.cga"( Roof(angle) --> roofGable(angle) )

Lot --> rule.Init