tools/net/sunrpc/xdrgen/grammars/xdr.lark

Source file repositories/reference/linux-study-clean/tools/net/sunrpc/xdrgen/grammars/xdr.lark

File Facts

System
Linux kernel
Corpus path
tools/net/sunrpc/xdrgen/grammars/xdr.lark
Extension
.lark
Size
4497 bytes
Lines
128
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// A Lark grammar for the XDR specification language based on
// https://tools.ietf.org/html/rfc4506 Section 6.3

declaration             : "opaque" identifier "[" value "]"            -> fixed_length_opaque
                        | "opaque" identifier "<" [ value ] ">"        -> variable_length_opaque
                        | "string" identifier "<" [ value ] ">"        -> string
                        | type_specifier identifier "[" value "]"      -> fixed_length_array
                        | type_specifier identifier "<" [ value ] ">"  -> variable_length_array
                        | type_specifier "*" identifier                -> optional_data
                        | type_specifier identifier                    -> basic
                        | "void"                                       -> void

value                   : decimal_constant
                        | hexadecimal_constant
                        | octal_constant
                        | identifier

constant                : decimal_constant | hexadecimal_constant | octal_constant

type_specifier          : unsigned_hyper
                        | unsigned_long
                        | unsigned_int
                        | unsigned_short
                        | hyper
                        | long
                        | int
                        | short
                        | float
                        | double
                        | quadruple
                        | bool
                        | enum_type_spec
                        | struct_type_spec
                        | union_type_spec
                        | identifier

unsigned_hyper          : "unsigned" "hyper"
unsigned_long           : "unsigned" "long"
unsigned_int            : "unsigned" "int"
unsigned_short          : "unsigned" "short"
hyper                   : "hyper"
long                    : "long"
int                     : "int"
short                   : "short"
float                   : "float"
double                  : "double"
quadruple               : "quadruple"
bool                    : "bool"

enum_type_spec          : "enum" enum_body

enum_body               : "{" ( identifier "=" value ) ( "," identifier "=" value )* "}"

struct_type_spec        : "struct" struct_body

struct_body             : "{" ( declaration ";" )+ "}"

union_type_spec         : "union" union_body

union_body              : switch_spec "{" case_spec+ [ default_spec ] "}"

switch_spec             : "switch" "(" declaration ")"

case_spec               : ( "case" value ":" )+ declaration ";"

default_spec            : "default" ":" declaration ";"

constant_def            : "const" identifier "=" value ";"

type_def                : "typedef" declaration ";"                -> typedef

Annotation

Implementation Notes