Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Rule not working.
Rule not working. [message #710637] Fri, 05 August 2011 08:44 Go to next message
Alex  is currently offline Alex Friend
Messages: 2
Registered: August 2011
Junior Member
Hi, everyone!

I have question about Editor plugin. I created my rule such as WordRule.

I have this code in evaluatein method:

 public IToken evaluate(ICharacterScanner scanner) {
        int c = 0;

        if (scanner.getColumn() > 0) {
          scanner.unread();
          c = scanner.read();
          if (!Character.isWhitespace((char) c)) {
            return fDefaultToken;
          }
        }

        c= scanner.read();
        if (c != ICharacterScanner.EOF && fDetector.isWordStart((char) c)) {
            if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {

                fBuffer.setLength(0);
                do {
                    if (!fDetector.isWordPart((char) c))
                        break;

                        fBuffer.append((char) c);
                        c= scanner.read();

                } while (c != ICharacterScanner.EOF);

                String buffer= fBuffer.toString().toLowerCase().trim();

                IToken token= (IToken)fWords.get(buffer);

                if (token != null) {
                    return token;
                    }

                if (fDefaultToken.isUndefined())
                    unreadBuffer(scanner);
                return fDefaultToken;
            }
        }


1. When I started existing file, all working correct.
2. When I add whitespace between letter in word or before (after), all working correct.
3. When I add new letter before (after) to keyword part of old text has color such as predefined and new part of word has color such as undefined text. I debug my code and I see that this method return Token.Undefined.

What Do I do incorrect. Thanks for help!

Re: Rule not working. [message #710769 is a reply to message #710637] Fri, 05 August 2011 11:48 Go to previous message
Alex  is currently offline Alex Friend
Messages: 2
Registered: August 2011
Junior Member
I've resolved this problem. I need just check a start character of my sequence like as start character of word.
Previous Topic:html5 tags in .php do not validate without a doctype
Next Topic:Zend Debugger Cannot connect
Goto Forum:
  


Current Time: Thu Apr 25 05:22:04 GMT 2024

Powered by FUDForum. Page generated in 0.02646 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top