All Projects → urish → java-ast

urish / java-ast

Licence: MIT license
Java Parser for JavaScript/TypeScript (based on antlr4ts)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to java-ast

kolasu
Kotlin Language Support – AST Library
Stars: ✭ 45 (-22.41%)
Mutual labels:  ast, antlr4
parcera
Grammar-based Clojure(script) parser
Stars: ✭ 100 (+72.41%)
Mutual labels:  ast, antlr4
Tatsu
竜 TatSu generates Python parsers from grammars in a variation of EBNF
Stars: ✭ 198 (+241.38%)
Mutual labels:  ast
Java-AgentSpeak
LightJason - AgentSpeak(L++) for Java
Stars: ✭ 21 (-63.79%)
Mutual labels:  antlr4
Unified
☔️ interface for parsing, inspecting, transforming, and serializing content through syntax trees
Stars: ✭ 3,036 (+5134.48%)
Mutual labels:  ast
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (+274.14%)
Mutual labels:  ast
Gulp Strip Debug
Strip console, alert, and debugger statements from JavaScript code
Stars: ✭ 242 (+317.24%)
Mutual labels:  ast
Bellybutton
Custom Python linting through AST expressions
Stars: ✭ 196 (+237.93%)
Mutual labels:  ast
astexplorer-go
No description or website provided.
Stars: ✭ 17 (-70.69%)
Mutual labels:  ast
Cppast.net
CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
Stars: ✭ 228 (+293.1%)
Mutual labels:  ast
php2python
Convert PHP code to Python under CGI (beta)
Stars: ✭ 44 (-24.14%)
Mutual labels:  ast
Php Parser
A PHP parser written in PHP
Stars: ✭ 15,101 (+25936.21%)
Mutual labels:  ast
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (+275.86%)
Mutual labels:  ast
Esdoc
ESDoc - Good Documentation for JavaScript
Stars: ✭ 2,706 (+4565.52%)
Mutual labels:  ast
Hexraystoolbox
Hexrays Toolbox - Find code patterns within the Hexrays AST
Stars: ✭ 202 (+248.28%)
Mutual labels:  ast
stutter
Implement a Lisp, in C, from scratch, no libs
Stars: ✭ 65 (+12.07%)
Mutual labels:  ast
Cub
The Cub Programming Language
Stars: ✭ 198 (+241.38%)
Mutual labels:  ast
Ast Query
Tentative to a simple JavaScript AST modification library
Stars: ✭ 221 (+281.03%)
Mutual labels:  ast
Tsutils
utility functions for working with typescript's AST
Stars: ✭ 240 (+313.79%)
Mutual labels:  ast
sast
Parse CSS, Sass, SCSS, and Less into a unist syntax tree
Stars: ✭ 51 (-12.07%)
Mutual labels:  ast

java-ast

Java Parser for JavaScript/TypeScript, based on antlr4ts, grammar taken from antlr4's java grammar too (so please report bugs and open pull requests related to grammars upstream)

npm version Build Status code style: prettier

Usage Example

import { parse, createVisitor } from 'java-ast';

const countMethods = (source: string) => {
  let ast = parse(source);

  return createVisitor({
    visitMethodDeclaration: () => 1,
    defaultResult: () => 0,
    aggregateResult: (a, b) => a + b,
  }).visit(ast);
};

console.log(
  countMethods(`
    class A {
      int a;
      void b() {}
      void c() {}
    }
    class B {
      void z() {}
    }
  `),
); // logs 3
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].