How can I indicate syntax errors (e.g. an illegal sequence of tokens) in an eclipse editor plugin just like in the eclipse Java editor, i.e. by red wriggly underlines, a red mar
The correct way is using the marker interface.
Markers are essentially a model that maps marker objects to locations in your source code, so this makes sense in situations where you can have errors in multiple files. (see the IMarker interface)
A cheaper option if you want to add markup to your current editor but not to all the project is using Annotations, which you can add an remove yourself.
Markers are represented in the UI as annotations but Eclipse adds and removes the annotations itself. With direct annotations, you're in control.
You should be using Markers.
An example derived from "The Java Developer's Guide to Eclipse" follows:
<extension point="org.eclipse.core.resources.markers"
id="snakesyntax"
name="Snake syntax error">
<super type="org.eclipse.core.resources.problemmarker" />
<super type="org.eclipse.core.resources.textmarker" />
<persistent value="true" />
<extension>
IMarker marker = res.createMarker("com.ibm.tool.resources.snakesyntax");
marker.setAttribute(IMarker.SEVERITY, 0);
marker.setAttribute(IMarker.CHAR_START, startOfSyntaxError);
marker.setAttribute(IMarker.CHAR_END, endOfSyntaxError);
marker.setAttribute(IMarker.LOCATION, "Snake file");
marker.setAttribute(IMarker.MESSAGE, "Syntax error");