pine-parser 0.1.0

Parser for Pine Script.
Documentation
[
  {
    "VarDecl": {
      "name": "x",
      "type_annotation": null,
      "initializer": {
        "Literal": {
          "Int": 10
        }
      }
    }
  },
  {
    "If": {
      "condition": {
        "Binary": {
          "left": {
            "Variable": "x"
          },
          "op": "Greater",
          "right": {
            "Literal": {
              "Int": 5
            }
          }
        }
      },
      "then_branch": [
        {
          "VarDecl": {
            "name": "total",
            "type_annotation": null,
            "initializer": {
              "Literal": {
                "Int": 0
              }
            }
          }
        },
        {
          "For": {
            "var_name": "i",
            "from": {
              "Literal": {
                "Int": 0
              }
            },
            "to": {
              "Literal": {
                "Int": 10
              }
            },
            "body": [
              {
                "If": {
                  "condition": {
                    "Binary": {
                      "left": {
                        "Binary": {
                          "left": {
                            "Variable": "i"
                          },
                          "op": "Mod",
                          "right": {
                            "Literal": {
                              "Int": 2
                            }
                          }
                        }
                      },
                      "op": "Eq",
                      "right": {
                        "Literal": {
                          "Int": 0
                        }
                      }
                    }
                  },
                  "then_branch": [
                    {
                      "Assignment": {
                        "target": {
                          "Variable": "total"
                        },
                        "value": {
                          "Binary": {
                            "left": {
                              "Variable": "total"
                            },
                            "op": "Add",
                            "right": {
                              "Variable": "i"
                            }
                          }
                        }
                      }
                    }
                  ],
                  "else_if_branches": [],
                  "else_branch": [
                    {
                      "Assignment": {
                        "target": {
                          "Variable": "total"
                        },
                        "value": {
                          "Binary": {
                            "left": {
                              "Variable": "total"
                            },
                            "op": "Sub",
                            "right": {
                              "Variable": "i"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "VarDecl": {
            "name": "result",
            "type_annotation": null,
            "initializer": {
              "Variable": "total"
            }
          }
        }
      ],
      "else_if_branches": [],
      "else_branch": null
    }
  }
]