mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
build(ragel): guard date_scan and strip #line from the remaining outputs (#2029)
Two remainders from #2025. ## date_scan.cpp was unguarded hooks/pre-commit knew about four Ragel outputs; mux/lib/date_scan.cpp was absent from GENERATED_GENS entirely, so it could be hand-edited and committed without its .rl and nothing objected -- while being listed in docs/generated-files.md and shipped via unix/TOC.patchable. Added to all three parallel arrays, which now hold 27 each. Verified by alignment rather than by count: equal lengths prove nothing about correspondence, so the check confirms every ragel triple's basenames match and its rule lives in the same directory as its output. Then exercised: staging date_scan.cpp alone is now blocked, naming date_scan.rl as its source. ## Six more outputs carried #line #2025's scope was right for what the mux build regenerates and dounix.sh ships, but these have live rules of their own and could still dirty a tree: testcases/tools/unformat.c 28 testcases/tools/Makefile (%.c: %.rl) testcases/tools/reformat.c 23 same ragel/trigger_match.c 16 ragel/Makefile tools/ansify/ansify.c 19 tools/ansify/Makefile (make regen) client/tf/src/script_lex.cpp 67 client/tf/CMakeLists.txt client/tf/src/input_lex.cpp 62 same The issue reported "no rule found" for trigger_match.c and ansify.c. Both were wrong: ragel/Makefile:25 generates trigger_match.c on dependency, and tools/ansify/Makefile has an explicit `regen` target. Neither is inert -- ansify's is opt-in rather than implicit, which is why it reads as absent. Each regenerated through its OWN rule rather than by running sed by hand, so the rule is what is under test. All six are idempotent across a second regeneration, and the diffs are 215 deletions, every one a #line, nothing added. ragel/color_ops.c is generated from the same ../mux/lib/color_ops.rl as the shipped copy but is not tracked, so it could not dirty anything; its rule gets the strip anyway, so the two generations of one source cannot disagree if it is ever checked in. client/tf could not be built here -- src/regex_utils.h needs pcre2.h, which is not on that target's include path on macOS -- but that is a pre-existing gap unrelated to this change. The Ragel custom commands themselves DID run (cmake configure succeeds once NCURSESW_LIB is pointed at a macOS ncurses), and both outputs came back stripped, so the CMake edit is exercised rather than assumed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8531bcc9f4
commit
0a934a7d78
11 changed files with 9 additions and 215 deletions
|
|
@ -60,6 +60,8 @@ foreach(RL_NAME input_lex script_lex)
|
|||
add_custom_command(
|
||||
OUTPUT ${RL_OUTPUT}
|
||||
COMMAND ${RAGEL} -G2 -o ${RL_OUTPUT} ${RL_INPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E env sh -c
|
||||
"sed '/^#line /d' '${RL_OUTPUT}' > '${RL_OUTPUT}.tmp' && mv -f '${RL_OUTPUT}.tmp' '${RL_OUTPUT}'"
|
||||
DEPENDS ${RL_INPUT}
|
||||
COMMENT "Ragel -G2: ${RL_NAME}.rl -> ${RL_NAME}.cpp"
|
||||
VERBATIM)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
// input_lex.rl — Ragel -G2 terminal input scanner.
|
||||
//
|
||||
// Single-pass goto-driven DFA that tokenizes raw terminal bytes into
|
||||
|
|
@ -12,14 +11,12 @@
|
|||
#include <cstring>
|
||||
|
||||
|
||||
#line 13 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
static const int input_lex_start = 6;
|
||||
static const int input_lex_error = -1;
|
||||
|
||||
static const int input_lex_en_main = 6;
|
||||
|
||||
|
||||
#line 109 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
|
||||
|
||||
// --- C++ implementation ---
|
||||
|
|
@ -163,7 +160,6 @@ void InputLexer::feed(const unsigned char* data, size_t len) {
|
|||
int cs, act;
|
||||
|
||||
|
||||
#line 160 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
{
|
||||
cs = input_lex_start;
|
||||
ts = 0;
|
||||
|
|
@ -171,36 +167,29 @@ void InputLexer::feed(const unsigned char* data, size_t len) {
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 252 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
|
||||
#line 166 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr0:
|
||||
#line 103 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{{p = ((te))-1;}{ emit(Key::ESCAPE); }}
|
||||
goto st6;
|
||||
tr1:
|
||||
#line 42 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
dispatch_ss3(*(te - 1));
|
||||
}}
|
||||
goto st6;
|
||||
tr4:
|
||||
#line 37 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
dispatch_csi(ts + 2, te - 1);
|
||||
}}
|
||||
goto st6;
|
||||
tr5:
|
||||
#line 106 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{{p = ((te))-1;}{ /* discard */ }}
|
||||
goto st6;
|
||||
tr6:
|
||||
#line 52 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
uint32_t cp = ((uint32_t)(ts[0] & 0x0F) << 12)
|
||||
| ((uint32_t)(ts[1] & 0x3F) << 6)
|
||||
|
|
@ -209,7 +198,6 @@ tr6:
|
|||
}}
|
||||
goto st6;
|
||||
tr8:
|
||||
#line 58 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
uint32_t cp = ((uint32_t)(ts[0] & 0x07) << 18)
|
||||
| ((uint32_t)(ts[1] & 0x3F) << 12)
|
||||
|
|
@ -219,133 +207,101 @@ tr8:
|
|||
}}
|
||||
goto st6;
|
||||
tr9:
|
||||
#line 106 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ /* discard */ }}
|
||||
goto st6;
|
||||
tr10:
|
||||
#line 79 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_A); }}
|
||||
goto st6;
|
||||
tr11:
|
||||
#line 80 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_B); }}
|
||||
goto st6;
|
||||
tr12:
|
||||
#line 81 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_C); }}
|
||||
goto st6;
|
||||
tr13:
|
||||
#line 82 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_D); }}
|
||||
goto st6;
|
||||
tr14:
|
||||
#line 83 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_E); }}
|
||||
goto st6;
|
||||
tr15:
|
||||
#line 84 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_F); }}
|
||||
goto st6;
|
||||
tr16:
|
||||
#line 85 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_G); }}
|
||||
goto st6;
|
||||
tr17:
|
||||
#line 76 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::BACKSPACE); }}
|
||||
goto st6;
|
||||
tr18:
|
||||
#line 74 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::TAB); }}
|
||||
goto st6;
|
||||
tr19:
|
||||
#line 73 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::ENTER); }}
|
||||
goto st6;
|
||||
tr20:
|
||||
#line 86 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_K); }}
|
||||
goto st6;
|
||||
tr21:
|
||||
#line 87 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_L); }}
|
||||
goto st6;
|
||||
tr22:
|
||||
#line 72 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::ENTER); }}
|
||||
goto st6;
|
||||
tr23:
|
||||
#line 88 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_N); }}
|
||||
goto st6;
|
||||
tr24:
|
||||
#line 89 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_O); }}
|
||||
goto st6;
|
||||
tr25:
|
||||
#line 90 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_P); }}
|
||||
goto st6;
|
||||
tr26:
|
||||
#line 91 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_Q); }}
|
||||
goto st6;
|
||||
tr27:
|
||||
#line 92 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_R); }}
|
||||
goto st6;
|
||||
tr28:
|
||||
#line 93 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_S); }}
|
||||
goto st6;
|
||||
tr29:
|
||||
#line 94 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_T); }}
|
||||
goto st6;
|
||||
tr30:
|
||||
#line 95 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_U); }}
|
||||
goto st6;
|
||||
tr31:
|
||||
#line 96 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_V); }}
|
||||
goto st6;
|
||||
tr32:
|
||||
#line 97 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_W); }}
|
||||
goto st6;
|
||||
tr33:
|
||||
#line 98 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_X); }}
|
||||
goto st6;
|
||||
tr34:
|
||||
#line 99 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_Y); }}
|
||||
goto st6;
|
||||
tr35:
|
||||
#line 100 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::CTRL_Z); }}
|
||||
goto st6;
|
||||
tr37:
|
||||
#line 67 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
emit_char((uint32_t)(*ts));
|
||||
}}
|
||||
goto st6;
|
||||
tr38:
|
||||
#line 75 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{ emit(Key::BACKSPACE); }}
|
||||
goto st6;
|
||||
tr46:
|
||||
#line 103 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p;p--;{ emit(Key::ESCAPE); }}
|
||||
goto st6;
|
||||
tr48:
|
||||
#line 106 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p;p--;{ /* discard */ }}
|
||||
goto st6;
|
||||
tr49:
|
||||
#line 47 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
{te = p+1;{
|
||||
uint32_t cp = ((uint32_t)(ts[0] & 0x1F) << 6)
|
||||
| (uint32_t)(ts[1] & 0x3F);
|
||||
|
|
@ -353,14 +309,11 @@ tr49:
|
|||
}}
|
||||
goto st6;
|
||||
st6:
|
||||
#line 1 "NONE"
|
||||
{ts = 0;}
|
||||
if ( ++p == pe )
|
||||
goto _test_eof6;
|
||||
case 6:
|
||||
#line 1 "NONE"
|
||||
{ts = p;}
|
||||
#line 312 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 1u: goto tr10;
|
||||
case 2u: goto tr11;
|
||||
|
|
@ -414,14 +367,12 @@ case 6:
|
|||
goto st8;
|
||||
goto tr37;
|
||||
tr36:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st7;
|
||||
st7:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof7;
|
||||
case 7:
|
||||
#line 371 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 79u: goto st0;
|
||||
case 91u: goto st1;
|
||||
|
|
@ -465,14 +416,12 @@ case 8:
|
|||
goto tr49;
|
||||
goto tr48;
|
||||
tr40:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st9;
|
||||
st9:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof9;
|
||||
case 9:
|
||||
#line 420 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 160u <= (*p) && (*p) <= 191u )
|
||||
goto st3;
|
||||
goto tr48;
|
||||
|
|
@ -484,38 +433,32 @@ case 3:
|
|||
goto tr6;
|
||||
goto tr5;
|
||||
tr41:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st10;
|
||||
st10:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof10;
|
||||
case 10:
|
||||
#line 437 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 128u <= (*p) && (*p) <= 191u )
|
||||
goto st3;
|
||||
goto tr48;
|
||||
tr42:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st11;
|
||||
st11:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof11;
|
||||
case 11:
|
||||
#line 447 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 128u <= (*p) && (*p) <= 159u )
|
||||
goto st3;
|
||||
goto tr48;
|
||||
tr43:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st12;
|
||||
st12:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof12;
|
||||
case 12:
|
||||
#line 457 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 144u <= (*p) && (*p) <= 191u )
|
||||
goto st4;
|
||||
goto tr48;
|
||||
|
|
@ -534,26 +477,22 @@ case 5:
|
|||
goto tr8;
|
||||
goto tr5;
|
||||
tr44:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st13;
|
||||
st13:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof13;
|
||||
case 13:
|
||||
#line 481 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 128u <= (*p) && (*p) <= 191u )
|
||||
goto st4;
|
||||
goto tr48;
|
||||
tr45:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st14;
|
||||
st14:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof14;
|
||||
case 14:
|
||||
#line 491 "/home/sdennis/tinymux/client/tf/src/input_lex.cpp"
|
||||
if ( 128u <= (*p) && (*p) <= 143u )
|
||||
goto st4;
|
||||
goto tr48;
|
||||
|
|
@ -597,5 +536,4 @@ case 14:
|
|||
|
||||
}
|
||||
|
||||
#line 253 "/home/sdennis/tinymux/client/tf/src/input_lex.rl"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
// script_lex.rl — Ragel -G2 expression tokenizer.
|
||||
//
|
||||
// Tokenizes TF expression language: numeric/string literals, identifiers,
|
||||
|
|
@ -13,14 +12,12 @@
|
|||
#include <cstring>
|
||||
|
||||
|
||||
#line 14 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
static const int script_lex_start = 7;
|
||||
static const int script_lex_error = -1;
|
||||
|
||||
static const int script_lex_en_main = 7;
|
||||
|
||||
|
||||
#line 102 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
|
||||
|
||||
void ScriptLexer::emit(Tok t) {
|
||||
|
|
@ -94,7 +91,6 @@ void ScriptLexer::tokenize(const char* data, size_t len) {
|
|||
(void)script_lex_en_main; // suppress unused warning
|
||||
|
||||
|
||||
#line 91 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
{
|
||||
cs = script_lex_start;
|
||||
ts = 0;
|
||||
|
|
@ -102,28 +98,22 @@ void ScriptLexer::tokenize(const char* data, size_t len) {
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 175 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
|
||||
#line 97 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr0:
|
||||
#line 99 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{{p = ((te))-1;}{ emit(Tok::ERROR); }}
|
||||
goto st7;
|
||||
tr2:
|
||||
#line 52 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit_string(ts, te); }}
|
||||
goto st7;
|
||||
tr5:
|
||||
#line 53 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit_string(ts, te); }}
|
||||
goto st7;
|
||||
tr7:
|
||||
#line 1 "NONE"
|
||||
{ switch( act ) {
|
||||
case 2:
|
||||
{{p = ((te))-1;} emit_float(ts, te); }
|
||||
|
|
@ -135,174 +125,131 @@ tr7:
|
|||
}
|
||||
goto st7;
|
||||
tr10:
|
||||
#line 49 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{{p = ((te))-1;}{ emit_int(ts, te); }}
|
||||
goto st7;
|
||||
tr12:
|
||||
#line 99 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::ERROR); }}
|
||||
goto st7;
|
||||
tr17:
|
||||
#line 82 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::AND); }}
|
||||
goto st7;
|
||||
tr19:
|
||||
#line 85 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::LPAREN); }}
|
||||
goto st7;
|
||||
tr20:
|
||||
#line 86 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::RPAREN); }}
|
||||
goto st7;
|
||||
tr23:
|
||||
#line 88 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::COMMA); }}
|
||||
goto st7;
|
||||
tr33:
|
||||
#line 89 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::QUESTION); }}
|
||||
goto st7;
|
||||
tr35:
|
||||
#line 83 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::OR); }}
|
||||
goto st7;
|
||||
tr36:
|
||||
#line 87 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::RBRACE); }}
|
||||
goto st7;
|
||||
tr37:
|
||||
#line 44 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ /* skip */ }}
|
||||
goto st7;
|
||||
tr38:
|
||||
#line 84 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::NOT); }}
|
||||
goto st7;
|
||||
tr39:
|
||||
#line 68 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::NMATCH); }}
|
||||
goto st7;
|
||||
tr40:
|
||||
#line 62 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::NE); }}
|
||||
goto st7;
|
||||
tr41:
|
||||
#line 66 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::STRNE); }}
|
||||
goto st7;
|
||||
tr42:
|
||||
#line 99 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::ERROR); }}
|
||||
goto st7;
|
||||
tr43:
|
||||
#line 73 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::PERCENT_LBRACE); }}
|
||||
goto st7;
|
||||
tr44:
|
||||
#line 78 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::STAR); }}
|
||||
goto st7;
|
||||
tr45:
|
||||
#line 59 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::STAR_ASSIGN); }}
|
||||
goto st7;
|
||||
tr46:
|
||||
#line 76 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::PLUS); }}
|
||||
goto st7;
|
||||
tr47:
|
||||
#line 69 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::INC); }}
|
||||
goto st7;
|
||||
tr48:
|
||||
#line 57 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::PLUS_ASSIGN); }}
|
||||
goto st7;
|
||||
tr49:
|
||||
#line 77 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::MINUS); }}
|
||||
goto st7;
|
||||
tr50:
|
||||
#line 70 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::DEC); }}
|
||||
goto st7;
|
||||
tr51:
|
||||
#line 58 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::MINUS_ASSIGN); }}
|
||||
goto st7;
|
||||
tr53:
|
||||
#line 47 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit_float(ts, te); }}
|
||||
goto st7;
|
||||
tr55:
|
||||
#line 79 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::SLASH); }}
|
||||
goto st7;
|
||||
tr56:
|
||||
#line 60 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::SLASH_ASSIGN); }}
|
||||
goto st7;
|
||||
tr57:
|
||||
#line 49 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit_int(ts, te); }}
|
||||
goto st7;
|
||||
tr59:
|
||||
#line 48 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit_int(ts, te); }}
|
||||
goto st7;
|
||||
tr60:
|
||||
#line 90 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::COLON); }}
|
||||
goto st7;
|
||||
tr61:
|
||||
#line 56 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::ASSIGN); }}
|
||||
goto st7;
|
||||
tr62:
|
||||
#line 80 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::LT); }}
|
||||
goto st7;
|
||||
tr63:
|
||||
#line 63 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::LE); }}
|
||||
goto st7;
|
||||
tr64:
|
||||
#line 93 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::EQ); }}
|
||||
goto st7;
|
||||
tr65:
|
||||
#line 67 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::MATCH); }}
|
||||
goto st7;
|
||||
tr66:
|
||||
#line 61 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::EQ); }}
|
||||
goto st7;
|
||||
tr67:
|
||||
#line 65 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::STREQ); }}
|
||||
goto st7;
|
||||
tr68:
|
||||
#line 81 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit(Tok::GT); }}
|
||||
goto st7;
|
||||
tr69:
|
||||
#line 64 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p+1;{ emit(Tok::GE); }}
|
||||
goto st7;
|
||||
tr70:
|
||||
#line 96 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{te = p;p--;{ emit_ident(ts, te); }}
|
||||
goto st7;
|
||||
st7:
|
||||
#line 1 "NONE"
|
||||
{ts = 0;}
|
||||
if ( ++p == pe )
|
||||
goto _test_eof7;
|
||||
case 7:
|
||||
#line 1 "NONE"
|
||||
{ts = p;}
|
||||
#line 248 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 13: goto st8;
|
||||
case 32: goto st8;
|
||||
|
|
@ -363,14 +310,12 @@ case 9:
|
|||
}
|
||||
goto tr38;
|
||||
tr15:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st10;
|
||||
st10:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof10;
|
||||
case 10:
|
||||
#line 314 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 34: goto tr2;
|
||||
case 92: goto st1;
|
||||
|
|
@ -398,14 +343,12 @@ case 11:
|
|||
goto tr43;
|
||||
goto tr42;
|
||||
tr18:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st12;
|
||||
st12:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof12;
|
||||
case 12:
|
||||
#line 347 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 39: goto tr5;
|
||||
case 92: goto st3;
|
||||
|
|
@ -458,16 +401,13 @@ case 16:
|
|||
goto tr52;
|
||||
goto tr42;
|
||||
tr52:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 47 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{act = 2;}
|
||||
goto st17;
|
||||
st17:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof17;
|
||||
case 17:
|
||||
#line 406 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 69: goto st4;
|
||||
case 101: goto st4;
|
||||
|
|
@ -508,16 +448,13 @@ case 19:
|
|||
goto tr56;
|
||||
goto tr55;
|
||||
tr27:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 49 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{act = 4;}
|
||||
goto st20;
|
||||
st20:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof20;
|
||||
case 20:
|
||||
#line 453 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 46: goto tr52;
|
||||
case 69: goto st4;
|
||||
|
|
@ -529,16 +466,13 @@ case 20:
|
|||
goto tr28;
|
||||
goto tr57;
|
||||
tr28:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 49 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
{act = 4;}
|
||||
goto st21;
|
||||
st21:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof21;
|
||||
case 21:
|
||||
#line 471 "/home/sdennis/tinymux/client/tf/src/script_lex.cpp"
|
||||
switch( (*p) ) {
|
||||
case 46: goto tr52;
|
||||
case 69: goto st4;
|
||||
|
|
@ -685,7 +619,6 @@ case 27:
|
|||
|
||||
}
|
||||
|
||||
#line 176 "/home/sdennis/tinymux/client/tf/src/script_lex.rl"
|
||||
|
||||
// Append END sentinel
|
||||
tokens_.push_back({Tok::END, {}, 0, 0.0});
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ GENERATED_GENS=(
|
|||
"mux/modules/engine/art_scan.cpp"
|
||||
"mux/modules/engine/ast_scan.cpp"
|
||||
"mux/lib/color_ops.c"
|
||||
"mux/lib/date_scan.cpp"
|
||||
"mux/muxescape/muxescape.cpp"
|
||||
|
||||
# Unicode tables (source is the utf/ pipeline, not a single file)
|
||||
|
|
@ -57,6 +58,7 @@ GENERATED_SRCS=(
|
|||
"mux/modules/engine/art_scan.rl"
|
||||
"mux/modules/engine/ast_scan.rl"
|
||||
"mux/lib/color_ops.rl"
|
||||
"mux/lib/date_scan.rl"
|
||||
"mux/muxescape/muxescape.rl"
|
||||
|
||||
"utf/"
|
||||
|
|
@ -91,6 +93,7 @@ GENERATED_RULES=(
|
|||
"mux/modules/engine/Makefile.am"
|
||||
"mux/modules/engine/Makefile.am"
|
||||
"mux/lib/Makefile.am"
|
||||
"mux/lib/Makefile.am"
|
||||
"mux/muxescape/Makefile.am"
|
||||
|
||||
"" "" "" "" "" ""
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ all: test_harness test_trigger_bin
|
|||
# Ragel .rl -> .c
|
||||
color_ops.c: $(COLOR_OPS_RL) ../mux/include/color_ops.h ../mux/include/unicode_tables_c.h
|
||||
$(RAGEL) $(RFLAGS) -o $@ $<
|
||||
sed '/^#line /d' $@ > $@.tmp && mv -f $@.tmp $@
|
||||
|
||||
trigger_match.c: trigger_match.rl
|
||||
$(RAGEL) $(RFLAGS) -o $@ $<
|
||||
sed '/^#line /d' $@ > $@.tmp && mv -f $@.tmp $@
|
||||
|
||||
test_harness: $(COLOR_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(COLOR_OBJS)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "trigger_match.rl"
|
||||
/*
|
||||
* trigger_match.rl — Multi-pattern trigger matching engine.
|
||||
*
|
||||
|
|
@ -48,13 +47,11 @@ typedef struct {
|
|||
/* ------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#line 49 "trigger_match.c"
|
||||
static const int trigger_parse_start = 1;
|
||||
|
||||
static const int trigger_parse_en_main = 1;
|
||||
|
||||
|
||||
#line 137 "trigger_match.rl"
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -77,22 +74,18 @@ static int trigger_parse_pattern(const char *pattern, size_t plen,
|
|||
*is_regex = 0;
|
||||
|
||||
|
||||
#line 74 "trigger_match.c"
|
||||
{
|
||||
cs = trigger_parse_start;
|
||||
}
|
||||
|
||||
#line 159 "trigger_match.rl"
|
||||
(void)trigger_parse_en_main; /* Suppress unused-variable warning. */
|
||||
|
||||
#line 78 "trigger_match.c"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr0:
|
||||
#line 103 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs < max_segs) {
|
||||
segs[nsegs].type = SEG_LITERAL;
|
||||
|
|
@ -102,7 +95,6 @@ tr0:
|
|||
}
|
||||
goto st1;
|
||||
tr1:
|
||||
#line 52 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs < max_segs) {
|
||||
segs[nsegs].type = SEG_LITERAL;
|
||||
|
|
@ -112,7 +104,6 @@ tr1:
|
|||
}
|
||||
goto st1;
|
||||
tr2:
|
||||
#line 97 "trigger_match.rl"
|
||||
{
|
||||
/* $ at end of pattern = EOL anchor; elsewhere = regex. */
|
||||
eol_pending = 1;
|
||||
|
|
@ -120,13 +111,11 @@ tr2:
|
|||
}
|
||||
goto st1;
|
||||
tr3:
|
||||
#line 111 "trigger_match.rl"
|
||||
{
|
||||
*is_regex = 1;
|
||||
}
|
||||
goto st1;
|
||||
tr4:
|
||||
#line 60 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs < max_segs) {
|
||||
/* Collapse consecutive stars. */
|
||||
|
|
@ -139,7 +128,6 @@ tr4:
|
|||
}
|
||||
goto st1;
|
||||
tr5:
|
||||
#line 79 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs < max_segs) {
|
||||
segs[nsegs].type = SEG_QUESTION;
|
||||
|
|
@ -149,7 +137,6 @@ tr5:
|
|||
}
|
||||
goto st1;
|
||||
tr6:
|
||||
#line 71 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs < max_segs) {
|
||||
segs[nsegs].type = SEG_QUESTION;
|
||||
|
|
@ -159,7 +146,6 @@ tr6:
|
|||
}
|
||||
goto st1;
|
||||
tr8:
|
||||
#line 87 "trigger_match.rl"
|
||||
{
|
||||
if (nsegs == 0 && nsegs < max_segs) {
|
||||
segs[nsegs].type = SEG_BOL;
|
||||
|
|
@ -174,7 +160,6 @@ st1:
|
|||
if ( ++p == pe )
|
||||
goto _test_eof1;
|
||||
case 1:
|
||||
#line 158 "trigger_match.c"
|
||||
switch( (*p) ) {
|
||||
case 36u: goto tr2;
|
||||
case 42u: goto tr4;
|
||||
|
|
@ -204,7 +189,6 @@ case 0:
|
|||
_test_eof: {}
|
||||
}
|
||||
|
||||
#line 161 "trigger_match.rl"
|
||||
|
||||
/* If $ was the last character, it's a valid EOL anchor. */
|
||||
if (eol_pending) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ all: $(TOOLS)
|
|||
@if command -v $(RAGEL) >/dev/null 2>&1; then \
|
||||
echo "$(RAGEL) $(RFLAGS) -o $@ $<"; \
|
||||
$(RAGEL) $(RFLAGS) -o $@ $<; \
|
||||
sed '/^#line /d' $@ > $@.tmp && mv -f $@.tmp $@; \
|
||||
else \
|
||||
echo "ragel not found, using checked-in $@"; \
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "reformat.rl"
|
||||
/*
|
||||
* reformat.rl -- Ragel -G2 MUX softcode reformatter
|
||||
*
|
||||
|
|
@ -70,11 +69,9 @@ static void emit_break_now(int d)
|
|||
}
|
||||
|
||||
|
||||
#line 144 "reformat.rl"
|
||||
|
||||
|
||||
|
||||
#line 73 "reformat.c"
|
||||
static const int reformat_start = 1;
|
||||
static const int reformat_first_final = 1;
|
||||
static const int reformat_error = -1;
|
||||
|
|
@ -82,7 +79,6 @@ static const int reformat_error = -1;
|
|||
static const int reformat_en_main = 1;
|
||||
|
||||
|
||||
#line 147 "reformat.rl"
|
||||
|
||||
static void reformat_line(const char *line, size_t len)
|
||||
{
|
||||
|
|
@ -105,7 +101,6 @@ static void reformat_line(const char *line, size_t len)
|
|||
(void)act;
|
||||
|
||||
|
||||
#line 100 "reformat.c"
|
||||
{
|
||||
cs = reformat_start;
|
||||
ts = 0;
|
||||
|
|
@ -113,16 +108,13 @@ static void reformat_line(const char *line, size_t len)
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 169 "reformat.rl"
|
||||
|
||||
#line 106 "reformat.c"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr0:
|
||||
#line 106 "reformat.rl"
|
||||
{{p = ((te))-1;}{
|
||||
if (pdepth == 0 && bdepth == 0 && depth > 0) {
|
||||
depth--;
|
||||
|
|
@ -141,7 +133,6 @@ tr0:
|
|||
}}
|
||||
goto st1;
|
||||
tr1:
|
||||
#line 77 "reformat.rl"
|
||||
{te = p+1;{
|
||||
if (pdepth == 0 && bdepth == 0 && depth > 0) {
|
||||
depth--;
|
||||
|
|
@ -161,19 +152,15 @@ tr1:
|
|||
}}
|
||||
goto st1;
|
||||
tr2:
|
||||
#line 141 "reformat.rl"
|
||||
{te = p+1;{ emit_pending(); putchar(*ts); }}
|
||||
goto st1;
|
||||
tr3:
|
||||
#line 133 "reformat.rl"
|
||||
{te = p+1;{ emit_pending(); pdepth++; putchar('('); }}
|
||||
goto st1;
|
||||
tr4:
|
||||
#line 134 "reformat.rl"
|
||||
{te = p+1;{ emit_pending(); if (pdepth > 0) pdepth--; putchar(')'); }}
|
||||
goto st1;
|
||||
tr5:
|
||||
#line 124 "reformat.rl"
|
||||
{te = p+1;{
|
||||
emit_pending();
|
||||
putchar(';');
|
||||
|
|
@ -183,15 +170,12 @@ tr5:
|
|||
}}
|
||||
goto st1;
|
||||
tr6:
|
||||
#line 137 "reformat.rl"
|
||||
{te = p+1;{ emit_pending(); bdepth++; putchar('['); }}
|
||||
goto st1;
|
||||
tr7:
|
||||
#line 138 "reformat.rl"
|
||||
{te = p+1;{ emit_pending(); if (bdepth > 0) bdepth--; putchar(']'); }}
|
||||
goto st1;
|
||||
tr8:
|
||||
#line 96 "reformat.rl"
|
||||
{te = p+1;{
|
||||
emit_pending();
|
||||
putchar('{');
|
||||
|
|
@ -202,7 +186,6 @@ tr8:
|
|||
}}
|
||||
goto st1;
|
||||
tr10:
|
||||
#line 106 "reformat.rl"
|
||||
{te = p;p--;{
|
||||
if (pdepth == 0 && bdepth == 0 && depth > 0) {
|
||||
depth--;
|
||||
|
|
@ -221,14 +204,11 @@ tr10:
|
|||
}}
|
||||
goto st1;
|
||||
st1:
|
||||
#line 1 "NONE"
|
||||
{ts = 0;}
|
||||
if ( ++p == pe )
|
||||
goto _test_eof1;
|
||||
case 1:
|
||||
#line 1 "NONE"
|
||||
{ts = p;}
|
||||
#line 206 "reformat.c"
|
||||
switch( (*p) ) {
|
||||
case 40: goto tr3;
|
||||
case 41: goto tr4;
|
||||
|
|
@ -240,14 +220,12 @@ case 1:
|
|||
}
|
||||
goto tr2;
|
||||
tr9:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st2;
|
||||
st2:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof2;
|
||||
case 2:
|
||||
#line 223 "reformat.c"
|
||||
if ( (*p) == 44 )
|
||||
goto st0;
|
||||
goto tr10;
|
||||
|
|
@ -274,7 +252,6 @@ case 0:
|
|||
|
||||
}
|
||||
|
||||
#line 170 "reformat.rl"
|
||||
|
||||
/* Discard any trailing pending break (e.g., line ends with ;). */
|
||||
pending_break = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "unformat.rl"
|
||||
/*
|
||||
* unformat.rl -- Ragel -G2 replacement for unformat.pl
|
||||
*
|
||||
|
|
@ -153,11 +152,9 @@ static void join_check(char first_char)
|
|||
*/
|
||||
|
||||
|
||||
#line 295 "unformat.rl"
|
||||
|
||||
|
||||
|
||||
#line 156 "unformat.c"
|
||||
static const int unformat_start = 16;
|
||||
static const int unformat_first_final = 16;
|
||||
static const int unformat_error = -1;
|
||||
|
|
@ -165,7 +162,6 @@ static const int unformat_error = -1;
|
|||
static const int unformat_en_main = 16;
|
||||
|
||||
|
||||
#line 298 "unformat.rl"
|
||||
|
||||
/*
|
||||
* Emit a captured line segment. Detects trailing ' \' and handles
|
||||
|
|
@ -212,21 +208,17 @@ static void process_buffer(const char *buf, size_t len)
|
|||
(void)unformat_error;
|
||||
|
||||
|
||||
#line 207 "unformat.c"
|
||||
{
|
||||
cs = unformat_start;
|
||||
}
|
||||
|
||||
#line 344 "unformat.rl"
|
||||
|
||||
#line 210 "unformat.c"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr1:
|
||||
#line 254 "unformat.rl"
|
||||
{
|
||||
flush_command();
|
||||
in_command = 1;
|
||||
|
|
@ -235,38 +227,29 @@ tr1:
|
|||
cmd_start_file = current_file;
|
||||
emit_segment(mark, (size_t)(p - mark), 0);
|
||||
}
|
||||
#line 156 "unformat.rl"
|
||||
{ line_number++; }
|
||||
goto st16;
|
||||
tr4:
|
||||
#line 156 "unformat.rl"
|
||||
{ line_number++; }
|
||||
goto st16;
|
||||
tr6:
|
||||
#line 262 "unformat.rl"
|
||||
{
|
||||
emit_segment(mark, (size_t)(p - mark), 1);
|
||||
}
|
||||
#line 156 "unformat.rl"
|
||||
{ line_number++; }
|
||||
goto st16;
|
||||
tr19:
|
||||
#line 158 "unformat.rl"
|
||||
{ do_include(inc_start, p); }
|
||||
#line 156 "unformat.rl"
|
||||
{ line_number++; }
|
||||
goto st16;
|
||||
tr20:
|
||||
#line 171 "unformat.rl"
|
||||
{ flush_command_ex(1); }
|
||||
#line 156 "unformat.rl"
|
||||
{ line_number++; }
|
||||
goto st16;
|
||||
st16:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof16;
|
||||
case 16:
|
||||
#line 247 "unformat.c"
|
||||
switch( (*p) ) {
|
||||
case 9: goto st1;
|
||||
case 10: goto tr4;
|
||||
|
|
@ -276,14 +259,12 @@ case 16:
|
|||
}
|
||||
goto tr21;
|
||||
tr21:
|
||||
#line 253 "unformat.rl"
|
||||
{ mark = p; }
|
||||
goto st0;
|
||||
st0:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof0;
|
||||
case 0:
|
||||
#line 262 "unformat.c"
|
||||
if ( (*p) == 10 )
|
||||
goto tr1;
|
||||
goto st0;
|
||||
|
|
@ -298,14 +279,12 @@ case 1:
|
|||
}
|
||||
goto tr2;
|
||||
tr2:
|
||||
#line 253 "unformat.rl"
|
||||
{ mark = p; }
|
||||
goto st2;
|
||||
st2:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof2;
|
||||
case 2:
|
||||
#line 282 "unformat.c"
|
||||
if ( (*p) == 10 )
|
||||
goto tr6;
|
||||
goto st2;
|
||||
|
|
@ -400,26 +379,22 @@ case 12:
|
|||
}
|
||||
goto tr16;
|
||||
tr16:
|
||||
#line 157 "unformat.rl"
|
||||
{ inc_start = p; }
|
||||
goto st13;
|
||||
st13:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof13;
|
||||
case 13:
|
||||
#line 382 "unformat.c"
|
||||
if ( (*p) == 10 )
|
||||
goto tr19;
|
||||
goto st13;
|
||||
tr17:
|
||||
#line 157 "unformat.rl"
|
||||
{ inc_start = p; }
|
||||
goto st14;
|
||||
st14:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof14;
|
||||
case 14:
|
||||
#line 392 "unformat.c"
|
||||
switch( (*p) ) {
|
||||
case 9: goto tr17;
|
||||
case 10: goto tr19;
|
||||
|
|
@ -427,14 +402,12 @@ case 14:
|
|||
}
|
||||
goto tr16;
|
||||
tr23:
|
||||
#line 253 "unformat.rl"
|
||||
{ mark = p; }
|
||||
goto st15;
|
||||
st15:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof15;
|
||||
case 15:
|
||||
#line 405 "unformat.c"
|
||||
if ( (*p) == 10 )
|
||||
goto tr20;
|
||||
goto st0;
|
||||
|
|
@ -460,7 +433,6 @@ case 15:
|
|||
_test_eof: {}
|
||||
}
|
||||
|
||||
#line 345 "unformat.rl"
|
||||
|
||||
if (cs < 16) {
|
||||
fprintf(stderr, "%s:%d: parse error at offset %ld\n",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ ansify: ansify.c
|
|||
regen: ansify.rl
|
||||
chmod u+w ansify.c 2>/dev/null || true
|
||||
$(RAGEL) $(RFLAGS) -o ansify.c ansify.rl
|
||||
sed '/^#line /d' ansify.c > ansify.c.tmp && mv -f ansify.c.tmp ansify.c
|
||||
chmod a-w ansify.c 2>/dev/null || true
|
||||
|
||||
clean:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#line 1 "ansify.rl"
|
||||
/*! \file ansify.rl
|
||||
* \brief Convert TinyMUX percent-color substitutions to ANSI escapes.
|
||||
*
|
||||
|
|
@ -199,11 +198,9 @@ static int try_emit_extended(const unsigned char *body, const unsigned char *bod
|
|||
}
|
||||
|
||||
|
||||
#line 246 "ansify.rl"
|
||||
|
||||
|
||||
|
||||
#line 207 "ansify.c"
|
||||
static const int ansify_start = 2;
|
||||
static const int ansify_first_final = 2;
|
||||
static const int ansify_error = -1;
|
||||
|
|
@ -211,7 +208,6 @@ static const int ansify_error = -1;
|
|||
static const int ansify_en_main = 2;
|
||||
|
||||
|
||||
#line 249 "ansify.rl"
|
||||
|
||||
static void process_buffer(const unsigned char *data, size_t len)
|
||||
{
|
||||
|
|
@ -234,7 +230,6 @@ static void process_buffer(const unsigned char *data, size_t len)
|
|||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
|
||||
#line 238 "ansify.c"
|
||||
{
|
||||
cs = ansify_start;
|
||||
ts = 0;
|
||||
|
|
@ -242,22 +237,18 @@ static void process_buffer(const unsigned char *data, size_t len)
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 271 "ansify.rl"
|
||||
|
||||
#line 248 "ansify.c"
|
||||
{
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
switch ( cs )
|
||||
{
|
||||
tr0:
|
||||
#line 229 "ansify.rl"
|
||||
{{p = ((te))-1;}{
|
||||
emit_bytes(ts, te);
|
||||
}}
|
||||
goto st2;
|
||||
tr2:
|
||||
#line 210 "ansify.rl"
|
||||
{te = p+1;{
|
||||
/* Match is three bytes: % x|c letter */
|
||||
const char *esc = letter_escape((int)ts[2]);
|
||||
|
|
@ -268,7 +259,6 @@ tr2:
|
|||
}}
|
||||
goto st2;
|
||||
tr3:
|
||||
#line 219 "ansify.rl"
|
||||
{te = p+1;{
|
||||
/* % x|c < body > body is ts+3 .. te-1 */
|
||||
if (te - ts >= 4
|
||||
|
|
@ -280,44 +270,36 @@ tr3:
|
|||
}}
|
||||
goto st2;
|
||||
tr4:
|
||||
#line 229 "ansify.rl"
|
||||
{te = p+1;{
|
||||
emit_bytes(ts, te);
|
||||
}}
|
||||
goto st2;
|
||||
tr6:
|
||||
#line 229 "ansify.rl"
|
||||
{te = p;p--;{
|
||||
emit_bytes(ts, te);
|
||||
}}
|
||||
goto st2;
|
||||
tr7:
|
||||
#line 206 "ansify.rl"
|
||||
{te = p+1;{
|
||||
putchar('%');
|
||||
}}
|
||||
goto st2;
|
||||
st2:
|
||||
#line 1 "NONE"
|
||||
{ts = 0;}
|
||||
if ( ++p == pe )
|
||||
goto _test_eof2;
|
||||
case 2:
|
||||
#line 1 "NONE"
|
||||
{ts = p;}
|
||||
#line 309 "ansify.c"
|
||||
if ( (*p) == 37u )
|
||||
goto tr5;
|
||||
goto tr4;
|
||||
tr5:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
goto st3;
|
||||
st3:
|
||||
if ( ++p == pe )
|
||||
goto _test_eof3;
|
||||
case 3:
|
||||
#line 321 "ansify.c"
|
||||
switch( (*p) ) {
|
||||
case 37u: goto tr7;
|
||||
case 67u: goto st0;
|
||||
|
|
@ -383,7 +365,6 @@ case 1:
|
|||
|
||||
}
|
||||
|
||||
#line 272 "ansify.rl"
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue