pine-parser 0.2.1

Parser for Pine Script.
Documentation
[
  {
    "VarDecl": {
      "name": "x",
      "type_annotation": null,
      "initializer": {
        "Literal": {
          "Int": 5
        }
      }
    }
  },
  {
    "VarDecl": {
      "name": "result",
      "type_annotation": null,
      "initializer": {
        "Literal": {
          "Int": 0
        }
      }
    }
  },
  {
    "If": {
      "condition": {
        "Binary": {
          "left": {
            "Variable": {
              "name": "x"
            }
          },
          "op": "Less",
          "right": {
            "Literal": {
              "Int": 0
            }
          }
        }
      },
      "then_branch": [
        {
          "Assignment": {
            "target": {
              "Variable": {
                "name": "result"
              }
            },
            "value": {
              "Unary": {
                "op": "Neg",
                "expr": {
                  "Literal": {
                    "Int": 1
                  }
                }
              }
            }
          }
        }
      ],
      "else_if_branches": [
        [
          {
            "Binary": {
              "left": {
                "Variable": {
                  "name": "x"
                }
              },
              "op": "Eq",
              "right": {
                "Literal": {
                  "Int": 0
                }
              }
            }
          },
          [
            {
              "Assignment": {
                "target": {
                  "Variable": {
                    "name": "result"
                  }
                },
                "value": {
                  "Literal": {
                    "Int": 0
                  }
                }
              }
            }
          ]
        ],
        [
          {
            "Binary": {
              "left": {
                "Variable": {
                  "name": "x"
                }
              },
              "op": "Less",
              "right": {
                "Literal": {
                  "Int": 10
                }
              }
            }
          },
          [
            {
              "Assignment": {
                "target": {
                  "Variable": {
                    "name": "result"
                  }
                },
                "value": {
                  "Literal": {
                    "Int": 1
                  }
                }
              }
            }
          ]
        ]
      ],
      "else_branch": [
        {
          "Assignment": {
            "target": {
              "Variable": {
                "name": "result"
              }
            },
            "value": {
              "Literal": {
                "Int": 2
              }
            }
          }
        }
      ]
    }
  }
]