Feat: add mutable pointer type *mut T and *mut opaque
- Grammar: update pointer_type to support optional mut keyword; LL(1) verified (56 named rules, no conflicts) - AST: update Type enum with mutable: bool field for Pointer and OpaquePointer variants - Parser: consume optional mut token in parse_type; update all existing pointer tests; add 4 new mut pointer tests (85 pass) - VSCode extension: add *mut capture-group pattern for syntax highlighting; update SYNTAX.md with pointer mutability table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,10 +76,10 @@ pub enum Type {
|
||||
Char,
|
||||
// User-defined named type (e.g. a struct)
|
||||
Named(String, Span),
|
||||
// Typed pointer: `*type`
|
||||
Pointer(Box<Type>),
|
||||
// Opaque (untyped) pointer: `*opaque`
|
||||
OpaquePointer,
|
||||
// Typed pointer: `*type` (immutable) or `*mut type` (mutable)
|
||||
Pointer { mutable: bool, pointee: Box<Type> },
|
||||
// Opaque (untyped) pointer: `*opaque` (immutable) or `*mut opaque` (mutable)
|
||||
OpaquePointer { mutable: bool },
|
||||
// Fixed-size array: `[type; INT_LIT]`
|
||||
Array { elem: Box<Type>, size: String },
|
||||
// Error placeholder for recovery
|
||||
|
||||
Reference in New Issue
Block a user