Commit Graph

268 Commits

Author SHA1 Message Date
Camilo Roca d6975d60b1 fix: second export was overwriting the first one 2020-02-10 22:22:12 +01:00
Camilo Roca 2d8e1b60d1 refactored PredPrediction and DFAState to JsDoc 2020-02-10 22:13:19 +01:00
Camilo Roca 2a294b8a60 fix DFA serializer doc position 2020-02-10 22:07:58 +01:00
Camilo Roca 68730a8288 refactored DFA docs to JsDoc compatible 2020-02-10 22:07:21 +01:00
Camilo Roca 8c1730f687 use const/let and module.exports 2020-02-10 22:01:04 +01:00
Camilo Roca 116dbca78a refactor PredPrediction and DFAState to es6 classes 2020-02-10 21:58:44 +01:00
Camilo Roca 82d51aee99 use const/let
use module exports instead of exports
2020-02-10 21:56:40 +01:00
Camilo Roca 772286cf00 refactor DFASerializer and LexerDFASerializer to ES6 classes 2020-02-10 21:54:23 +01:00
Camilo Roca e5910c3019 use object destructuring 2020-02-10 21:52:26 +01:00
Camilo Roca a8e8402b77 refactor DFA function prototype into es6 classes 2020-02-10 21:51:11 +01:00
Camilo Roca 4b4aa68be3 fix: npm build is not a valid command 2020-02-08 15:14:10 +01:00
Camilo Roca d8435e13c3 removed conditional nodejs import in favour of webpack bundle
use const/let instead of var
use object destructuring
fix: missing new statement for DOM file reader
2020-02-07 14:08:19 +01:00
Camilo Roca c2180d2d5c adapted antlr4 js to use webpack for browser publishing
lib/require.js custom require removed in favour of webpack bundle
documentation updated
package-lock.json added
2020-02-07 13:57:20 +01:00
Camilo Roca aeebc0bb0b fix: use module.exports instead of exports to follow node best practices
cosmetic changes
2020-02-02 23:52:47 +01:00
Camilo Roca a7017d1a49 missing const 2020-02-02 23:43:12 +01:00
Camilo Roca 19458051c0 refactored error directoryto use classes, const and let 2020-02-02 23:37:21 +01:00
parrt 42512526f9 update javascript target to 4.3 2020-01-16 12:39:52 -08:00
parrt 6ad9646382 update version in code to 4.8 2020-01-16 12:18:17 -08:00
zqlu c37ef7e0ea Fix main entry point for JavaScript runtime npm package 2019-10-22 20:31:36 +08:00
miliu 35fcde7d69 add missed change 2019-09-29 20:51:31 -07:00
miliu 4a8eca579e resolve comments 2019-09-29 20:46:30 -07:00
miliu 033bb7f8c5 fix toString() 2019-09-29 13:57:20 -07:00
Eric Vergnaud 56eb0a3fab fix 2 erroneous calls, thanks @akaJes 2019-08-24 01:47:12 +08:00
Eric Vergnaud 3e258c5d9d avoid hashCode == 0 2019-08-24 01:46:11 +08:00
Eric Vergnaud 165dfa2b70 use same hash code whether readOnly or not 2019-08-24 01:45:31 +08:00
Eric Vergnaud badee1ffe1 fix minor issue in deserializer 2019-08-24 01:44:53 +08:00
Eric Vergnaud 32470dbab4 align on other runtimes 2019-08-24 01:44:36 +08:00
parrt 38a95da397 manual edits of 4.7.1 -> 4.7.2 2018-12-17 14:32:39 -08:00
Eric Vergnaud 77c830e6e1 fix #1955 for Javascript 2018-11-18 19:44:33 +08:00
Terence Parr 25b30623c0
Merge branch 'master' into master 2018-11-08 13:46:09 -08:00
Terence Parr fc01366f35
Merge pull request #2196 from robertbrignull/visit_null_children
JavaScript parse tree visitor: check if ctx.children is non-null in visitChildren
2018-07-24 15:54:06 -07:00
Robert 87725e65c9
Add an explicit return statement 2018-01-05 11:26:31 +00:00
Robert Brignull dd3af945fd Only visit is ctx.children is non-null 2018-01-03 12:49:52 +00:00
Kyle Sletten a7f3efb7eb
Remove unused parameter in `_loadString`
The usage of this method was removed in commit 51edf3cece, but the parameter remained.
2017-12-20 11:39:57 -07:00
enessoylu 0668b53083 update license string 2017-12-13 02:14:57 -05:00
parrt 763a1242b7 update version number and tweak doc 2017-12-08 12:47:11 -08:00
zqlu.cn 88a7580b78 Fix interval usage
For JavaScript runtime, Interval class constructor assume start and stop
to be number.
2017-11-24 16:37:40 +08:00
Venkat Peri e01af374d2 'requires' SUPERclass for Lexers in split mode, symbols/modes/channels available on Lexer prototype for use in lexer actions (this.SOME_MODE) like in Java actions, Utils.escapeWhiteSpace uses regex for global replace (was replacing only first occurnce of \n etc). 2017-07-22 18:11:37 -04:00
Eric Vergnaud 0166ba95ac fix JavaScript too 2017-06-25 13:44:24 +08:00
Jim Allman 892aa4a376 Fix other calls to InputStream constructor. 2017-05-11 17:08:24 -04:00
Jim Allman 5e648f0867 Add `new` keyword to return proper InputStreams
Currently the JS runtime sometimes returns (and mangles) the global
`window` object instead of a proper InputStream. This is prevented by
using the `new` keyword in all cases.
2017-05-11 16:27:42 -04:00
parrt a4622ec8dc set version to 4.7.0 for npm 2017-03-30 14:40:58 -07:00
parrt b5648f405b tweak documentation about various targets 2017-03-30 10:44:28 -07:00
Ben Hamilton f72e22550c charstreams-js 2017-03-22 11:03:16 -07:00
parrt 1b0a8aa2e8 Fixes #1747 2017-03-14 10:35:22 -07:00
harry-tallbelt 2a118e284f Fixed null pointer exception for JS 2017-03-08 15:00:14 +02:00
parrt 6215f18ec3 rename 4.6.1 to 4.7 everywhere 2017-02-23 14:48:58 -08:00
Ben Hamilton fd4246cf3f Implement new extended Unicode escape \u{10ABCD}. Bump UUID. Add lots more tests. 2017-02-23 09:39:44 -08:00
Ben Hamilton b190b6eca6 MAX_CHAR_VALUE to 0x10FFFF 2017-02-16 09:46:09 -08:00
Ben Hamilton 51edf3cece Fix InputStream.getText() when input contains Unicode values > U+FFFF 2017-02-10 11:41:00 -08:00
Ben Hamilton 32a3a95da1 Import fromcodepoint.js 2017-02-10 11:40:55 -08:00
Terence Parr 182f3c4647 Merge pull request #1628 from bhamiltoncx/js-string-codepointat-polyfill
JavaScript runtime: Optionally support decoding UTF-16 sequences to Unicode code points
2017-01-31 10:26:29 -08:00
Ben Hamilton 38ba75e96e Inline test instead of using anonymous function 2017-01-30 13:52:14 -08:00
Eric Vergnaud d5b88cda71 missing js export 2017-01-31 02:53:58 +08:00
Ben Hamilton e0104885e8 Use polyfill for JS unicode code point reading 2017-01-30 09:49:20 -08:00
Ben Hamilton ce6ce0f45d Polyfill for String.codePointAt for ECMAScript 5.1 browsers 2017-01-30 09:49:03 -08:00
Terence Parr 97aaddc006 Merge branch 'master' into fix-missing-variable-declarations 2017-01-24 09:54:05 -08:00
Eric Vergnaud f02d8c1a4b fix #1584 2017-01-19 21:44:56 +08:00
robert a053d908fb fix missing variable declarations 2017-01-11 15:39:04 +00:00
Terence Parr 040e40ec58 Merge pull request #1565 from ericvergnaud/fix-javascript-typo
fix typo in javascript visitor
2017-01-03 17:05:50 -08:00
Eric Vergnaud d5dcfc42c4 fix an issue where loading antlr from an IE web worker would fail 2017-01-04 01:56:02 +08:00
Eric Vergnaud 5bc40faebb fix typo 2016-12-29 23:24:09 +08:00
parrt 2629433830 bump version to 4.6.1 in all files. 2016-12-28 12:03:43 -08:00
Sam Harwell 24b20e236f Remove redundant isExpectedToken check
We know by the time this check was reached that neither EPSILON nor the LL(1)
symbol are in the lookahead set from the current state. Since EPSILON is not
included, the state cannot see to the end of the rule and thus nextTokens
contains the complete set of valid LL(1) symbols from the current state. It is
therefore impossible for the LL(1) symbol to be "expected" when considering
lookahead with full context.
2016-12-27 17:21:25 -06:00
Sam Harwell 8b21cc3dfb Fix DefaultErrorStrategy.sync handling of end of rule
This change updates the default sync() strategy to match the strategy used
for selecting an alternative when prediction leaves the decision rule prior
to reaching a syntax error.

