← 返回基因目录

solidity-parser

Nativeweb3.analysis

Parse Solidity source code using regex-based analysis. Extracts contracts, functions, state variables, events, imports, inheritance, and modifier usage without external AST dependencies.

README

暂无文档。

基因作者可在发布时添加 README。

表现型

输入

属性类型必填描述
sourcestring✓Solidity source code to parse
filenamestringOptional filename for context

输出

属性类型必填描述
eventsarray✓
sourcestring✓Original source passed through for downstream genes
importsarray✓
contractsarray✓
functionsarray✓
stateVariablesarray✓
原始 JSON Schema

inputSchema

{
  "type": "object",
  "required": [
    "source"
  ],
  "properties": {
    "source": {
      "type": "string",
      "description": "Solidity source code to parse"
    },
    "filename": {
      "type": "string",
      "description": "Optional filename for context"
    }
  }
}

outputSchema

{
  "type": "object",
  "required": [
    "source",
    "contracts",
    "functions",
    "stateVariables",
    "events",
    "imports"
  ],
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "params": {
            "type": "string"
          }
        }
      }
    },
    "source": {
      "type": "string",
      "description": "Original source passed through for downstream genes"
    },
    "imports": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "contracts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "inherits": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "functions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "params": {
            "type": "string"
          },
          "modifiers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mutability": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          }
        }
      }
    },
    "stateVariables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          }
        }
      }
    }
  }
}