0.0.25 • Published 11 months ago

xbasic-parser v0.0.25

Weekly downloads
3
License
MIT
Repository
github
Last release
11 months 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

11 months ago

0.0.24

11 months ago

0.0.25

11 months ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago