Giter VIP home page Giter VIP logo

objc-encodingparser's Introduction

Objective-C Encoding Parser

This library is a simple parser for Objective-C type encoding with a focus on cross-platform.

See parser.h for the provided APIs and run-test.c to learn how this library works in action.

Features

  • Simple and intuitive APIs, ready for use without reading any documents.
  • Zero-dependency and platform-agnostic, tested in macOS, Linux and Windows, easy to integrate with your various analysis facilities.
  • Full support of the type encoding syntax (including struct, union), and able to get the related information of the type (like name, size and alignment).
  • Error tolerance for ill-formed encoding strings, the library parses inputs in its best effort.
  • Built-in dump function to print the human-readable string describing the type.

Building

Make

git clone https://github.com/unixzii/objc-encodingparser.git
cd objc-encodingparser
make

This will generate both the static library libocep.a and a run-test program.

Xcode / Visual Studio

The project (solution) both contains two targets: libocep and RunTest. Once build is succeeded, you can retrieve the products from your IDE's build directory.

Type Node Explained

ocep_type_node_t is the core structure of this library, you parse an encoding string and get the result with that type. It's like an n-ary tree and each node has a parent pointer, a child pointer and a sibling pointer. An example is shown as the below figure:

Example Node

You can use ocep_type_node_traverse function to visit all the children (include itself) of a given node in a DFS-fashion traverse.

Limitations

  • Bit fields are currently not supported (since it's rare in Objective-C code), submit an issue if you see this important.
  • Type size is now calculated in the compact layout (eg. "{?=c^vc}" will get a size of 16 while actually it's 24).

License

This project is licensed under MIT license.

objc-encodingparser's People

Contributors

emingk avatar unixzii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.