tools/perf/util/expr.l
Source file repositories/reference/linux-study-clean/tools/perf/util/expr.l
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/expr.l- Extension
.l- Size
- 2862 bytes
- Lines
- 150
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hexpr.hexpr-bison.hmath.h
Detected Declarations
function __valuefunction valuefunction strfunction literalfunction nan_valuefunction expr_wrap
Annotated Snippet
if (*str == '\\') {
*dst++ = *++str;
if (!*str)
break;
}
else if (*str == '?') {
char *paramval;
int i = 0;
int size = asprintf(¶mval, "%d", runtime);
if (size < 0)
*dst++ = '0';
else {
while (i < size)
*dst++ = paramval[i++];
free(paramval);
}
}
else
*dst++ = *str;
str++;
}
*dst = 0x0;
return ret;
}
static int str(yyscan_t scanner, int token, int runtime)
{
YYSTYPE *yylval = expr_get_lval(scanner);
char *text = expr_get_text(scanner);
yylval->str = normalize(strdup(text), runtime);
if (!yylval->str)
return EXPR_ERROR;
yylval->str = normalize(yylval->str, runtime);
return token;
}
static int literal(yyscan_t scanner, const struct expr_scanner_ctx *sctx)
{
YYSTYPE *yylval = expr_get_lval(scanner);
yylval->num = expr__get_literal(expr_get_text(scanner), sctx);
if (isnan(yylval->num)) {
if (!sctx->is_test)
return EXPR_ERROR;
yylval->num = 1;
}
return LITERAL;
}
static int nan_value(yyscan_t scanner)
{
YYSTYPE *yylval = expr_get_lval(scanner);
yylval->num = NAN;
return NUMBER;
}
%}
number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(e-?[0-9]+)?
sch [-,=]
spec \\{sch}
sym [0-9a-zA-Z_\.:@?]+
symbol ({spec}|{sym})+
literal #[0-9a-zA-Z_\.\-]+
Annotation
- Immediate include surface: `linux/compiler.h`, `expr.h`, `expr-bison.h`, `math.h`.
- Detected declarations: `function __value`, `function value`, `function str`, `function literal`, `function nan_value`, `function expr_wrap`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.