apex-parser
Advanced tools
Comparing version 2.9.0 to 2.9.1
"use strict"; | ||
// Generated from ApexParser.g4 by ANTLR 4.7.3-SNAPSHOT | ||
// Generated from ApexParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=ApexParserListener.js.map |
"use strict"; | ||
// Generated from ApexParser.g4 by ANTLR 4.7.3-SNAPSHOT | ||
// Generated from ApexParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=ApexParserVisitor.js.map |
@@ -37,3 +37,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -40,0 +40,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "apex-parser", | ||
"version": "2.9.0", | ||
"version": "2.9.1", | ||
"author": "Kevin Jones <nawforce@gmail.com> (https://github.com/nawforce)", | ||
@@ -10,6 +10,8 @@ "bugs": "https://github.com/nawforce/apex-parser/issues", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "npm run antlr4ts && cp ../README.md . && tsc", | ||
"test": "jest --config jestconfig.json lib", | ||
"antlr4ts": "cd antlr && antlr4ts -visitor -o ../src ApexLexer.g4 ApexParser.g4", | ||
"check": "node -e 'require(\"./lib/index.js\").check()'" | ||
"antlr4ts": "npm run antlr-build && npm run antlr-patch ", | ||
"antlr-build": "(cd antlr; antlr4ts -visitor -o ../src ApexLexer.g4 ApexParser.g4)", | ||
"antlr-patch": "sed -i '' -e 's/public void clearCache() {.*}//g' src/ApexParser.ts && sed -i '' -e 's/public void clearCache() {.*}//g' src/ApexLexer.ts", | ||
"check": "node -e require(\"./lib/index.js\").check()'" | ||
}, | ||
@@ -20,16 +22,15 @@ "files": [ | ||
"dependencies": { | ||
"antlr4ts": "^0.5.0-alpha.3", | ||
"antlr4ts": "^0.5.0-alpha.4", | ||
"node-dir": "^0.1.17" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.11.0", | ||
"@typescript-eslint/parser": "^4.11.0", | ||
"eslint": "^7.16.0", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^14.14.16", | ||
"@types/node-dir": "^0.0.33", | ||
"@types/jest": "^26.0.19", | ||
"antlr4ts-cli": "^0.5.0-alpha.3", | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^3.9.7" | ||
"@types/node-dir": "^0.0.34", | ||
"@typescript-eslint/eslint-plugin": "^4.29.0", | ||
"@typescript-eslint/parser": "^4.29.0", | ||
"antlr4ts-cli": "^0.5.0-alpha.4", | ||
"eslint": "^7.32.0", | ||
"jest": "^27.0.6", | ||
"typescript": "^4.3.5" | ||
}, | ||
@@ -36,0 +37,0 @@ "engines": { |
apex-parser | ||
=========== | ||
Parser for Salesforce Apex (including inline SOQL/SOQL). This is based on an ANTLR4 grammar (see antlr/ApexParser.g4) using antlr4ts to generate a parser/lexer in Typescript. | ||
Parser for Salesforce Apex (including Triggers & inline SOQL/SOQL). This is based on an ANTLR4 grammar, see antlr/ApexParser.g4. | ||
This module just contains the Parser & Lexer and provides no further support for analysing the generated parse trees beyond what is provided by antlr4ts. See [pkgforce](https://github.com/nawforce/pkgforce) for example code on how this may be used. | ||
There are two builds of the parser a available, a NPM module for use with Node and a Maven package for use on JVMs. | ||
As Apex & SOQL/SOQL are case-insenstive languages you need to use the provided CaseInsensitiveInputStream for the parser to function correctly. When parsing Apex, inline SOQL/SOSL is | ||
automtaically parsed, but you may also parse SOQL/SOQL directly. You can find some minimal examples in the src/\__test__ directory. Supports parsing of class & trigger files but not yet anonymous code snippets. | ||
This builds just contains the Parser & Lexer and provides no further support for analysing the generated parse trees beyond what is provided by ANTLR4. | ||
As Apex & SOQL/SOQL are case-insenstive languages you need to use the provided CaseInsensitiveInputStream for the parser to function correctly. When parsing Apex, inline SOQL/SOSL is automtaically parsed, but you may also parse SOQL/SOQL directly. You can find some minimal examples in the test classes. | ||
### Example | ||
To parse a class file: | ||
To parse a class file (NPM version): | ||
@@ -22,8 +23,9 @@ let lexer = new ApexLexer(new CaseInsensitiveInputStream("public class Hello {}")) | ||
### Change grammar | ||
If you change the Parser or Lexer grammar files you will need to update the parser with | ||
### Building | ||
To build both distributions: | ||
npm run antlr4ts | ||
npm run build | ||
### History | ||
2.9.1 - JVM build and npm dependency updates | ||
2.9.0 - Add SOQL Fields function | ||
@@ -30,0 +32,0 @@ 2.8.0 - Apex cast priority fix, SOSL & SOQL query format fixes, Added SOQL Date functions |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9
19953
47
1675174
Updatedantlr4ts@^0.5.0-alpha.4