(final TextIterator iter)
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public Color getColor(final TextIterator iter) { |
| 55 | final int ch = iter.curr(); |
| 56 | |
| 57 | // opened quote |
| 58 | if(quote != 0) { |
| 59 | if(back) { |
| 60 | back = false; |
| 61 | } else if(ch == quote) { |
| 62 | quote = 0; |
| 63 | } else { |
| 64 | back = ch == '\\'; |
| 65 | } |
| 66 | return brown; |
| 67 | } |
| 68 | |
| 69 | // comment |
| 70 | if(comment1 == 0 && ch == '/') { |
| 71 | comment1++; |
| 72 | } else if(comment1 == 1) { |
| 73 | comment1 = ch == '*' ? 2 : 0; |
| 74 | } else if(comment1 == 2 && ch == '*') { |
| 75 | comment1++; |
| 76 | } else if(comment1 == 3) { |
| 77 | comment1 = ch == '/' ? 0 : 2; |
| 78 | } |
| 79 | // comment |
| 80 | if(comment2 == 0 && ch == '/') { |
| 81 | comment2++; |
| 82 | } else if(comment2 == 1) { |
| 83 | comment2 = ch == '/' ? 2 : 0; |
| 84 | } else if(comment2 == 2 && ch == '\n') { |
| 85 | comment2 = 0; |
| 86 | } |
| 87 | if(comment1 != 0 || comment2 != 0) { |
| 88 | var = false; |
| 89 | return cyan; |
| 90 | } |
| 91 | |
| 92 | // quotes |
| 93 | if(back) { |
| 94 | back = false; |
| 95 | } else if(ch == '\\') { |
| 96 | back = true; |
| 97 | } else if(ch == '"' || ch == '\'') { |
| 98 | quote = ch; |
| 99 | return brown; |
| 100 | } |
| 101 | |
| 102 | // variables |
| 103 | if(ch == '$') { |
| 104 | var = true; |
| 105 | return green; |
| 106 | } |
| 107 | if(var) { |
| 108 | var = XMLToken.isNCStartChar(ch); |
| 109 | return green; |
| 110 | } |
nothing calls this directly
no test coverage detected