void WriteStartTab() { for (Action action = firstState.firstAction; action != null; action = action.next) { int targetState = action.target.state.nr; if (action.typ == Node.chr) { gen.WriteLine("\t\tstart[" + action.sym + "] = " + targetState + "; "); } else { CharSet s = tab.CharClassSet(action.sym); for (CharSet.Range r = s.head; r != null; r = r.next) { gen.WriteLine("\t\tfor (int i = " + r.from + "; i <= " + r.to + "; ++i) start[i] = " + targetState + ";"); } } } gen.WriteLine("\t\tstart[Buffer.EOF] = -1;"); }
private void PutRange(CharSet s) { for (CharSet.Range r = s.head; r != null; r = r.next) { if (r.from == r.to) { gen.Write("ch == " + Ch(r.from)); } else if (r.from == 0) { gen.Write("ch <= " + Ch(r.to)); } else { gen.Write("ch >= " + Ch(r.from) + " && ch <= " + Ch(r.to)); } if (r.next != null) { gen.Write(" || "); } } }