Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Outline Elements are jumping to the wrong position in the Editor Hi, I'm working on the Outline View for the Lua Editor and now I've the following problem. I use ANTLR 3.0 for the generation of the AST. The rule to detect a function looks like: localFunctionDeclaration @init{ MethodDeclaration m = null; } :f='local' 'function' n=NAME { m = new MethodDeclaration(toDLTK(f),toDLTK(n)); decl.addStatement(m); } funcbody[m] e='end' ; Where decl is of type ModuleDeclaration and I use the toDLTK from the Python grammar file. This is the only thing added to decl but when selected in the Outline View it jumps not to the correct line in the editor. Am I missing something. How detailed has the AST to be? Nicolai Mainiero

Hi,

Outline View uses only name position info, so I think your AST is detailed enough.
Please, check if generated AST contains correct offsets. I'm not sure
about antlr 3.0, but 2.7.* by default provides only column number, not real offset from the file start. If AST offsets are correct, than you can check in debug, how model are built. You can check it inside your source element parser class.

Nicolai Mainiero wrote:
Hi,

I'm working on the Outline View for the Lua Editor and now I've the following problem. I use ANTLR 3.0 for the generation of the AST. The rule to detect a function looks like:

localFunctionDeclaration
@init{
    MethodDeclaration m = null;
}

    :    f='local' 'function'
        n=NAME {
            m = new MethodDeclaration(toDLTK(f),toDLTK(n));
decl.addStatement(m); }
        funcbody[m]
        e='end' ;

Where decl is of type ModuleDeclaration and I use the toDLTK from the Python grammar file.

This is the only thing added to decl but when selected in the Outline View it jumps not to the correct line in the editor. Am I missing something. How detailed has the AST to be?

Nicolai Mainiero

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top