ffi 2.7 green: parser accepts all seven type-introducer directive forms
Six new lexer tokens (`hash_jni_interface`, `hash_objc_class`, `hash_objc_protocol`, `hash_swift_class`, `hash_swift_struct`, `hash_swift_protocol`) join the existing `hash_jni_class`. All seven share the body grammar from Phases 2.1–2.6. AST refactored: `JniClassDecl` → `ForeignClassDecl` with a `runtime: ForeignRuntime` enum discriminator; `JniMethodDecl` → `ForeignMethodDecl` (with `jni_descriptor_override` renamed for clarity since it's JNI-only); `JniFieldDecl` → `ForeignFieldDecl`; `JniClassMember` → `ForeignClassMember`. AST variant renamed `jni_class_decl` → `foreign_class_decl`. `parseForeignClassDecl` takes the runtime as a parameter; the `parseConstBinding` dispatch table now maps each of the seven directive tokens to its `ForeignRuntime` variant via `foreignRuntimeForCurrent`. No codegen yet — Phase 3 picks up Obj-C runtime, Phase 4 picks up Swift. Runtime-specific body items (fields, descriptor override) are validated at sema time in later steps. 126/126 examples green.
This commit is contained in:
@@ -116,8 +116,14 @@ pub const Tag = enum {
|
||||
hash_jni_call, // #jni_call(T)(env, target, "name", "(Sig)R", args...)
|
||||
hash_jni_static_call, // #jni_static_call(T)(class, "name", "(Sig)R", args...)
|
||||
hash_jni_class, // Foo :: #jni_class("java/path/Foo") { ...body... }
|
||||
hash_extends, // `#extends Alias;` inside a #jni_class / #objc_class body
|
||||
hash_implements, // `#implements Alias;` inside a #jni_class / #objc_class body
|
||||
hash_jni_interface, // Foo :: #jni_interface("java/path/IFoo") { ...body... }
|
||||
hash_objc_class, // Foo :: #objc_class("ObjcName") { ...body... }
|
||||
hash_objc_protocol, // Foo :: #objc_protocol("ObjcProto") { ...body... }
|
||||
hash_swift_class, // Foo :: #swift_class("Module.Type") { ...body... }
|
||||
hash_swift_struct, // Foo :: #swift_struct("Module.Type") { ...body... }
|
||||
hash_swift_protocol, // Foo :: #swift_protocol("Module.Proto") { ...body... }
|
||||
hash_extends, // `#extends Alias;` inside a foreign-class body
|
||||
hash_implements, // `#implements Alias;` inside a foreign-class body
|
||||
hash_jni_method_descriptor, // `#jni_method_descriptor("(Sig)Ret")` per-method JNI descriptor override
|
||||
triple_minus, // ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user