Socket
Socket
Sign inDemoInstall

xbasic-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xbasic-parser

Xbasic Parser


Version published
Weekly downloads
22
increased by2100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

xbasic-parser

Node module for xbasic parsing, creates a symbol tree representing the xbasic script.

Example

var code = '\
function fullname as c(fname as c,lname as c)\r\n\
     fullname = fname+" "+lname\r\n\
end function\r\n\
\r\n\
dim name as c\r\n\
name = fullname("john","public")\r\n\
';
var xbp = require("xbasic-parser");
console.log(JSON.stringify(xbp.parse(code), null, "  ")); 

Produces

{
  "error": "Lines :7",
  "commands": [
    {
      "type": "function",
      "variable": "fullname",
      "returns": "c",
      "arguments": [
        {
          "name": "fname",
          "type": "c"
        },
        {
          "name": "lname",
          "type": "c"
        }
      ],
      "lineNumber": 0
    },
    {
      "type": "expr",
      "expr": {
        "type": ":=",
        "operator": [
          {
            "identifier": "fullname"
          },
          {
            "type": "+",
            "operator": [
              {
                "identifier": "fname"
              },
              {
                "type": "+",
                "operator": [
                  {
                    "string": "\" \""
                  },
                  {
                    "identifier": "lname"
                  }
                ]
              }
            ]
          }
        ]
      },
      "lineNumber": 1
    },
    {
      "type": "end_function",
      "lineNumber": 2
    },
    {
      "type": "dim",
      "variable": "name",
      "returns": "c",
      "lineNumber": 4
    },
    {
      "type": "expr",
      "expr": {
        "type": ":=",
        "operator": [
          {
            "identifier": "name"
          },
          {
            "function": "fullname",
            "parameters": [
              {
                "string": "\"john\""
              },
              {
                "string": "\"public\""
              }
            ]
          }
        ]
      },
      "lineNumber": 5
    }
  ]
}

Keywords

FAQs

Last updated on 27 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc