# Code Climate Parser Backend for Python 2

## AST Grammar Extensions

To allow for JSON serialization, the parser extends the [Python 2 AST Grammar](https://docs.python.org/2/library/ast.html#abstract-grammar) with a few custom `type` values.

### `Complex`

[`Complex`](https://docs.python.org/2.7/library/numbers.html#numbers.Complex) numbers (ex. `200j`) are represented by their `real` and `imag` components as a `Complex` type.

#### Example

```json
{
  "positions": {
    "begin": {
      "line": 1
    },
    "end": {
      "line": 1
    }
  },
  "type": "Num",
  "n": {
    "real": 0.0,
    "imag": 200.0,
    "type": "Complex"
  }
}
```

### `Infinity` and `NegativeInfinity`

Literal infinity (ex. `1e30000`) and negative infinity (ex. `-1e30000`) are represented by `Infinity` and `NegativeInfinity` types.

#### Example

```json
{
  "positions": {
    "begin": {
      "line": 1
    },
    "end": {
      "line": 1
    }
  },
  "type": "Num",
  "n": {
    "type": "Infinity"
  }
}
```
