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 04:44 Go to next message
Alex  is currently offline Alex
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 07:48 Go to previous message
Alex  is currently offline Alex
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: Mon Apr 21 00:37:06 EDT 2014

Powered by FUDForum. Page generated in 0.04782 seconds