Closes #1545
2016-12-23 16:28:46 -06:00
Eric Vergnaud 14f0c7a663 also published to npm 2016-12-17 00:03:03 +08:00
Eric Vergnaud caa581a9e0 success! 2016-12-12 23:52:09 +08:00
Renata Hodovan 3a4c8d8bc6 Implement the fix in #1471 for JavaScript target. 2016-12-11 00:59:24 +01:00
parrt 2c99f187a0 make it read "Copyright (c) 2012-2016 The ANTLR Project" 2016-12-08 11:43:06 -08:00
parrt 1b1a9862c4 contributors->authors 2016-12-08 11:43:06 -08:00
parrt 61e8eba4fc fix typo 2016-12-08 11:43:06 -08:00
parrt adadf567cc add copyrights on js 2016-12-08 11:40:30 -08:00
parrt 0b7c7f1333 update copyrights on js 2016-12-08 11:40:30 -08:00
parrt efc3f82f38 rm redundant license files 2016-12-08 11:40:30 -08:00
Eric Vergnaud 5ce735f56f cleanup 2016-12-04 18:58:49 +08:00
Eric Vergnaud 67a93b3f36 refine debug info 2016-12-04 16:51:46 +08:00
Eric Vergnaud 7332c1eb02 fix various hashing issues 2016-12-04 14:23:30 +08:00
Eric Vergnaud e850b4d97f use hashCode instead of hashString - Lexer seems to work but not Parser 2016-12-03 01:13:24 +08:00
Eric Vergnaud 682e0341c1 fix a typo in optimisation code 2016-12-01 22:23:53 +08:00
Eric Vergnaud 3cbc456355 cleanup test files 2016-12-01 22:23:26 +08:00
Eric Vergnaud f9d79dfcb2 implement LR optimisation in JavaScript + align naming + DFAState ctor bugs 2016-11-30 01:29:18 +08:00
parrt 9d3415ed8a Merge branch 'master' of git://github.com/ghosthope/antlr4 into ghosthope-master 2016-11-25 12:28:14 -08:00
parrt ace7758f6e Fixes #1280 2016-11-22 12:49:24 -08:00
Eric Vergnaud c50b10f865 clarify javascript visitor code 2016-11-20 14:10:05 +08:00
parrt ffaedd209d Set version in code to 4.6. 2016-11-06 11:21:06 -08:00
parrt 6d022379bc Pull in parrt's branch 'model-updates-for-new-targets' which appears to have freshened some non Go stuff as well. Simplify Go filename construction. 2016-11-05 08:48:37 -07:00
parrt 285c7fca6c resolve contribs conflict 2016-10-13 16:21:00 -07:00
Peter Boyer 2444386091 Remove JavaScript PORT_DEBUG, re-enable runtime tests for other language targets (#69)
* Re-enable runtime tests for other language targets

* Fix typo in js code

* Remove PORT_DEBUG statements

* Fix missing

* Fix testAltNum
2016-10-13 17:06:22 -04:00
Peter Boyer 42347c078b Fix merge failure 2016-10-12 09:53:43 -04:00
Peter Boyer 60662c4b70 Fix remaining tests (#64)
* Fix pred context typo

* Adjust array lengths

* PositionAdjustLexer test fix first steps

* allow virtual method calls from Lexer

* Hopefully fix issues with dup namedActions

* Make parser members

* Fix testParserProperty

* Fix LeftRecursion test failures
2016-10-12 09:49:42 -04:00
Christian Gudrian 75dd652d7a fixed visitAtom implementation
This implementation somehow got lost in rebasing.
2016-10-07 20:37:38 +02:00
Christian Gudrian cb590334bb the visit methods now return a value 2016-10-06 22:52:19 +02:00
Christian Gudrian 0396561520 made visitAtom work for terminal nodes 2016-10-06 22:52:19 +02:00
ghosthope 9766dff5d8 Javascript performance. Was add new string.hash function - murmurhash3_gc.js (https://github.com/garycourt/murmurhash-js/blob/master/murmurhash3_gc.js). Performance of the function increased in two times 2016-09-23 16:57:40 +03:00
Christian Gudrian 46df58d5d7 The JavaScript ParseTreeVisitor now implements a depth-first traversal by default. 2016-09-22 08:28:11 +02:00
Eric Vergnaud 0fed0b0684 Following #1218, ensure consistency of ATNConfigSet hashing strategy in JavaScript 2016-06-28 10:45:05 +02:00
Peter Boyer 97bf8d63f8 TODO 2016-06-17 19:21:11 -04:00
Peter Boyer c877bee8f1 PORT_DEBUG fix 2016-06-17 19:18:46 -04:00
Peter Boyer 7b1059ab6e Cleanup 2016-06-17 19:18:04 -04:00
Peter Boyer e4498eca87 delete js test code, unused license/readme 2016-06-17 19:17:39 -04:00
Eric Vergnaud 2a2b6acba1 links update 2016-04-26 13:27:26 +08:00
parrt cd0913712a set code string versions to 4.5.3 2016-03-30 16:21:50 -07:00
parrt 9e98714a1d Add ability to set parse tree internal node super class with option contextSuperClass. Provide impl in Java target that has altNum backing field. Add test across targets to set/get alt num. Fixes #1152. 2016-03-30 11:00:47 -07:00
Terence Parr 9c440c5b89 Merge pull request #1139 from dtymon/06_fix_SemanticPredicate
JS: SemanticPredicate should be SemanticContext
2016-03-30 16:39:18 +00:00
Terence Parr 4deb708cd8 Merge pull request #1138 from dtymon/05_fix_OR_toString
JS: Fix copy-and-paste error in OR SemanticContext toString() method
2016-03-30 16:39:08 +00:00
Terence Parr 0c804f0a28 Merge pull request #1137 from dtymon/04_lexerActionExecutor_equals
JS: Do deep Actions array comparison in LexerActionExecutor equals()
2016-03-30 16:38:56 +00:00
David Tymon eb5af71a30 JS: ATNConfig can incorrectly change "alt" of 0 to null
When an ATNConfig instance is created with an alt of 0, it is
possible for it to be incorrectly changed to null due to its
"falsey" nature.
2016-03-15 13:38:55 +11:00
David Tymon 5e176e405f JS: SemanticPredicate should be SemanticContext
AND.evalPrecedence() method is attempting to invoke a method on a
non-existent class "SemanticPredicate". It should be using
"SemanticContext" instead.
2016-03-15 13:32:48 +11:00
David Tymon 0dbb12ad1a JS: Fix copy-and-paste error in OR SemanticContext toString() method
- the OR toString() method was incorrectly added to the AND prototype
2016-03-15 11:00:36 +11:00
David Tymon 0262aac8f6 JS: LexerActionExecutor equals() should do deep comparison of Actions array
- according to the corresponding Java implementation, the equals()
  method for LexerActionExecutor should be doing an equals() test
  on each of the actions rather than testing the Array reference
  is equal.
2016-03-15 10:55:17 +11:00
Terence Parr d0fb48c2b8 Merge pull request #1103 from ericvergnaud/master
latest version of honey-require
2016-02-10 12:40:53 -08:00
parrt ae8ea836fc reopen PR #1081 2016-02-09 11:47:54 -08:00
Eric Vergnaud b0196bc86e fixes #1108 2016-02-09 10:25:31 +08:00
Eric Vergnaud 7a59e92b8d latest version of honey-require 2016-02-02 21:01:28 +08:00
Terence Parr c92ddcbd06 update version to 4.5.2 in source / packaging stuff. 2016-01-30 09:54:47 -08:00
Terence Parr 8fbf46b2f2 why oh why does intellij skip changes when i push? 2016-01-28 20:16:49 -08:00
Terence Parr 9a053d63b1 Merge pull request #1084 from dtymon/03_lexerActionExecutor_hash_string_clash
JS: LexerActionExecutor cached hash string name clashes with function
2016-01-28 11:11:15 -08:00
Terence Parr da27381fc1 Merge pull request #1083 from dtymon/02_ll1analyzer-incorrect_atnconfig_ctor
JS: LL1Analyzer passing PredictionContext incorrectly to ATNConfig ctor
2016-01-28 11:11:01 -08:00
parrt 34787c0fd8 Merge branch 'patch-1' of git://github.com/cooperra/antlr4 into cooperra-patch-1 Fixes #1081 2016-01-28 10:54:47 -08:00
Peter Boyer 89f1192cb6 Fixes to Go runtime, tool 2016-01-21 19:31:30 -05:00
Peter Boyer 260ccd056b Fixed a minor bug in Go runtime 2016-01-11 00:02:46 -05:00
Peter Boyer ddd706baf2 Fix issue printing tokens from IntervalSet 2016-01-03 22:44:36 -05:00
Peter Boyer fa46c498af Export some additional interface methods, fix issues with ParseTreeWalker, generate base Listener with tool 2016-01-03 22:07:43 -05:00
Peter Boyer 0726f4c2bb Some refactoring and cleanup 2015-12-31 15:01:37 -05:00
Peter Boyer 89427b7f45 Allow disabling debug statements 2015-12-31 13:42:59 -05:00
Peter Boyer efa8676211 Go impl emits exact same debug messages as JS impl. Yessss.... 2015-12-29 16:37:17 -06:00
Peter Boyer 7798333f72 More bugs 2015-12-29 15:32:11 -06:00
Peter Boyer 56e6e6c26f More debugging 2015-12-29 12:34:26 -06:00
Peter Boyer c08a19233c More bug fixing and debugging 2015-12-28 20:31:56 -06:00
Peter Boyer 4ffb3f81b6 More minor fixes 2015-12-26 10:32:02 -06:00
Peter Boyer a2e6ee7570 Minor fixes 2015-12-25 17:52:49 -06:00
Peter Boyer d239a6aa0e Fix a few things, add some debug code to js runtime 2015-12-25 16:18:25 -06:00
Peter Boyer 1dfc764df7 Fix issues found while debugging 1 2015-12-25 16:10:02 -06:00
David Tymon a1c63234e1 JS: Added 'require' statements are missing the class names 2015-12-24 19:04:22 +11:00
David Tymon 812794600d JS: LexerActionExecutor cached hash string name clashes with function
LexerActionExecutor caches its hash string in a member called
'hashString'. However, the class also has a method with the
same name which leads to unexpected results.

The member has been renamed to '_hashString' to avoid the name
clash.
2015-12-24 13:06:59 +11:00
David Tymon f40ce5a188 JS: LL1Analyzer passing PredictionContext incorrectly to ATNConfig constructor
The PredictionContext should be passed to the ATNConfig constructor
in the first argument, the params object. Instead, it is being passed
as the second argument which is intended to be the config.
2015-12-24 13:01:40 +11:00
David Tymon 0455e0a09f JS: Fix missing 'requires' statements 2015-12-24 12:23:09 +11:00
Peter Boyer 7c812fb320 Various minor fixes, update of runtime-testsuite for go 2015-12-20 19:41:12 -05:00
Peter Boyer 2df791a266 LexerATNSimulator 2015-12-19 18:28:22 -05:00
Peter Boyer cd2466a9d9 ParserATNSimulator 2015-12-18 18:46:09 -05:00
Peter Boyer d158f513ab SemanticContext 2015-12-18 15:53:57 -05:00
Peter Boyer c83d8fb109 Numerous small fixes 2015-12-18 14:09:06 -05:00
Peter Boyer 54206cd853 Errors 2015-12-18 10:44:02 -05:00
Peter Boyer 797dd823be Fix mistake in tokenIndex bounds check
undefined < anyInteger 

returns false
2015-12-15 21:44:47 -05:00
Eric Vergnaud c651c83a8b fix #1058 2015-12-09 22:17:46 +08:00
Terence Parr 8a4aa39de2 fix links 2015-11-23 16:19:45 -08:00
Eric Vergnaud 98abfc14f3 Update GitHub references in npm package 2015-11-12 07:57:52 +08:00
Terence Parr 482d8d44fd resolve contrib conflict 2015-10-27 09:43:07 -07:00
Martin Probst af9e8a1e92 fix #1023: getExpectedTokens() returns out of context tokens on consecutive runs 2015-10-21 17:14:43 +02:00
hkff e051b1a0f8 Fixing BufferedTokenStream.getTokenStream() calls 2015-10-21 16:34:44 +02:00