===
objcclass
===

type

NSView = objcclass external (NSResponder)
private
  _subview  : id;
public
  function initWithFrame(rect : NSRect): id; message 'initWithFrame:';
  procedure addSubview(aview: NSView); message 'addSubview:';
  procedure setAutoresizingMask(mask: NSUInteger); message 'setAutoresizingMask:';
  procedure setAutoresizesSubviews(flag: LongBool); message 'setAutoresizesSubviews:';
  procedure drawRect(dirtyRect: NSRect); message 'drawRect:';
end;

MyView = objcclass(MSView)
public
  data : Integer;
  procedure customMessage(dirtyRect: NSRect); message 'customMessage';
  procedure drawRect(dirtyRect: NSRect); override;
end;

---

(root
  (declTypes (kType)
    (declType (identifier) (kEq)
      (declClass (kObjcclass) (kExternal) (typeref (identifier))
        (declSection (kPrivate)
          (declField (identifier) (type (typeref (identifier)))))
        (declSection (kPublic)
          (declProc (kFunction) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (typeref (identifier))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString))))
        (kEnd)))
    (declType (identifier) (kEq)
      (declClass (kObjcclass)
        (typeref (identifier))
        (declSection (kPublic)
          (declField (identifier) (type (typeref (identifier))))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kOverride))))
        (kEnd)))))

===
objcprotocol
===

type
  MyProtocol = objcprotocol
    procedure aRequiredMethod; message 'aRequiredMethod';
  optional
    procedure anOptionalMethodWithPara(para: longint); message 'anOptionalMethodWithPara:';
    procedure anotherOptionalMethod; message 'anotherOptionalMethod';
  required
    function aSecondRequiredMethod: longint; message 'aSecondRequiredMethod';
  end;

  MyClassImplementingProtocol = objcclass(NSObject,MyProtocol)
    procedure aRequiredMethod;
    procedure anOptionalMethodWithPara(para: longint);
    function aSecondRequiredMethod: longint;
  end;

---

(root
  (declTypes (kType)
    (declType (identifier) (kEq)
      (declClass (kObjcprotocol)
        (declProc (kProcedure) (identifier) (procAttribute (kMessage) (literalString)))
        (declSection (kOptional)
          (declProc (kProcedure) (identifier)
            (declArgs
              (declArg (identifier) (type (typeref (identifier)))))
            (procAttribute (kMessage) (literalString)))
          (declProc (kProcedure) (identifier)
            (procAttribute (kMessage) (literalString))))
        (declSection (kRequired)
          (declProc (kFunction) (identifier) (typeref (identifier))
            (procAttribute (kMessage) (literalString))))
        (kEnd)))
    (declType (identifier) (kEq)
      (declClass (kObjcclass)
        (typeref (identifier))
        (typeref (identifier))
        (declProc (kProcedure) (identifier))
        (declProc (kProcedure) (identifier)
          (declArgs
            (declArg (identifier) (type (typeref (identifier))))))
        (declProc (kFunction) (identifier) (typeref (identifier)))
        (kEnd)))))


===
objccategory
===

type
  MyCategory = objccategory(NSObject,MyProtocol)
   function hash: cuint; reintroduce;
   procedure protocolmethod;
   class procedure newmethod; message 'newmethod';
  end;

---

(root
  (declTypes (kType)
    (declType (identifier) (kEq)
      (declClass (kObjccategory)
        (typeref (identifier))
        (typeref (identifier))
        (declProc (kFunction) (identifier) (typeref (identifier))
          (procAttribute (kReintroduce)))
        (declProc (kProcedure) (identifier))
        (declProc (kClass) (kProcedure) (identifier)
          (procAttribute (kMessage) (literalString)))
        (kEnd)))))

