|
From: Christopher W. <caw...@us...> - 2006-04-21 21:06:55
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24269/src/org/rubypeople/rdt/internal/ui/text/ruby Modified Files: SymbolRule.java SingleCharacterPrefixRule.java Log Message: Fix template auto-insert and symbol syntax highlighting Index: SingleCharacterPrefixRule.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/SingleCharacterPrefixRule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SingleCharacterPrefixRule.java 20 Dec 2005 15:35:41 -0000 1.2 --- SingleCharacterPrefixRule.java 21 Apr 2006 21:06:47 -0000 1.3 *************** *** 21,24 **** --- 21,25 ---- protected int fMinLength; protected int fMaxLength; + private StringBuffer fWord; public SingleCharacterPrefixRule(char prefix, IToken token, int minLength, int maxLength) { *************** *** 35,47 **** int c = scanner.read(); int length = 1; if (((char) c) == fPrefix) { // Now read until we hit EOF, EOL or whitespace while (true) { c = scanner.read(); if (!isValidCharacter(c, length)) { ! scanner.unread(); ! if (!lengthInRange(length)) return Token.UNDEFINED; return fToken; } length++; } --- 36,56 ---- int c = scanner.read(); int length = 1; + fWord = new StringBuffer(); if (((char) c) == fPrefix) { + fWord.append(((char) c)); // Now read until we hit EOF, EOL or whitespace while (true) { c = scanner.read(); if (!isValidCharacter(c, length)) { ! if (!isValidEndCharacter(c, length)) ! scanner.unread(); ! else { ! fWord.append(((char) c)); ! length++; ! } ! if (!lengthInRange(length) || !wordValid(fWord.toString())) return Token.UNDEFINED; return fToken; } + fWord.append(((char) c)); length++; } *************** *** 52,56 **** } ! /** * Determine if the current character is valid for the rule. Return false if * the character is not a part of the token. This is not applied to the --- 61,73 ---- } ! protected boolean wordValid(String word) { ! return true; ! } ! ! protected boolean isValidEndCharacter(int c, int length) { ! return false; ! } ! ! /** * Determine if the current character is valid for the rule. Return false if * the character is not a part of the token. This is not applied to the Index: SymbolRule.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/SymbolRule.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SymbolRule.java 28 Mar 2006 19:48:22 -0000 1.4 --- SymbolRule.java 21 Apr 2006 21:06:47 -0000 1.5 *************** *** 23,33 **** // Symbols can only contain word characters (a-zA-Z0-9_) // TODO which special method names contain brackets? ! String theChar = String.valueOf((char) c); ! if(theChar.matches("\\w")) { ! return true; ! } ! else { ! return false; ! } } --- 23,36 ---- // Symbols can only contain word characters (a-zA-Z0-9_) // TODO which special method names contain brackets? ! return Character.isLetterOrDigit((char) c) || c == '_'; ! } ! ! protected boolean isValidEndCharacter(int c, int length) { ! return c == '?' || c == '!'; ! } ! ! protected boolean wordValid(String word) { ! System.out.println(word); ! return !Character.isDigit(word.charAt(1)); } |