Coder Social home page Coder Social logo

taroyuyu / oc2mango Goto Github PK

View Code? Open in Web Editor NEW

This project forked from silverfruity/oc2mango

0.0 0.0 0.0 2.51 MB

convert Objective-C to mango script:https://github.com/YPLiang19/Mango

License: MIT License

Objective-C 63.22% Lex 2.74% Yacc 11.44% Swift 21.49% Ruby 0.41% Python 0.71%

oc2mango's Introduction

项目介绍

1. oc2mango

​ 将Objective-C转换为MangoFix脚本.

  • 输入Objective-C源码文件夹,通过oc2mangoLib转换为AST,再将AST转换为mongo script.

使用示例

# 先在releases中下载最新的oc2mango.zip
# 解压文件夹
unzip ~/Downloads/oc2mango.zip -d ~/Downloads/
# 执行oc2mango
~/Downloads/oc2mango input_dir[包含Objective-C .h .m的文件夹] output_dir[.mg的输出文件夹]
# 例如: ~/Downloads/oc2mango ~/Desktop/InputOCFilesDir ~/Desktop/OuputMongoFilesDir

2. PatchGenerator

​ 将Objective-C转换为OCRunner热更新补丁.

  • 输入Objective-C文件集合或者文件夹,通过oc2mangoLib转换为AST,再使用ORPatchFile,将AST序列化为可被OCRunner执行的二进制补丁或JSON补丁,.

使用示例

  • -files: Objective-C源文件列表或者文件夹
  • -refs: 外部引用的文件列表或者是文件夹. 比如:OCRunnerDemo/Scripts.bundle中的UIKit、GCD Refrences. 主要包含一些结构体声明、枚举声明、typedef、系统函数声明.
  • -output: 补丁文件最终保存的路径
# 1: -files: files
PatchGenerator -files ~/OCRunnerDemo/ViewController1 ~/OCRunnerDemo/ViewController2 ~/OCRunnerDemo/ViewController3 -refs  ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch

PatchGenerator -files ~/OCRunnerDemo/ViewController1 -refs  ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch

# 2: -files: dir
PatchGenerator -files ~/OCRunnerDemo/ViewController1/ -refs ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch

3. oc2mangoLib

  • 将Objective-C源码,通过flex&bsion转换为语法树

4. ORPatchFile

  • oc2mango、oc2mangoLib、OCRunner、PatchGenerator的基础库.
  • 包含了所有的语法节点类,以及补丁文件的序列化与反序列化. (RunnerClasses、ORPatchFile).
  • 包含两种补丁:二进制补丁和JSON形式的补丁.
  • 其中二进制补丁,反序列化速度和文件大小皆是最优秀.

5. BinaryPatchCodeGenerator

  • 输入RunnerClasses.h文件,然后生成BinaryPatchHelper.h,BinaryPatchHelper.m两个文件.

不支持

  1. 预编译相关
  2. 编译器内置函数以及属性__attribute__等
  3. a[x], {x,y,z}, a->x
  4. id a = ( identifier )object; 类型转换. 但支持id a = (identifier *)object;

除以上列表,其余语法皆已支持。有问题,欢迎提交issue。

oc2mango's People

Contributors

silverfruity avatar weijwwww 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.