scripts/kconfig/lexer.l
Source file repositories/reference/linux-study-clean/scripts/kconfig/lexer.l
File Facts
- System
- Linux kernel
- Corpus path
scripts/kconfig/lexer.l- Extension
.l- Size
- 9177 bytes
- Lines
- 462
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: scripts
- 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
assert.hlimits.hstdio.hstdlib.hstring.hxalloc.hlkc.hpreprocess.hparser.tab.h
Detected Declarations
struct bufferfunction new_stringfunction append_stringfunction alloc_stringfunction warn_ignored_characterfunction yylexfunction inputfunction append_expanded_stringfunction zconf_starthelpfunction zconf_endhelpfunction zconf_initscanfunction zconf_nextfilefunction zconf_endfile
Annotated Snippet
struct buffer {
struct buffer *parent;
YY_BUFFER_STATE state;
int yylineno;
const char *filename;
int source_lineno;
};
static struct buffer *current_buf;
static int last_ts, first_ts;
static char *expand_token(const char *in, size_t n);
static void append_expanded_string(const char *in);
static void zconf_endhelp(void);
static void zconf_endfile(void);
static void new_string(void)
{
text = xmalloc(START_STRSIZE);
text_asize = START_STRSIZE;
text_size = 0;
*text = 0;
}
static void append_string(const char *str, int size)
{
int new_size = text_size + size + 1;
if (new_size > text_asize) {
new_size += START_STRSIZE - 1;
new_size &= -START_STRSIZE;
text = xrealloc(text, new_size);
text_asize = new_size;
}
memcpy(text + text_size, str, size);
text_size += size;
text[text_size] = 0;
}
static void alloc_string(const char *str, int size)
{
text = xmalloc(size + 1);
memcpy(text, str, size);
text[size] = 0;
}
static void warn_ignored_character(char chr)
{
fprintf(stderr,
"%s:%d:warning: ignoring unsupported character '%c'\n",
cur_filename, yylineno, chr);
}
%}
n [A-Za-z0-9_-]
%%
char open_quote = 0;
#.* /* ignore comment */
[ \t]* /* whitespaces */
\\\n /* escaped new line */
\n return T_EOL;
"bool" return T_BOOL;
"choice" return T_CHOICE;
"comment" return T_COMMENT;
"config" return T_CONFIG;
"def_bool" return T_DEF_BOOL;
"def_tristate" return T_DEF_TRISTATE;
"default" return T_DEFAULT;
Annotation
- Immediate include surface: `assert.h`, `limits.h`, `stdio.h`, `stdlib.h`, `string.h`, `xalloc.h`, `lkc.h`, `preprocess.h`.
- Detected declarations: `struct buffer`, `function new_string`, `function append_string`, `function alloc_string`, `function warn_ignored_character`, `function yylex`, `function input`, `function append_expanded_string`, `function zconf_starthelp`, `function zconf_endhelp`.
- Atlas domain: Support Tooling And Documentation / scripts.
- 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.