1 19 20 package org.netbeans.editor.ext.plain; 21 22 import org.netbeans.editor.Syntax; 23 import org.netbeans.editor.TokenID; 24 25 31 32 public class PlainSyntax extends Syntax { 33 34 40 private static final int ISI_TEXT = 0; 41 42 public PlainSyntax() { 43 tokenContextPath = PlainTokenContext.contextPath; 44 } 45 46 58 protected TokenID parseToken() { 59 while (offset < stopOffset) { 61 char ch = buffer[offset]; 63 switch (state) { case INIT: 65 switch (ch) { 66 case '\n': 67 offset++; 68 return PlainTokenContext.EOL; 69 default: 70 state = ISI_TEXT; 71 break; 72 } 73 break; 74 75 case ISI_TEXT: 76 switch (ch) { 77 case '\n': 78 state = INIT; 79 return PlainTokenContext.TEXT; 80 } 81 break; 82 83 } 85 offset++; } 87 88 116 117 switch (state) { 120 case ISI_TEXT: 121 state = INIT; 122 return PlainTokenContext.TEXT; 123 } 124 125 return null; 127 } 128 129 } 130 | Popular Tags |