public static InternalError ( Object error ) : void | ||
error | Object | |
return | void |
protected static ReportData DecodeReportData(string dataS) { ReportData data = new ReportData(); IEnumerator <string> st = dataS.Split('\t').Cast <string>().GetEnumerator(); FieldInfo[] fields = typeof(ReportData).GetFields(); foreach (FieldInfo f in fields) { st.MoveNext(); string v = st.Current; try { if (f.FieldType == typeof(string)) { f.SetValue(data, v); } else if (f.FieldType == typeof(double)) { f.SetValue(data, double.Parse(v)); } else { f.SetValue(data, int.Parse(v)); } } catch (Exception e) { ErrorManager.InternalError("Can't get data", e); } } return(data); }
/** Create a single-line stats report about this grammar suitable to * send to the notify page at antlr.org */ public virtual string ToNotifyString() { StringBuilder buf = new StringBuilder(); ReportData data = GetReportData(grammar); FieldInfo[] fields = typeof(ReportData).GetFields(); int i = 0; foreach (FieldInfo f in fields) { try { object v = f.GetValue(data); string s = v != null?v.ToString() : "null"; if (i > 0) { buf.Append('\t'); } buf.Append(s); } catch (Exception e) { ErrorManager.InternalError("Can't get data", e); } i++; } return(buf.ToString()); }
/** In stateNumberTranslator, get a map from State to new, normalized * state number. Used by walkSerializingFA to make sure any two * identical state machines will serialize the same way. */ protected virtual void WalkFANormalizingStateNumbers(State s) { if (s == null) { ErrorManager.InternalError("null state s"); return; } if (stateNumberTranslator.ContainsKey(s)) { return; // already did this state } // assign a new state number for this node if there isn't one stateNumberTranslator[s] = stateCounter; stateCounter++; // visit nodes pointed to by each transition; for (int i = 0; i < s.NumberOfTransitions; i++) { Transition edge = (Transition)s.GetTransition(i); WalkFANormalizingStateNumbers(edge.Target); // keep walkin' // if this transition is a rule reference, the node "following" this state // will not be found and appear to be not in graph. Must explicitly jump // to it, but don't "draw" an edge. if (edge is RuleClosureTransition) { WalkFANormalizingStateNumbers(((RuleClosureTransition)edge).FollowState); } } }
protected static ReportData DecodeReportData(string dataS) { ReportData data = new ReportData(); StringTokenizer st = new StringTokenizer(dataS, "\t"); FieldInfo[] fields = typeof(ReportData).GetFields(); foreach (FieldInfo f in fields) { string v = st.nextToken(); try { if (f.FieldType == typeof(string)) { f.SetValue(data, v); } else if (f.FieldType == typeof(double)) { f.SetValue(data, double.Parse(v)); } else { f.SetValue(data, int.Parse(v)); } } catch (Exception e) { ErrorManager.InternalError("Can't get data", e); } } return(data); }
public virtual bool HasRewrite(int i) { if (i >= altsWithRewrites.Length) { ErrorManager.InternalError("alt " + i + " exceeds number of " + Name + "'s alts (" + altsWithRewrites.Length + ")"); return(false); } return(altsWithRewrites[i]); }