I am writing a new editor for java using Xtext. I want parser to parse the main class and replace the method call by actual code.
e.g
Class Test {
public static void main(String[] args ){
System.out.println("Virag");
method();
}
public static method(){
System.out.println("Purnam");
}
}
After parsing I want to return a document like mentioned below.
Class Test {
public static void main(String[] args ){
System.out.println("Virag");
System.out.println("Purnam");
}
}
I achieved this in lexer and parser by return of method body instead of method. But later in editor, text region gets changed and any edit performed in editor goes wrong. Character positions in documents are going wrong. How to fix this problem?