1 19 package org.netbeans.modules.css.text.syntax.javacc.lib; 20 21 import org.netbeans.editor.Syntax; 22 23 29 30 public final class JJStateInfo extends Syntax.BaseStateInfo { 31 32 private int[] states; 33 34 public void setSubStates(int[] states) { 35 this.states = states; 36 } 37 38 public int[] getSubStates() { 39 return states; 40 } 41 42 43 44 public int compareSubStates(int[] sub) { 45 if (states == null) return Syntax.DIFFERENT_STATE; 46 if (sub == null) return Syntax.DIFFERENT_STATE; 47 if (states.length != sub.length) return Syntax.DIFFERENT_STATE; 48 49 for (int i = states.length-1; i>=0; i--) { if (states[i] != sub[i]) return Syntax.DIFFERENT_STATE; 51 } 52 return Syntax.EQUAL_STATE; 53 } 54 55 public String toString() { 56 StringBuffer buf = new StringBuffer (); 57 buf.append("(JJ[").append("S:" + getState()); buf.append("P:" + getPreScan()).append("subS:"); for (int i=0; i<states.length; i++) { 60 buf.append(states[i] + ","); } 62 buf.append("]JJ)"); return buf.toString(); 64 } 65 } 66 | Popular Tags |