-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [WIP] feat: #18 * [WIP] feat: Function Pointer and protocol fix #18 * add Test file * feat: 解析 API_DEPRECATED_WITH_REPLACEMENT * feat: 支持 API_AVAILABLE 声明常量,支持 NS_SWIFT_NAME 解析 * feat: 增加 attribute 的判断 * feat: support declare typedef function. * feat: typedef struct 内容为函数指针的解析,修复 typeSpecifier 对指针的支持 * feat: delete unused token NS_TYPED_ENUM in lexer. * feat: support generic type with super class. * feat: add more token in direct channel. * feat: support dot in DIRECTIVE_CHANNEL * feat: 并行处理多个文件 #21 * feat: parse class without superclass or extension without category name. * feat: parse function definition with macros. * feat: method return type and arg type can be block or function pointer. * feat: specify required node.js version * fix ci * fix: handle empty script * fix condition * fix block and method type converter * feat: add fromPointer in class * fix: delete string in basic auto return type.
- Loading branch information
1 parent
1d4538f
commit 2eaa34b
Showing
18 changed files
with
7,119 additions
and
5,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
let antlr4 = require('antlr4') | ||
let rf = require("fs") | ||
let ObjectiveCLexer = require('../../parser/objc/ObjectiveCLexer').ObjectiveCLexer | ||
let ObjectiveCParser = require('../../parser/objc/ObjectiveCParser').ObjectiveCParser | ||
let DNObjectiveCParserListener = require('./DNObjectiveCParserListener').DNObjectiveCParserListener | ||
let ConsoleErrorListener = require('antlr4/error/ErrorListener').ConsoleErrorListener | ||
const { parentPort, workerData } = require('worker_threads') | ||
|
||
function main(path, cb) { | ||
if (!path) { | ||
if (!workerData) { | ||
return | ||
} | ||
path = workerData.path | ||
} | ||
if (!cb) { | ||
cb = callback | ||
} | ||
console.log('processing: ' + path) | ||
try { | ||
const content = rf.readFileSync(path, "utf-8") | ||
const chars = new antlr4.InputStream(content) | ||
const lexer = new ObjectiveCLexer(chars) | ||
const errorListener = new ConsoleErrorListener() | ||
lexer.addErrorListener(errorListener) | ||
|
||
const tokens = new antlr4.CommonTokenStream(lexer) | ||
const parser = new ObjectiveCParser(tokens) | ||
parser.addErrorListener(errorListener) | ||
const tree = parser.translationUnit() | ||
const listener = new DNObjectiveCParserListener(cb, path) | ||
antlr4.tree.ParseTreeWalker.DEFAULT.walk(listener, tree) | ||
} catch (e) { | ||
cb(null, path, e) | ||
} | ||
} | ||
|
||
function callback(result, path, error) { | ||
// Send a message to the main thread. | ||
parentPort.postMessage({result: result, path: path, error: error}); | ||
} | ||
|
||
main() | ||
|
||
exports.main = main |
Oops, something went wrong.