EMF has an example of how to use org.eclipse.jdt.core.dom.ASTParser to analyze the source code.
Please refer to org.eclipse.emf.test.tools.merger.ASTTest.testRead()/testWrite().
TO check out the source code from CVS repository:
dev.eclipse.org:/cvsroot/modeling/org.eclipse.emf.test.tools
The test also shows how JMerger works.
Following is a code fragment:
...
String content = TestUtil.readFile(javaSourceFile, false);
ASTParser astParser = ASTParser.newParser(AST.JLS3);
astParser.setSource(content.toCharArray());
CompilationUnit compilationUnit = (CompilationUnit)astParser.createAST(null);
{
Javadoc javadoc = (Javadoc)compilationUnit.getCommentList().get(0);
assertEquals(1, javadoc.tags().size());
TagElement tagElement = (TagElement)javadoc.tags().get(0);
assertEquals(9, tagElement.fragments().size());
....