# Languages

An ORL language is what binds a [rule / ruleset](https://docs.gomboc.ai/orl/concepts/rules) to what files are loaded in the [workspace](https://docs.gomboc.ai/orl/concepts/workspace). The language defines the parser that is used to produce the AST. It also defines the helpers that are available in the [template](https://docs.gomboc.ai/orl/concepts/template).

For a full list of languages use: `docker run --rm gombocai/orl:latest language`

```bash
Supported languages:
  1.  bash
  2.  c
  3.  cloudformation-json
  4.  cloudformation-yaml
  ...
```

For details on each language's behavior, including the glob patterns used to load files, and template functions available run `docker run --rm gombocai/orl:latest language <language>`

```bash
$ docker run --rm gombocai/orl:latest language terraform
terraform

Terraform files.

Globs:
                  *.tf
                 *.hcl
              *.tfvars

Template Functions:
                aBlock - Checks for a block with the given name. 'block_name', 'block_body', and 'block' are captured.
     aMissingAttribute - Checks for a missing attribute with the given name. 'key', and 'attribute' are captured.
         aMissingBlock - Checks for a missing block with the given name. 'block_name', and 'block' are captured.
               aModule - Checks for a module with the given name. The optional second argument is an s-expression that is used to match the module body.  'name', 'body', and 'module' are captured.
     aModuleWithSource - Checks for a module with the given name and source. The optional second argument is an s-expression that is used to match the module body.  'name', 'source_key', 'source_value', 'body', and 'module' are captured.
             aResource - Checks for a resource with the given type. The optional second argument is an s-expression that is used to match the resource body.  'type', 'name', 'body', and 'resource' are captured.
             aSubBlock - Checks for a sub-block with the given name. 'sub_block_name', 'sub_block_body', and 'sub_block' are captured.
          allResources - Checks for all resources.  'keyword', 'type', 'name', and 'body' are captured.
           anAttribute - Checks for an attribute with the given name. 'key', 'value', and 'attribute' are captured.
      anAttributeValue - Checks for an attribute with the given name.  The second argument is an s-expression that is used to match the attribute value. 'key', 'value', and 'attribute' are captured.
    anAttributeValueEq - Checks for an attribute with the given name whose expression equals the given value. 'key', 'value', and 'attribute' are captured.
 anAttributeValueNotEq - Checks for an attribute with the given name whose expression does not equal the given value. 'key', 'value', and 'attribute' are captured.
          anEmptyBlock - Checks for an empty block with the given name. 'block_name', 'block_body', and 'block_end' are captured.
anStringAttributeValue - Checks for an attribute with the given name whose expression is a string that equals the given value. 'key', 'value', and 'attribute' are captured.
               collect - Collects all the leaves from a given path.
          hasSubString - Checks if a string or array of strings contains a substring.
            semVerBump - Bumps a semantic version based on the location 'major', 'minor', or 'patch'.  If no location is provided, 'patch' is used.
             semVerCmp - Compares two semantic versions.  The operator can be '==', '>', '>=', '<', '<=', or '!='.
                truthy - Checks if a value is truthy.
```
