Git Product home page Git Product logo

antlr-java-parser's Issues

parsing error when java file has variable by unicode string

my some java file has unicode variable
that euc-kr encoding and korea language likely "한글변수"

ex
String 한글변수 = "some string";

error
token recognition error at: '한'
token recognition error at: '글'
token recognition error at: '변'
token recognition error at: '수'

Java Parsing error

Parser fails on following code:
return stepBuilders.get( "step" )
.transactionManager( transactionManager )
.<MyEntity, MyEntity>chunk( 20 )
.reader( reader() )
.processor( loggingProcessor() )
.writer( writer() )
.build();

The problem seems to be with the .< part.

Cheers

Memory leak

I created simple test with parsing java files. I've cloned netbeans sources and use this code:

import com.github.antlrjavaparser.JavaParser;
import com.github.antlrjavaparser.api.CompilationUnit;
import java.io.File;

public final class TestAntlrParser {

    public static void main(String[] args) throws Exception {
        parseDirectory(new File("/data/home/hlavki/Download/main-silver"));
    }


    public static void parseDirectory(File path) {
        if (path.isDirectory()) {
            File[] files = path.listFiles();
            for (File file : files) {
                if (!file.getAbsolutePath().contains("/.hg/") && file.getName().endsWith(".java")) {
                    try {
                        CompilationUnit cu = JavaParser.parse(file);
                        if (!cu.getTypes().isEmpty()) {
                            System.out.println(cu.getPackage().getName() + "." + cu.getTypes().get(0).getName());
                        }
                    } catch (Throwable e) {
                        System.out.println("ERROR: " + e.getMessage());
                    }
                } else if (file.isDirectory()) {
                    parseDirectory(file);
                }
            }
        }
    }
}

And created 3 heap dumps while parsing minute after minute. You can see increasing number of ATNConfig instances.

antlr-parser-01
antlr-parser-02
antlr-parser-03

Default switch block statements disappear

The statements in the default block of a switch statement disappear. it manifests itself when running with DumpVisitor. I think this is due to the else if statement in SwitchBlockStatementGroupContextAdapter:

else if (context.switchLabel().DEFAULT() != null) {
// Explicitly setting these null for readability
switchEntryStmt.setLabel(null);
switchEntryStmt.setStmts(null);
}

maven build failed

I cloned this repo and flowwed instructions from Readme.md
The step "mvn release:prepare" don't succeed.

Failed tests:
TestAstPosition.ifStatementTest:39 Method body index start is incorrect. expected:<80> but was:<75>

I don't understand, because I don't change the source files.

Problem on parsed results of binary expression

Current version (1.0.15) cannot parse shift operators. Calling JavaParser.parse() will parse the '<<' as '<=' and '>>' as '<'. Besides, it seems that '>>>' cannot be parsed either.

Sample input file:

public class Debug{
    public Debug(){
        1 << 6; //1 <= 6
        1 >> 6; //1 < 6
    }
}

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.