Changeset 10983


Ignore:
Timestamp:
02/04/06 21:15:33 (18 years ago)
Author:
piso
Message:

Support explicit tags for C++.

Location:
trunk/j/src/org/armedbear/j
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/CppTagger.java

    r10977 r10983  
    7070        if (pos.lookingAt("//"))
    7171          {
     72            LocalTag tag = checkForExplicitTag(pos);
     73            if (tag instanceof CppTag)
     74              tags.add(tag);
    7275            skipSingleLineComment(pos);
    7376            continue;
  • trunk/j/src/org/armedbear/j/JavaTagger.java

    r10982 r10983  
    33 *
    44 * Copyright (C) 1998-2006 Peter Graves
    5  * $Id: JavaTagger.java,v 1.7 2006-02-04 21:00:26 piso Exp $
     5 * $Id: JavaTagger.java,v 1.8 2006-02-04 21:14:30 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8585        if (pos.lookingAt("//"))
    8686          {
     87            LocalTag tag = checkForExplicitTag(pos);
     88            if (tag instanceof JavaTag)
     89              tags.add(tag);
    8790            skipSingleLineComment(pos);
    8891            continue;
     
    364367  protected final void skipSingleLineComment(Position pos)
    365368  {
    366     checkForExplicitTag(pos);
    367369    Line next = pos.getNextLine();
    368370    if (next != null)
     
    372374  }
    373375
    374   private final void checkForExplicitTag(Position pos)
    375   {
    376     if (tags == null)
    377       return; // Only supported for Java and JavaScript for now.
     376  protected final LocalTag checkForExplicitTag(Position pos)
     377  {
     378    // Only supported for Java, JavaScript and C++ for now.
     379    final int modeId = buffer.getModeId();
     380    if (modeId != JAVA_MODE && modeId != JAVASCRIPT_MODE && modeId != CPP_MODE)
     381      return null;
    378382    final String explicitTag =
    379383      Editor.preferences().getStringProperty(Property.EXPLICIT_TAG);
     
    419423            pos.setOffset(0);
    420424            pos.skipWhitespace();
    421             tags.add(new JavaTag(tag, pos, TAG_EXPLICIT, 0, currentClass));
    422           }
    423       }
     425            if (buffer.getModeId() == JAVA_MODE)
     426              return new JavaTag(tag, pos, TAG_EXPLICIT, 0, currentClass);
     427            else if (buffer.getModeId() == CPP_MODE)
     428              return new CppTag(tag, pos, TAG_EXPLICIT);
     429          }
     430      }
     431    return null;
    424432  }
    425433
Note: See TracChangeset for help on using the changeset viewer.