mazko / jsjavaparser Goto Github PK
View Code? Open in Web Editor NEWJava 1.7 Parser and Abstract Syntax Tree
Java 1.7 Parser and Abstract Syntax Tree
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 ;(
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": []
},
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?
I want to implement my parser work like this demo "http://mazko.github.io/jsjavaparser/"
but my parser return object and finish like this
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
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
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) {
( ( ) )
}
}
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?
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!
Impressive project!! Learned a lot! Is the es6 transpiler available somewhere by any chance thanks!
for comment tags -> Abstract Syntax Tree
/** comments **/
sometimes,
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 =)
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
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
Any plan to support new features like record
?
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());
}
});
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.