+
+typedef struct {
+ int state;
+ int a;
+ int b;
+ int next_if_match;
+ int next_if_not_match;
+} scanner_state_t;
+
+/* Simple, linear state-transition diagram for the uuencode filter.
+ *
+ * If the character being processed is within the range of [a, b]
+ * for the current state then we transition next_if_match
+ * state. If not, we transition to the next_if_not_match state.
+ *
+ * The final two states are special in that they are the states in
+ * which we discard data. */
+static const int first_uuencode_skipping_state = 11;
+static const scanner_state_t uuencode_states[] = {
+ { 0, 'b', 'b', 1, 0 },
+ { 1, 'e', 'e', 2, 0 },
+ { 2, 'g', 'g', 3, 0 },
+ { 3, 'i', 'i', 4, 0 },
+ { 4, 'n', 'n', 5, 0 },
+ { 5, ' ', ' ', 6, 0 },
+ { 6, '0', '7', 7, 0 },
+ { 7, '0', '7', 8, 0 },
+ { 8, '0', '7', 9, 0 },
+ { 9, ' ', ' ', 10, 0 },
+ { 10, '\n', '\n', 11, 10 },
+ { 11, 'M', 'M', 12, 0 },
+ { 12, ' ', '`', 12, 11 }
+};
+
+/* The following table is intended to implement this DFA (in 'dot'
+ * format). Note that 2 and 3 are "hidden" states used to step through
+ * the possible out edges of state 1.
+ *
+ * digraph html_filter {
+ * 0 -> 1 [label="<"];
+ * 0 -> 0;
+ * 1 -> 4 [label="'"];
+ * 1 -> 5 [label="\""];
+ * 1 -> 0 [label=">"];
+ * 1 -> 1;
+ * 4 -> 1 [label="'"];
+ * 4 -> 4;
+ * 5 -> 1 [label="\""];
+ * 5 -> 5;
+ * }
+ */
+static const int first_html_skipping_state = 1;
+static const scanner_state_t html_states[] = {
+ { 0, '<', '<', 1, 0 },
+ { 1, '\'', '\'', 4, 2 }, /* scanning for quote or > */
+ { 1, '"', '"', 5, 3 },
+ { 1, '>', '>', 0, 1 },
+ { 4, '\'', '\'', 1, 4 }, /* inside single quotes */
+ { 5, '"', '"', 1, 5 }, /* inside double quotes */
+};
+