A bit better method of setting foreground vs. background.
This commit is contained in:
parent
2d550978b8
commit
6ca4614fcb
2 changed files with 15 additions and 15 deletions
|
@ -63,10 +63,10 @@ static const char _foo_trans_targs[] = {
|
||||||
|
|
||||||
static const char _foo_trans_actions[] = {
|
static const char _foo_trans_actions[] = {
|
||||||
0, 7, 0, 0, 9, 9, 0, 0,
|
0, 7, 0, 0, 9, 9, 0, 0,
|
||||||
0, 0, 0, 0, 5, 0, 0, 0,
|
0, 0, 0, 0, 3, 0, 0, 0,
|
||||||
1, 0, 13, 0, 0, 1, 0, 16,
|
1, 0, 13, 0, 0, 1, 0, 16,
|
||||||
0, 0, 1, 0, 22, 0, 0, 0,
|
0, 0, 1, 0, 22, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 3, 0,
|
0, 0, 0, 0, 0, 0, 5, 0,
|
||||||
0, 7, 11, 19, 0
|
0, 7, 11, 19, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ static const int foo_en_main = 18;
|
||||||
bool parse_ansi(std::string_view codes) {
|
bool parse_ansi(std::string_view codes) {
|
||||||
const char *start = NULL;
|
const char *start = NULL;
|
||||||
int cs = 0;
|
int cs = 0;
|
||||||
uint8_t value = 0;
|
unsigned int value = 0;
|
||||||
const char *p = codes.data();
|
const char *p = codes.data();
|
||||||
const char *pe = p + codes.size();
|
const char *pe = p + codes.size();
|
||||||
const char *eof = pe;
|
const char *eof = pe;
|
||||||
bool fgcolor = false;
|
bool is_fg = false;
|
||||||
sf::Color color;
|
sf::Color color;
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,11 +198,11 @@ _match:
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
#line 26 ".\\ansi_parser.rl"
|
#line 26 ".\\ansi_parser.rl"
|
||||||
{ fgcolor = false; }
|
{ is_fg = true; }
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#line 27 ".\\ansi_parser.rl"
|
#line 27 ".\\ansi_parser.rl"
|
||||||
{ fgcolor = true; }
|
{ is_fg = false; }
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
#line 29 ".\\ansi_parser.rl"
|
#line 29 ".\\ansi_parser.rl"
|
||||||
|
@ -229,7 +229,7 @@ _match:
|
||||||
case 10:
|
case 10:
|
||||||
#line 39 ".\\ansi_parser.rl"
|
#line 39 ".\\ansi_parser.rl"
|
||||||
{
|
{
|
||||||
println("fg? {}, sf:Color: {},{},{},{}", fgcolor, color.r, color.g, color.b, color.a);
|
println("fg? {}, sf:Color: {},{},{},{}", is_fg, color.r, color.g, color.b, color.a);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#line 211 ".\\ansi_parser.cpp"
|
#line 211 ".\\ansi_parser.cpp"
|
||||||
|
@ -251,7 +251,7 @@ _again:
|
||||||
case 10:
|
case 10:
|
||||||
#line 39 ".\\ansi_parser.rl"
|
#line 39 ".\\ansi_parser.rl"
|
||||||
{
|
{
|
||||||
println("fg? {}, sf:Color: {},{},{},{}", fgcolor, color.r, color.g, color.b, color.a);
|
println("fg? {}, sf:Color: {},{},{},{}", is_fg, color.r, color.g, color.b, color.a);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#line 231 ".\\ansi_parser.cpp"
|
#line 231 ".\\ansi_parser.cpp"
|
||||||
|
|
|
@ -23,8 +23,8 @@ using namespace fmt;
|
||||||
println("color24b");
|
println("color24b");
|
||||||
}
|
}
|
||||||
|
|
||||||
action bg { fgcolor = false; }
|
action is_fg { is_fg = true; }
|
||||||
action fg { fgcolor = true; }
|
action is_bg { is_fg = false; }
|
||||||
|
|
||||||
action any {
|
action any {
|
||||||
println("ANY: {}:{}", int(fc), fc);
|
println("ANY: {}:{}", int(fc), fc);
|
||||||
|
@ -37,12 +37,12 @@ using namespace fmt;
|
||||||
action start { value = 0; }
|
action start { value = 0; }
|
||||||
|
|
||||||
action end {
|
action end {
|
||||||
println("fg? {}, sf:Color: {},{},{},{}", fgcolor, color.r, color.g, color.b, color.a);
|
println("fg? {}, sf:Color: {},{},{},{}", is_fg, color.r, color.g, color.b, color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
start = 0x1B "[";
|
start = 0x1B "[";
|
||||||
fg = "38;" %fg;
|
fg = "38;" %is_fg;
|
||||||
bg = "48;" %bg;
|
bg = "48;" %is_bg;
|
||||||
reset = ("39" | "49");
|
reset = ("39" | "49");
|
||||||
num = digit+ >tstart %number;
|
num = digit+ >tstart %number;
|
||||||
color256 = "5;";
|
color256 = "5;";
|
||||||
|
@ -66,11 +66,11 @@ using namespace fmt;
|
||||||
bool parse_ansi(std::string_view codes) {
|
bool parse_ansi(std::string_view codes) {
|
||||||
const char *start = NULL;
|
const char *start = NULL;
|
||||||
int cs = 0;
|
int cs = 0;
|
||||||
uint8_t value = 0;
|
unsigned int value = 0;
|
||||||
const char *p = codes.data();
|
const char *p = codes.data();
|
||||||
const char *pe = p + codes.size();
|
const char *pe = p + codes.size();
|
||||||
const char *eof = pe;
|
const char *eof = pe;
|
||||||
bool fgcolor = false;
|
bool is_fg = false;
|
||||||
sf::Color color;
|
sf::Color color;
|
||||||
|
|
||||||
%% write init;
|
%% write init;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue