1 // A Lark grammar for the XDR specification la 2 // https://tools.ietf.org/html/rfc4506 Section 3 4 declaration : "opaque" identifier 5 | "opaque" identifier 6 | "string" identifier 7 | type_specifier ident 8 | type_specifier ident 9 | type_specifier "*" i 10 | type_specifier ident 11 | "void" 12 13 value : decimal_constant 14 | hexadecimal_constant 15 | octal_constant 16 | identifier 17 18 constant : decimal_constant | h 19 20 type_specifier : unsigned_hyper 21 | unsigned_long 22 | unsigned_int 23 | hyper 24 | long 25 | int 26 | float 27 | double 28 | quadruple 29 | bool 30 | enum_type_spec 31 | struct_type_spec 32 | union_type_spec 33 | identifier 34 35 unsigned_hyper : "unsigned" "hyper" 36 unsigned_long : "unsigned" "long" 37 unsigned_int : "unsigned" "int" 38 hyper : "hyper" 39 long : "long" 40 int : "int" 41 float : "float" 42 double : "double" 43 quadruple : "quadruple" 44 bool : "bool" 45 46 enum_type_spec : "enum" enum_body 47 48 enum_body : "{" ( identifier "=" 49 50 struct_type_spec : "struct" struct_body 51 52 struct_body : "{" ( declaration "; 53 54 union_type_spec : "union" union_body 55 56 union_body : switch_spec "{" case 57 58 switch_spec : "switch" "(" declara 59 60 case_spec : ( "case" value ":" ) 61 62 default_spec : "default" ":" declar 63 64 constant_def : "const" identifier " 65 66 type_def : "typedef" declaratio 67 | "enum" identifier en 68 | "struct" identifier 69 | "union" identifier u 70 71 specification : definition* 72 73 definition : constant_def 74 | type_def 75 | program_def 76 | pragma_def 77 78 // 79 // RPC program definitions not specified in RF 80 // 81 82 program_def : "program" identifier 83 84 version_def : "version" identifier 85 86 procedure_def : type_specifier ident 87 88 pragma_def : "pragma" directive i 89 90 directive : exclude_directive 91 | header_directive 92 | pages_directive 93 | public_directive 94 | skip_directive 95 96 exclude_directive : "exclude" 97 header_directive : "header" 98 pages_directive : "pages" 99 public_directive : "public" 100 skip_directive : "skip" 101 102 // 103 // XDR language primitives 104 // 105 106 identifier : /([a-z]|[A-Z])(_|[a- 107 108 decimal_constant : /[\+-]?(0|[1-9][0-9] 109 hexadecimal_constant : /0x([a-f]|[A-F]|[0-9 110 octal_constant : /0[0-7]+/ 111 112 PASSTHRU : "%" | "%" /.+/ 113 %ignore PASSTHRU 114 115 %import common.C_COMMENT 116 %ignore C_COMMENT 117 118 %import common.WS 119 %ignore WS
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.