How to use the php-parser/package.json.version function in php-parser

To help you get started, we’ve selected a few php-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fkling / astexplorer / website / src / parsers / php / php-parser.js View on Github external
const defaultOptions = {
  parser: {
    extractDoc: true,
  },
  ast: {
    withPositions: true,
  },
};

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,
  locationProps: new Set(['loc']),
  typeProps: new Set(['kind']),

  loadParser(callback) {
    require(['php-parser'], callback);
  },

  parse(Engine, code) {
    const parser = new Engine(defaultOptions);
    return parser.parseCode(code, '');
  },

  getNodeName(node) {
    return node.kind;
  },

php-parser

Parse PHP code from JS and returns its AST

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis