Package com.github.jknack.antlr4ide.generator

Examples of com.github.jknack.antlr4ide.generator.ToolOptionsProvider


    String input = "3+4*5";
    String sexpression = "( expression ( sum ( number 3 ) '+' ( expression ( prod ( number 2 ) '*' ( number 4 ) ) ) ) ) ";

    int freePort = 41900;

    ToolOptionsProvider optionsProvider = createMock(ToolOptionsProvider.class);

    String toolPath = "/tmp/antlr4-x-complete.jar";
    String[] vmArgs = {};
    ToolOptions options = createMock(ToolOptions.class);
    expect(options.getAntlrTool()).andReturn(toolPath);
    expect(options.vmArguments()).andReturn(vmArgs);

    IPath location = Path.fromPortableString("/home/edgar/ws space/project/G4.g4");

    IWorkspaceRoot workspaceRoot = createMock(IWorkspaceRoot.class);
    IFile file = createMock(IFile.class);
    expect(file.getLocation()).andReturn(location);

    LexerRule plusRule = createMock(LexerRule.class);
    expect(plusRule.getName()).andReturn("+");
    plusRule.setName("+");

    LexerRule starRule = createMock(LexerRule.class);
    expect(starRule.getName()).andReturn("*");
    starRule.setName("*");

    LangFactory langFactory = createMock(LangFactory.class);
    expect(langFactory.createLexerRule()).andReturn(plusRule);
    expect(langFactory.createLexerRule()).andReturn(starRule);

    URI resourceURI = URI.createURI("platform:/resource/project/G.g4");
    Resource resource = createMock(Resource.class);
    expect(resource.getURI()).andReturn(resourceURI);

    Grammar grammar = createMock(Grammar.class);
    expect(grammar.eResource()).andReturn(resource);

    Rule rule = createMock(Rule.class);
    expect(rule.getName()).andReturn(ruleName);
    expect(rule.eContainer()).andReturn(grammar);

    expect(workspaceRoot.getFile(Path.fromOSString("/project/G.g4"))).andReturn(file);
    expect(optionsProvider.options(file)).andReturn(options);

    List<String> command = Lists.newArrayList("java", "-cp",
        toolPath + File.pathSeparator + ToolOptionsProvider.RUNTIME_JAR, ParseTreeGenerator.MAIN,
        freePort + "");

View Full Code Here

TOP

Related Classes of com.github.jknack.antlr4ide.generator.ToolOptionsProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.