[antlr-interest] ANTLR Eclipse plugin newsgroup
Scott Stanchfield
scott at javadude.com
Fri Dec 23 10:12:35 PST 2005
oh, you're right -- I was thinking about the "grammar only" page in the
editor. I think (but I'm not sure) that the outline view uses an antlr
scanner, though.
(I didn't mess with that area much)
Thanks for the correction!
It doesn't do on-the-fly markers (yet), but it does add markers after saving
the file based on the java compile and the antlr run.
I'll take a look at adding some code like that and see what happens...
Thanks,
-- Scott
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Brannon King
> Sent: Friday, December 23, 2005 1:05 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] ANTLR Eclipse plugin newsgroup
>
> Schweet. Now that my email system is working right, I can
> continue a conversation from yesterday though I am going to
> have to start a new thread because of my new address.
>
> First, I'm not sure this is the right place to discuss
> ANTLR-Eclipse projects or integration. If not here, where? It
> appears that the ANTLREclipse plugin forum on Sourceforge
> only gets used on rare occasions.
>
> Second, contrary to Scott's posting yesterday that states
> that ANTLREclipse uses the ANTLR lexer/parser for syntax
> highlighting, it does not. I have the AntlrCodeScanner.java
> in front of me, and I assure you that it does syntax
> highlighting using the same methods as the other Eclipse
> plugins I've seen:
> it uses a list of keywords. I pulled the file from the
> SourceForge yesterday. It is possible that I did not get the
> right file, though the same (or similar) file is in
> org.antlr.eclipse.ui_4.0.0.b2 in my Eclipse plugins folder.
>
> I cannot see that it does on-the-fly syntax markers either
> (and I don't think I've seen any show up during my editing),
> though it can quite easily be done with code like the following:
>
> this(lexer, 2);
> this.file = ((IFileEditorInput)editor.getEditorInput()).getFile();
> this.editor = editor;
> this.doc = doc;
> public void reportError(RecognitionException ex) {
> try
> {
> file.deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ONE);
> }
> catch (CoreException e1)
> {
> e1.printStackTrace();
> }
> Map attributes = new HashMap();
> int line = ex.getLine()-1;
> MarkerUtilities.setMessage(attributes, ex.getMessage());
> MarkerUtilities.setLineNumber(attributes, line);
> try
> {
> int offset = doc.getLineOffset(line);
> MarkerUtilities.setCharStart(attributes, offset);
> MarkerUtilities.setCharEnd(attributes, offset + ex.getColumn()+6);
> attributes.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
> MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
> }
> catch (BadLocationException e)
> {
> e.printStackTrace();
> }
> catch (CoreException x)
> {
> x.printStackTrace();
> }
> }
>
>
>
More information about the antlr-interest
mailing list