GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - glayzzle/hack-parser: JS Hack/HHVMParser - extract AST and tokens

BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
test
test
 
 
.coveralls.yml
.coveralls.yml
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 

Repository files navigation

hack-parser

JS Hack/HHVMParser - extract AST and tokens

Coverage Status Build Status


Install

npm install hack-parser --save

Usage

import parser from 'hack-parser';
console.log(
  parser.parseCode(`<?hh
      <<__Memoize>>
      function foo(inout vec<string> $bar): {
      }
  `)
);

This will output :

Program {
  "children": Array [
    _Function {
      "arguments": Array [
        Parameter {
          "byref": false,
          "inout": true,
          "kind": "parameter",
          "modifiers": null,
          "name": "bar",
          "nullable": false,
          "type": Identifier {
            "arguments": Array [
              Identifier {
                "kind": "identifier",
                "name": "string",
                "resolution": "uqn",
              },
            ],
            "kind": "identifier",
            "name": "vec",
            "resolution": "rn",
          },
          "value": null,
          "variadic": false,
        },
      ],
      "attributes": Array [
        Attribute_Spec {
          "args": null,
          "kind": "attribute_spec",
          "name": "__Memoize",
        },
      ],
      "body": Block {
        "children": Array [],
        "kind": "block",
      },
      "byref": false,
      "kind": "function",
      "name": "foo",
      "nullable": false,
      "type": null,
    },
  ],
  "errors": Array [],
  "kind": "program",
}

The library is based on php-parser

Roadmap for first release

  • Implement all tokens (introduced 43 new tokens)
  • Define new AST nodes
  • Implement the new grammar

Disclaimer : This is a work in progress

Misc

This library is released under BSD-3 license clause.

About

JS Hack/HHVMParser - extract AST and tokens

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

1 star

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.