Commit Graph

1897 Commits

Author SHA1 Message Date
Mike Lischke 92b032820e Merge branch 'master_upstream' 2016-11-07 11:19:12 +01:00
Mike Lischke 3b3fe3da57 Merge branch 'master_upstream'
Had to resolve a number of conflicts + added code required for the C++ target to generate header files, after the recent changes in the main repo.
2016-11-07 11:16:02 +01:00
parrt 71c52eb0fa building 4.6 runtime requires 4.5 antlr mvn plugin 2016-11-06 11:27:30 -08:00
parrt ffaedd209d Set version in code to 4.6. 2016-11-06 11:21:06 -08:00
parrt 95c850e5f8 set version in prep for 4.6 2016-11-05 16:48:36 -07:00
Peter Boyer 485465ee7a Merge pull request #83 from pboyer/reduce-model-changes
Reduce model changes from parrt
2016-11-05 15:29:37 -04: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
Mike Lischke e71e95080a Merge branch 'master_upstream'
Also updated the list of ignored tests in the Cpp.test.stg file (lke it is done for the other targets).
2016-11-05 15:07:59 +01:00
Peter Boyer f553056a2b Fix unused import error 2016-11-04 14:40:15 -04:00
Peter Boyer 0541f34a7e Merge with origin/master 2016-11-04 14:08:12 -04:00
Peter Boyer aa568711d9 Remove PortDebug 2016-11-04 13:55:39 -04:00
kai stammerjohann 1feef18e3e ParserRuleContext init members 2016-11-01 09:06:27 +01:00
Mike Lischke f794820aaf Reworked mutex handling + updated C++ template for a var init
- Mutexes have been consolidated. Instead of one per DFA (which can easily get to hundreds of them) we only have one mutex in the Recognizer class and all other parties use this for serialization. It's only about protected the DFA anyway, which is stored in a recognizer (lexer/parser).
- ATNState::getStateType() returns a size_t value now (actually an enum).
- Replaced checks via RTTI for transitions by the (serialization) type of the transition, for simplicity.
- Added some missing initialization for fields in certain ATN state classes.
- Fixed mem leak in DFA by shadowing the s0 field. That way still have a ref to the self created instance, even is s0 was replaced later.
- Added variable init in code generation for a rule context declaration (e.g. for labels).
2016-10-29 14:46:38 +02:00
Floor 951d0f06d7 cpp runtime: updated the vs2013 project reflecting the last changes 2016-10-21 13:07:15 +02:00
Peter Boyer adef6f690a Cleanup var statements (#73)
* Cleanup var statements

* Fix type decl
2016-10-17 12:57:26 -04:00
Peter Boyer 07f7dae78f Fix type decl 2016-10-17 12:04:05 -04:00
Peter Boyer 191b8f9d58 Cleanup var statements 2016-10-17 11:41:56 -04:00
Mike Lischke 9e77edcb34 ATNState::transactions improvements
The transaction field was access with trivial getters and setters which server no real purpose, so I made the vector public and remove all the obsolete accessor functions. This simplifies the API (e.g. use .size() instead of getNumberOfTransitions()).
This change required a few other changes in runtime.

Additionally, I radically cut down the ATN::toString method to return only what the Java runtime is doing instead of a full dump of the state and it's transitions.
2016-10-14 17:10:00 +02:00
Mike Lischke aabf4baf60 Added default c-tor to ParseTree + improved createInstance.
createInstance now use move semantics for its parameters.
2016-10-14 17:05:00 +02:00
Mike Lischke 014070de66 Converted smart pointer for the rule context in RecognitionException
Since we pass around raw pointer for volatile references now, we must not create smart pointers from them or we will get a double free.
2016-10-14 17:03:38 +02: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
Terence Parr 8d0ae8599e Merge pull request #1221 from ericvergnaud/javascript-consistency
Following #1218, ensure consistency of ATNConfigSet hashing strategy …
2016-10-13 14:05:36 -07:00
parrt 4312b37828 pull test changes in 2016-10-13 10:58:19 -07: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
Mike Lischke a4e343806f Some small optimizations.
- No copy of a DFA state during ATN deserialization.
- Fixed memory leak of locally created s0 state in DFAState.
2016-10-12 11:06:51 +02:00
Mike Lischke 4897bd8571 Simplified memory management for volatile parsing part.
There are 2 parts in an ANTLR genrated parser where memory is allocated: the actual parsing (with or w/o creating a parse tree) and the prediction part (via DFA/ATN etc.). The first part is highly volatile as it recreates parse tree instances (the class) on each parser run. In fact also lexer tokens belong to that part, but are already managed via unique pointers. This first part works without any smart pointer now. Instead there is a simple tracker class which holds all created references and frees them when the parser is reset or destroyed. This is a bit less optimal if the parser is set to create no parse tree, as created rule context objects are not freed immediately (like with smart pointers), but during reset. On the other hand this change gives (depending on the input) a nice speed up (0%-100%, after the warm up phase). Additionally memory consumption drops by a good amount.

Everything in the simulartors (and interpreters) remains unchanged. This is the shared prediction part.
2016-10-11 13:49:02 +02:00
Peter Boyer 145bfca692 Update lexer_action.go (#62) 2016-10-08 23:03:11 -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
Peter Boyer 10f15cabf8 errorNode() impl (#59) 2016-10-06 16:19:05 -04:00
Peter Boyer a5859fd54e Fix PredictionContext merge() typo (#61)
* Fix pred context typo

* Adjust array lengths
2016-10-06 16:18:18 -04:00
Mike Lischke 2e92b38bf7 Updated unit tests after last refactoring. 2016-10-06 17:17:36 +02:00
Peter Boyer 499d9d3f89 Print test arrays in java style (#50)
* Print string rule invocation stack array in java style

* regen runtime tests

* Another array print fix

* Fixes to print array of terminal nodes:

* regen tests
2016-10-05 14:52:42 -04:00
Mike Lischke fc5c1a29f9 Next attempt to get the C++ runtime compiled in Travis CI. 2016-10-04 10:17:59 +02:00
Mike Lischke bb5d7ef0b6 Set minimum cmake version to 3.1 for C++ target. 2016-10-04 10:09:31 +02:00
Mike Lischke c968b5209e alts outer-context flag/counter in ATNConfig is now unsiged.
A few more removals of no longer necessary casts.
2016-10-03 16:11:45 +02:00
Mike Lischke 0e0ecfafde Fixed a number of warnings for VS. 2016-10-03 14:50:22 +02:00
Mike Lischke 8280beb564 Refactoring of further int values, mostly converting them to size_t.
- Switched most symbolic signed constants to unsigned variants. Redefined EOF in particular to become (size)-1, to avoid having to use signed token type values.
- Introduced INVALID_INDEX for all previous -1 values to indicate e.g. not found indexes etc.
- Added 2 helpers to convert between symbolic and numeric form (mostly for intervals and toString()).
- Removed many no longer needed type casts to size_t.
- Updated templates for these changes.
- Limited runtime tests to C++ tests only, to see how Travis CI copes with that.
2016-10-02 16:51:57 +02:00
Mike Lischke de4df872fe Updates to get all tests green again.
- Had to take back some of the message beautifying, as this won't match expected runtime test output.
- Updated C++ test stg file for recent runtime changes. Regenerated tests (only one file changed actually).
- Reworked C++ test preparation. The C++ runtime is now built on first invocation of a test. This works only on Linux + OSX/macOS. Windows needs extra handling.
2016-10-01 12:43:31 +02:00
Mike Lischke 5c63bc9a07 Some clean up and xcode unit test fixes. 2016-09-30 10:59:44 +02:00
Mike Lischke 4394cd20b0 Merge branch 'master_upstream' 2016-09-29 16:50:57 +02:00
Mike Lischke f983fac7c7 Added support for hidden symbols on Linux and OSX.
It's now possible to hide all symbols by default and publish only those marked with the ANTLR4CPP_PUBLIC macro (same as for Windows). The included XCode project makes use of this option now.
2016-09-29 16:48:17 +02:00
Mike Lischke 28eb19f52e Explicitly delete copy c-tor and operator for DefaultErrorStrategy.
This class holds a vector of unique_ptr instances and hence cannot be copied.
2016-09-25 11:48:18 +02:00
Mike Lischke ee3e918e4e Exclude also vscode project data when generating the source zip. 2016-09-25 11:24:53 +02:00
Renata Hodovan 03d5fb1244 Make Python targets more pythonic.
The Python implementations are completely synchronous
with the Java version even if some of the constructs
can be expressed with simpler Python solutions. These are
typically the all, any, count, next builtins or the list
comprehensions, etc. Beside using them makes the code
clearer, they are also prefered by the standard and can
result in performance speedup. The patch contains such
equivalent transformations in the Python targets.
2016-09-25 10:33:27 +02:00
Mike Lischke 19345919de Bug fixes + XCode 8 updates
- Recommended project updates from XCode 8 applied.
- Bug: ANTLRInputStream not fully initialized when constructing from a stream.
- Account for more than one temporary error token in DefaultErrorStrategy.
2016-09-24 12:33:54 +02:00
Christian Gudrian 46df58d5d7 The JavaScript ParseTreeVisitor now implements a depth-first traversal by default. 2016-09-22 08:28:11 +02:00