Giter Site home page Giter Site logo

jsjavaparser's People

Contributors

inversion avatar mazko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsjavaparser's Issues

Javascript Crash

When parsing nested parentheses, rather than throwing an error the parser crashes the current Javascript environment (e.g. on the demo it crashes the browser tab)

package js.java.parser;

import static java.lang.System.out;

import java.util.*;

public class HelloWorld {
  public static void main(final String[] args) {

        ( ( ) )

  }
}

Bug in grammar file

I am trying to use grammar file but i am facing following issue for pegjs version 0.10.0:

GrammarError: Label "args" is already defined at line 1199, column 7

Can you help me?

Problems with building from source

Hi Oleg,

When I try and compile the grammar with PEG.js, I get the error:

Line 1691, column 21: Referenced rule "_" does not exist.

This is in the rule for TraditionalComment, which you previously mentioned wasn't currently in the AST, so I was wondering if you had a work around for this in your build, or if you're using a particular version of PEG.js?

Many thanks,
Hugh

Parsing Comments

Hi Oleg,

Really great library, I'm already using PEG.js for parsing another grammar so this is perfect for what I need :)

I was just wondering if you had any plans to support comments in the parse tree?

Keen to contribute if not.

Thanks,
Hugh

how to run in server.js

hello.
@mazko i have problem.
how i run that code in .js file like that?

var japa = require("java-parser");
console.log(japa.parse("package hello;"));

how i pass a java file helloworld.js in it?
please tell me. I want to parse my java code and need json output.

can you give me your Skype id?
or anything else?

Exponential complexity of nested functions

Could you please give me a pointer how can I solve a problem with exponential complexity of nested function calls?

Example:

b(3); // blazing fast
b(c(3)) // slower
b(c(d(e))) // couple seconds
b(c(d(e(f)))) //minute
...
6 and more ... will probably never finish in this time ;(

AST-to-JS?

Is there any project that you've written, or that you know of written by others, that can convert the resulting AST into JavaScript? This project might allow porting quite a few "Java source" languages such as Processing to a web-executable format (I've worked on Processing.js but its parser is too clever to maintain), but a necessary start would be to be able to convert the AST into runnable Javascript (either directly, AST-to-JS-object, or indirectly, as AST-to-JS-source-code).

I've stubbed a small test over on https://github.com/Pomax/java-parser-test but if there are AST-to-JS solutions already, I'd really much prefer not rolling my own =)

Hangs for a specific input

This input causes the parser to hang:

   package com.demo;
   public class Test {
     public void test() {
         cu.accept(new ASTVisitor() {

              public boolean visit(VariableDeclarationFragment node) {
                  cu.getLineNumber(name.getStartPosition());
              }

          });
      }
  }

Problem with ID

Heyho,

first let me say thank you really really much for the jsjavaparser, it's great!
I use it for a bachelor thesis prototype.
I got one problem: The editor will only be implemented if the ID equals "editor". I need 2 Editors in one single HTML Page. I tried to fix it but was unable to do so, since i'm not a professional.

I would appreciate any help I could get

How can i convert my obj result to AST

I want to implement my parser work like this demo "http://mazko.github.io/jsjavaparser/"

but my parser return object and finish like this
Screen Shot 2023-03-31 at 10 26 37 AM

how can I convert that object to AST ?

what's problem in my code ?
I'm using vuejs and npm 7.24.0

here is my code:

var japa = require("java-parser");
console.log(japa.parse(string)); 

pls, I need help
thanks

Line numbers

How difficult would it be to include line numbers in the generated AST? Without line numbers it's not possible to generate source maps. Do you know of any other technique on how those source maps can be generated? Thanks!

How nativate in the syntax tree

What is the easiest way to enumerate over the package structure. I'm trying to extract the package declared.

In the demo http://proiot.ru/jsjavaparser/, the package "js.java.parser" give this:

"package": {
        "node": "PackageDeclaration",
        "name": {
            "node": "QualifiedName",
            "qualifier": {
                "node": "QualifiedName",
                "qualifier": {
                    "identifier": "js",
                    "node": "SimpleName"
                },
                "name": {
                    "identifier": "java",
                    "node": "SimpleName"
                }
            },
            "name": {
                "identifier": "parser",
                "node": "SimpleName"
            }
        },
        "annotations": []
    },

Esjavascript source

Impressive project!! Learned a lot! Is the es6 transpiler available somewhere by any chance thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.