diff --git a/doc/javascript-target.md b/doc/javascript-target.md index 845fcba59..cdde71516 100644 --- a/doc/javascript-target.md +++ b/doc/javascript-target.md @@ -15,7 +15,7 @@ The tests were conducted using Selenium. No issue was found, so you should find ## Is NodeJS supported? -The runtime has also been extensively tested against Node.js 0.12.7. No issue was found. +The runtime has also been extensively tested against Node.js 10 LTS. No issue was found. ## How to create a JavaScript lexer or parser? @@ -55,32 +55,17 @@ You can get [information on webpack here](https://webpack.github.io). The steps to create your parsing code are the following: - generate your lexer, parser, listener and visitor using the antlr tool - - write your parse tree handling code by providig your custom listener or visitor, and associated code, using 'require' to load antlr. + - write your parse tree handling code by providing your custom listener or visitor, and associated code, using 'require' to load antlr. - create an index.js file with the entry point to your parsing code (or several if required). - test your parsing logic thoroughly using node.js You are now ready to bundle your parsing code as follows: - following webpack specs, create a webpack.config file - - in the webpack.config file, exclude node.js only modules using: node: { module: "empty", net: "empty", fs: "empty" } + - in the `webpack.config` file, exclude node.js only modules using: `node: { module: "empty", net: "empty", fs: "empty" }` - from the cmd line, navigate to the directory containing webpack.config and type: webpack This will produce a single js file containing all your parsing code. Easy to include in your web pages! -If you can't use webpack, you can use the lib/require.js script which implements the Node.js 'require' function in brwsers. - -This script is provided by Torben Haase, and is NOT part of ANTLR JavaScript runtime. - -Assuming you have, at the root of your web site, both the 'antlr4' directory and a 'lib' directory with 'require.js' inside it, all you need to put in your HTML header is the following: - -```xml - -``` - -This will load the runtime asynchronously. - ## How do I run the generated lexer and/or parser? Let's suppose that your grammar is named, as above, "MyGrammar". Let's suppose this parser comprises a rule named "StartRule". The tool will have generated for you the following files: