0.0.25 • Published 2 years ago

xbasic-parser v0.0.25

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

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
    }
  ]
}
0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago