Rename match to match_text for lexer user code blocks

This commit is contained in:
josh committed 2026-08-19 23:30:27 -04:00
1 parent 47ad55ee2c
commit d596d47cef
23 files changed
+124 -106

No files matched your search

+13 -13
View File
@@ -21,46 +21,46 @@ token number /-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?/ <<
double n = 0.0;
bool negative = false;
size_t i = 0u;
if (match[i] == '-')
if (match_text[i] == '-')
{
negative = true;
i++;
}
while ('0' <= match[i] && match[i] <= '9')
while ('0' <= match_text[i] && match_text[i] <= '9')
{
n *= 10.0;
n += (match[i] - '0');
n += (match_text[i] - '0');
i++;
}
if (match[i] == '.')
if (match_text[i] == '.')
{
i++;
double mult = 0.1;
while ('0' <= match[i] && match[i] <= '9')
while ('0' <= match_text[i] && match_text[i] <= '9')
{
n += mult * (match[i] - '0');
n += mult * (match_text[i] - '0');
mult /= 10.0;
i++;
}
}
if (match[i] == 'e' || match[i] == 'E')
if (match_text[i] == 'e' || match_text[i] == 'E')
{
bool exp_negative = false;
i++;
if (match[i] == '-')
if (match_text[i] == '-')
{
exp_negative = true;
i++;
}
else if (match[i] == '+')
else if (match_text[i] == '+')
{
i++;
}
long exp = 0.0;
while ('0' <= match[i] && match[i] <= '9')
while ('0' <= match_text[i] && match_text[i] <= '9')
{
exp *= 10;
exp += (match[i] - '0');
exp += (match_text[i] - '0');
i++;
}
if (exp_negative)
@@ -120,11 +120,11 @@ string: /\\t/ <<
>>
string: /\\u[0-9a-fA-F]{4}/ <<
/* Not actually going to encode the code point for this example... */
char s[] = {'{', (char)match[2], (char)match[3], (char)match[4], (char)match[5], '}', 0};
char s[] = {'{', (char)match_text[2], (char)match_text[3], (char)match_text[4], (char)match_text[5], '}', 0};
str_append(&string_value, s);
>>
string: /[^\\]/ <<
char s[] = {(char)match[0], 0};
char s[] = {(char)match_text[0], 0};
str_append(&string_value, s);
>>
Start -> Value <<