Gotos are frowned on. You should not use gotos. Long live gotos.
Until someone comes up with a better/faster/concise way of expressing the following DFA state machine (presented in part) I will continue to defend the use of gotos, even if their use cases have gotten significantly more narrow as progress has marched on.
When you need them, there is no better tool.
internal sealed partial class JsonStringRunner : FAStringRunner {
private FAMatch NextMatchImpl(string s) {
int ch;
int len;
int p;
int l;
int c;
ch = -1;
len = 0;
if ((this.position == -1)) {
this.position = 0;
}
p = this.position;
l = this.line;
c = this.column;
this.Advance(s, ref ch, ref len, true);
if (((((ch >= 9)
&& (ch <= 10))
|| (ch == 13))
|| (ch == 32))) {
this.Advance(s, ref ch, ref len, false);
goto q1;
}
if ((ch == 34)) {
this.Advance(s, ref ch, ref len, false);
goto q2;
}
if ((ch == 44)) {
this.Advance(s, ref ch, ref len, false);
goto q9;
}
if ((ch == 45)) {
this.Advance(s, ref ch, ref len, false);
goto q10;
}
if ((ch == 48)) {
this.Advance(s, ref ch, ref len, false);
goto q11;
}
if (((ch >= 49)
&& (ch <= 57))) {
this.Advance(s, ref ch, ref len, false);
goto q17;
}
if ((ch == 58)) {
this.Advance(s, ref ch, ref len, false);
goto q18;
}
if ((ch == 91)) {
this.Advance(s, ref ch, ref len, false);
goto q19;
}
if ((ch == 93)) {
this.Advance(s, ref ch, ref len, false);
goto q20;
}
if ((ch == 102)) {
this.Advance(s, ref ch, ref len, false);
goto q21;
}
if ((ch == 110)) {
this.Advance(s, ref ch, ref len, false);
goto q26;
}
if ((ch == 116)) {
this.Advance(s, ref ch, ref len, false);
goto q30;
}
if ((ch == 123)) {
this.Advance(s, ref ch, ref len, false);
goto q32;
}
if ((ch == 125)) {
this.Advance(s, ref ch, ref len, false);
goto q33;
}
goto errorout;
q1:
if (((((ch >= 9)
&& (ch <= 10))
|| (ch == 13))
|| (ch == 32))) {
this.Advance(s, ref ch, ref len, false);
goto q1;
}
return FAMatch.Create(10, s.Substring(p, len), p, l, c);
q2:
if ((((((ch >= 0)
&& (ch <= 9))
|| ((ch >= 11)
&& (ch <= 33)))
|| ((ch >= 35)
&& (ch <= 91)))
|| ((ch >= 93)
&& (ch <= 1114111)))) {
this.Advance(s, ref ch, ref len, false);
goto q2;
}
if ((ch == 34)) {
this.Advance(s, ref ch, ref len, false);
goto q3;
}
if ((ch == 92)) {
this.Advance(s, ref ch, ref len, false);
goto q4;
}
goto errorout;
q3:
return FAMatch.Create(9, s.Substring(p, len), p, l, c);
q4:
if (((((((((ch == 34)
|| (ch == 47))
|| (ch == 92))
|| (ch == 98))
|| (ch == 102))
|| (ch == 110))
|| (ch == 114))
|| (ch == 116))) {
this.Advance(s, ref ch, ref len, false);
goto q2;
}
if ((ch == 117)) {
this.Advance(s, ref ch, ref len, false);
goto q5;
}
goto errorout;
q5:
if (((((ch >= 48)
&& (ch <= 57))
|| ((ch >= 65)
&& (ch <= 70)))
|| ((ch >= 97)
&& (ch <= 102)))) {
this.Advance(s, ref ch, ref len, false);
goto q6;
}
goto errorout;
q6:
if (((((ch >= 48)
&& (ch <= 57))
|| ((ch >= 65)
&& (ch <= 70)))
|| ((ch >= 97)
&& (ch <= 102)))) {
this.Advance(s, ref ch, ref len, false);
goto q7;
}
goto errorout;
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|