Commit Graph

2140 Commits

Author SHA1 Message Date
Terence Parr 30dddbb84d Merge pull request #1445 from parrt/fixes-550-java
Fixes #550 by @lygav, which tweaks and more tests by me.
2016-12-03 10:25:55 -08:00
parrt c959bf649b Fixes #550 by @lygav, which tweaks and more tests by me. 2016-12-03 10:25:02 -08:00
parrt 2dd96f3220 Merge branch 'master' of git://github.com/lygav/antlr4 into lygav-master 2016-12-03 09:19:57 -08:00
Terence Parr 53b6153060 Merge pull request #1437 from ewanmellor/swift-xcode-project-tidyups
Swift Xcode project tidyups
2016-12-03 09:11:55 -08:00
Terence Parr 95dc3f673f Merge pull request #1440 from samtatasurya/cpp-get-text
Fix to Issue #1434
2016-12-03 09:10:51 -08:00
Terence Parr 1f953da0ac Merge pull request #1441 from ericvergnaud/poor-left-recursive-rule-performance
Poor left recursive rule performance
2016-12-03 09:08:40 -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
Terence Parr 8ead51d8ff Merge pull request #1423 from wxio/master
Fix for redeclared error is generated Go code.
2016-12-01 10:51:40 -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
Vladi 09db23160f fix for #550 2016-12-01 12:19:29 +02:00
Samuel Tatasurya 1aa9a41d01 Removed comma and space appending in getText() 2016-12-01 01:40:37 -08:00
Ewan Mellor b0c3824357 Create a new Xcode playground for Swift.
This takes the example from
https://github.com/janyou/Antlr-Swift-Runtime/tree/master/Test and packages
it into an Xcode playground.  This allows the user to interact with the
grammar directly inside Xcode, and serves as a live demo of the Swift support.

Update the docs to match.
2016-12-01 01:23:52 -08:00
Ewan Mellor ee0babaa8f Update the bundle identifiers.
This changes PRODUCT_BUNDLE_IDENTIFIER to read org.antlr.v4.swift.macos or
org.antlr.v4.swift.ios.  This is similar to the naming scheme used in the Java
code.

The previous identifier was jlabs.Antlr4.  I don't know what that refers to.
2016-12-01 00:55:15 -08:00
Ewan Mellor 20ef01c442 Update the Xcode project to match the recommended values in Xcode 8.1. 2016-12-01 00:55:15 -08:00
Vladi Lyga 8b60373c43 fix: enable to access interval as a list 2016-11-30 17:16:35 +02:00
Vladi Lyga f50fb7df15 Fix error when Interval is rewritten with a tuple 2016-11-30 13:55:54 +02:00
Vladi Lyga 377f2f5c89 Merge remote-tracking branch 'antlr4/master' 2016-11-30 11:31:24 +02:00
Vladi Lyga 238b55a0b6 Extensive TokenStreamRewriter tests + many python2 runtime fixes.
Including fix for https://github.com/antlr/antlr4/issues/550
2016-11-30 11:27:04 +02:00
Eric Vergnaud f9d79dfcb2 implement LR optimisation in JavaScript + align naming + DFAState ctor bugs 2016-11-30 01:29:18 +08:00
Eric Vergnaud 6e071f4950 implement LR optimisation in Python3 + align naming + DFAState ctor bugs 2016-11-30 00:40:42 +08:00
Eric Vergnaud ccde4051bd fixed the 2 failing tests with left recursion optimisation 2016-11-30 00:40:01 +08:00
Gary Miller 2b69dd7c18 Added GetTokenSourceCharStreamPair method to lexer. Needed when customising lexer eg. to create a python style block sensitive lexer. 2016-11-29 13:27:49 +11:00
Eric Vergnaud ec5f64a459 start migrating, but 2 tests are failing 2016-11-29 00:05:13 +08:00
Eric Vergnaud 3026c3cc94 start migrating 2016-11-28 23:05:43 +08:00
parrt 228bcac063 stick with existing not iterative walker by default. 2016-11-27 09:42:23 -08:00
parrt c258fd2a5d rm redundant init 2016-11-27 08:41:11 -08:00
Mike Lischke f9699efa2c C++ runtime implemenation of [ee614db] 2016-11-27 15:08:15 +01:00
Mike Lischke 9eb2a31179 C++ target implementation for [c695ed2]. 2016-11-27 13:35:07 +01:00
Mike Lischke fa14b9aad8 Merge branch 'master_upstream' 2016-11-27 13:34:19 +01:00
parrt c695ed25e9 Fixes #1238. @antlr/antlr-targets might want to tweak their targets. 2016-11-25 13:01:07 -08:00
parrt 3506dcef1d add @Override to hush warnings. Manually did some of https://github.com/antlr/antlr4/pull/1066 2016-11-25 12:52:44 -08:00
parrt 9d3415ed8a Merge branch 'master' of git://github.com/ghosthope/antlr4 into ghosthope-master 2016-11-25 12:28:14 -08:00
Tom Wieczorek d1bc0f5ca5
Merge remote-tracking branch 'origin/master' into iterative-tree-walker 2016-11-25 12:25:27 +01:00
Mike Lischke a6161326e1 Merge branch 'master_upstream' 2016-11-25 08:58:15 +01:00
Mike Lischke dc0e952fc2 Removed an obsolete line. 2016-11-25 08:38:56 +01:00
parrt 933cc6e63c make the switch an ENV not property. 2016-11-24 20:30:18 -08:00
parrt e1a1867149 change name of switch that turns off new opt. 2016-11-24 13:32:41 -08:00
parrt c182e3d5bf Fixes #994 poor performance in left-recursive expressions with very large expression input phrases; builds off of @sharwell solution that explicitly checks for key return states in expr rules 2016-11-24 13:07:19 -08:00
Sam Harwell fca5e458d3 Implement dynamic disambiguation
Fixes #1398
Fixes #994
2016-11-24 13:01:14 -08:00
ghosthope 04e9078dd9 from master 2016-11-23 13:58:43 +03:00
parrt ace7758f6e Fixes #1280 2016-11-22 12:49:24 -08:00
parrt aeaba48a0b pull in lygav python impl of TokenStreamRewriter 2016-11-22 12:34:46 -08:00
parrt 2cb02d9b43 add UTF-8 encoding on all antlr runs during test, fix appveyor 2016-11-22 10:00:28 -08:00
Terence Parr f3be375c3a Merge pull request #1379 from ericvergnaud/python3-token-stream-rewriter
port from python 2 version
2016-11-21 11:34:16 -08:00
Terence Parr 5f41dd2fc9 Merge pull request #1378 from ericvergnaud/javascript-visitor-clarification
clarify javascript visitor code
2016-11-21 11:33:39 -08:00
Terence Parr 37ff8a3161 Merge pull request #1248 from renatahodovan/configset-contains
Fix comparisons in ATNConfigSet.__contains__ of Python targets.
2016-11-21 10:08:51 -08:00
Eric Vergnaud 9d926d6c2a port from python 2 version 2016-11-20 15:56:43 +08:00
Eric Vergnaud c50b10f865 clarify javascript visitor code 2016-11-20 14:10:05 +08:00
hanjoes e0b326677b Migrating the current Swift tests to the new testing framework. 2016-11-19 18:30:48 -08:00
janyou 281d624751 Update RuntimeMetaData.swift 2016-11-19 18:30:48 -08:00
janyou 033e5ed136 Update Trees.swift 2016-11-19 18:30:48 -08:00
janyou e3cc81bc32 Update RuleContext.swift 2016-11-19 18:30:48 -08:00
janyou 97c5ebd359 Update Parser.swift 2016-11-19 18:30:48 -08:00
Ewan Mellor 1c6f6c4aed Ignore .xcuserdata, and remove those that were here already. 2016-11-19 18:30:48 -08:00
Ewan Mellor 69d9cfe302 Added a Swift runtime.
This comes from https://github.com/janyou/Antlr-Swift-Runtime and is
marked Copyright (c) 2015 janyou on top of the BSD license and Copyrights
for Terence Parr and Sam Harwell derived from the original ANTLR source.
2016-11-19 18:30:48 -08:00
parrt d9490e16da undo damage done by intellij pulling out imports from python :( 2016-11-19 18:29:04 -08:00
parrt 883e013cc6 Fixes #1318. 2016-11-19 16:13:50 -08:00
parrt 144baa9ade cannot raise string exceptions 2016-11-19 15:09:13 -08:00
Terence Parr 30e4ec29c8 Merge pull request #1251 from renatahodovan/execATN-conflictingAlts
Fix the initialization of conflictingAlts in execATN in Python targets.
2016-11-19 14:58:39 -08:00
parrt c0b5a40bcf Python3 target filterPrecedencePredicates should take collection:set not list as hint. Manual implementation of https://github.com/antlr/antlr4/pull/1247/files 2016-11-19 14:51:12 -08:00
Terence Parr f0177c96f8 Merge pull request #1246 from renatahodovan/nextToken-self-fix
Fix eofToken access in ListTokenSource.nextToken() by Python targets.
2016-11-19 14:43:06 -08:00
Terence Parr e32799f048 Merge pull request #1371 from FloorGoddijn/master
CPP runtime :  Added a specialized ctor for Any for nullptr.
2016-11-19 14:23:53 -08:00
Terence Parr db5d306285 Merge pull request #1187 from renatahodovan/atnconfig_instantiate
Fix initialization of ATNConfig when computing SLL prediction termination condition.
2016-11-19 14:21:22 -08:00
Terence Parr 1ba897ace4 Merge pull request #1186 from renatahodovan/python-enterrule-typo
Fix typo in the parser of the Python3 runtime.
2016-11-19 14:16:17 -08:00
parrt 5153154658 Merge branch 'fix_typos' of git://github.com/sebkur/antlr4 into sebkur-fix_typos 2016-11-19 11:52:17 -08:00
Floor 1931ff7280 * Added a specialized ctor for Any for nullptr.
There was an inconvenience that an Any created with a nullptr returned false for isNull()
* removed warning [forcing value to bool 'true' or 'false'] when calling is<>
2016-11-18 17:24:11 +01:00
parrt 125a509e4e Fixes #1369 by removing any redundant edges. 2016-11-17 12:41:32 -08:00
parrt 1aa3c957eb add test for extra atn issues. currently failing. 2016-11-17 12:27:32 -08:00
Mike Lischke 3062d09e92 Merge pull request #48 from FloorGoddijn/master
using new preprocessor macro ANTLR4CPP_DLL instead of _WINDLL
2016-11-16 15:27:11 +01:00
Mike Lischke 9ac9c1c79a Overhaul of the TokenStreamRewriter class.
Fixes bug #49.
2016-11-16 15:17:46 +01:00
Mike Lischke e5aa03c0b0 Merge branch 'master_upstream' 2016-11-16 13:31:06 +01:00
Mike Lischke af0ac9e2bb Fixed a number of mem leaks in TokenStreamRewriter.
Also added a workaround for duplicate ATN state transitions. Looks there is a problem in the ATN generation by ANTLR which needs investigation.
2016-11-16 13:27:58 +01:00
parrt 08e9776a4a shift template-based runtime test to legacy, new mechanism uses annotation to get multi-line strings into java. all tests pass minus about 15 in C# 2016-11-15 11:08:19 -08:00
Mike Lischke 74d094bee7 Merge branch 'master_upstream' 2016-11-10 20:35:10 +01:00
Mike Lischke da57be191a Avoid warnings when building on Linux. 2016-11-10 10:28:13 +01:00
Floor e0090254aa using new preprocessor macro ANTLR4CPP_DLL in stead of the windows defined _WINDLL to define ANTLR4CPP_PUBLIC and EXPIMP_TEMPLATE for dll configurations.
There was a problem when the static lib was used at a client dll ( which itself defines the _WINDLL)
2016-11-09 13:45:37 +01:00
Terence Parr f29a7940d8 Merge pull request #1345 from pboyer/intervalSetBug
Fix bug in IntervalSet
2016-11-07 23:19:22 +01:00
Peter Boyer 9bb49842ef cleanup 2016-11-07 16:27:39 -05:00
Peter Boyer aace3de380 Fix bug in interval set 2016-11-07 16:23:10 -05:00
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
Sebastian Kürten 6a8a93286f Move a @since tag to start of a new line
Javadoc requires block tags to appear at the start of lines.
2016-11-01 11:46:16 +01:00
Sebastian Kürten 8b16ff180a Fix a few typos in Javadoc 2016-11-01 11:46:04 +01: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
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
Vlad 5a0608be2e fix op filter error when trying to replaceSingleToken 2016-09-02 22:20:08 +03:00
Vlad ae435d06c8 add TokenStreamRewriter to Python2 runtime 2016-09-02 15:36:11 +03:00
Nathan Burles 6638883d9d Second parameter is end pointer, not size 2016-09-02 12:51:28 +01:00
Mike Lischke 6f62821573 More optimizations of the runtime.
- Lesser use of shared_ptr, e.g. in listeners and some loops.
- Removed useless access methods for children in ParseRuleContext. The child list is public. Fixed initialization for start and stop nodes.
- Simplified parent + child organization in Tree and all derived classes. Instead of using overridable functions in various descendants we have now central parent + child fields in the base tree class (where they belong actually, considering this is about forming a tree). Users have to cast to the appropriate classes if necessary.
- Removed obsolete getChildren() function in Trees helper. We can just return the child vector.
- Changed edges member to an unordered_map, as this is a sparse container. This speeds up certain grammars by 1000% (e.g. highly recursive expression rules) and avoids wasting a lot of memory. This change also simplifies handling significantly.
2016-08-22 12:12:22 +02:00
Mike Lischke ee2510e654 Output formatting in DefaultErrorStrategy and init of generated member vars.
- Had to escape tabs + linebreaks in DefaultErrorStrategy when generating a text representation. Also removed a few explicit string instance creations on the way.
- Member vars in parser context classes that take (optional) Token references must be initialized.
- Fixed a warning that copyFrom() would hide a virtual function in a ParserRuleContext.
- Another attempt to limit genrating double semicolons.
2016-08-10 08:55:17 +02:00
Renata Hodovan c15b0d9a36 Fix the initialization of conflictingAlts in execATN in Python targets.
The Java target initializes the conflictingAlt local variable
based on the conflictingAlts property of the target state.
However, the Python targets resets it to None. The patch makes the
initializations consistent.
2016-08-10 01:32:12 +02:00
Renata Hodovan 543a069440 Fix comparisons in ATNConfigSet.__contains__ of Python targets.
The __contains__ method of ATNConfigSet used different hashing
function (hash) for indexing the config dictionary than the
getOrAdd method (hashCodeForConfigSet) which filled it.
Furthermore, they also used different methods for comparing
ATNConfig objects. The patch makes them consistent.
2016-08-09 22:52:37 +02:00
Renata Hodovan 510e21d7cb Fix eofToken access in ListTokenSource.nextToken() by Python targets.
At the end of the nextToken() function, setting the eofToken field was
attempted without the 'self' keyword, resulting in accessing
and setting a new local and unused variable. The patch supplements
the missing 'self' keywords for both targets.
2016-08-09 15:32:12 +02:00
Mike Lischke 1869d9dac2 Reverting revision [a2d6b62] 2016-08-07 11:29:47 +02:00
Mike Lischke 7abfbc60c6 Change deployment scripts location and updated doc.
In order to be able to build with cmake and to have a complete source package including the demo the deployment scripts were moved to the root Cpp folder and updated.
Also the releasing-antlr.md doc file has been updated.
2016-08-04 17:03:34 +02:00
Mike Lischke ccc1fc4939 Fix for merge problems in PredictionContext.
Apparently context references can disappear while such a ref is held in the (temporary) merge cache. Hence we need to do a full ref for the merge cache key pair.

Closes issue #12.
2016-08-04 16:05:09 +02:00
Mike Lischke 78a12168bb Merge pull request #35 from nburles/fix-prediction-context
Without these tests, the demo crashes
2016-08-04 15:42:16 +02:00
Mike Lischke 07ceea1245 Some additional changes for removal of the == operator override. 2016-08-04 15:41:45 +02:00
Mike Lischke a41774ef0d Merge pull request #33 from nburles/remove-equality-override
Remove the std::operator== override in CPPUtils.h
2016-08-04 15:40:51 +02:00
Nathan Burles dc35da2a75 Only compare the addresses, as in Java 2016-08-04 13:39:07 +01:00
Nathan Burles fa0816d243 Without these tests, the demo crashes at PredictionContext.h:247 : k->hashCode() 2016-08-04 11:20:21 +01:00
Mike Lischke b05c8286b8 Corrected a warning suppression check. 2016-08-04 10:04:24 +02:00
Mike Lischke 8335d32b2d Various smaller changes to fix compilation and other problems.
- Added new rule to test grammar to get code generation for wildcard capture.
- Updated the Cpp.stg template file for that.
- Made the Unicode hack (auto extend 0xFFFF to 0x10FFFF) dependent on a parameter, so we only use this hack when deserializing an ATN. This avoids trouble with intervals used in other contexts (like string offsets).
- Added a few operator != overloads, to fix compilation after recent changes.
- Simplified operands comparison in SemanticContext (uses the Arrays class now). Some cleanup in that class too.
- The abstract parse tree visitor now uses const& for Any references, to avoid reallocating new instances over and over again.
- The lexer counts syntax errors the same way as the parser does. So we can directly determine if there was any error by simply examining that (which avoids having to use a temporary listener).
2016-08-04 09:28:13 +02:00
Nathan Burles db8339b458 Leave spaces alone unless escaped spaces requested 2016-08-02 14:56:10 +01:00
Nathan Burles a1d61541b7 Remove the std::operator== override in CPPUtils.h 2016-08-02 09:00:10 +01:00
Mike Lischke 183b7ce0a9 Merge pull request #30 from nburles/compare-contents-not-just-addresses
Compare contents not just addresses
2016-08-01 18:17:42 +02:00
Mike Lischke 63b5e61c15 Merge pull request #31 from nburles/simpler-hash-calls
There is no need to call ->hashCode() explicitly
2016-08-01 18:01:28 +02:00
Mike Lischke 8bbdbe0371 Merge pull request #28 from nburles/fix-intervalset-comparisons
Fixes comparisons of IntervalSets
2016-08-01 17:45:45 +02:00
Mike Lischke f3110fdd22 Merge pull request #27 from nburles/fix-ATN-serialization
Fixes ATN serialization
2016-08-01 17:45:03 +02:00
Nathan Burles 64f1a654bd There is no need to call ->hashCode() explicitly 2016-08-01 16:40:15 +01:00
Mike Lischke 3705e1b3fd Consistent formatting in Any.h + converted CPPUtils.cpp to utf-8. 2016-08-01 17:36:43 +02:00
Nathan Burles 198da78c98 Compare contents in SemanticContext::*::operator== 2016-08-01 16:32:51 +01:00
Nathan Burles 739bf3a756 Compare contents in LexerATNConfig::operator== 2016-08-01 16:31:48 +01:00
Nathan Burles 903fa473c5 Compare contents in ATNConfigSet::operator== 2016-08-01 16:26:37 +01:00
Nathan Burles a025c9eefc Compare contents in ATNConfig::operator== 2016-08-01 16:25:37 +01:00
Mike Lischke c60f1bb8f9 Fixed a bug + raised warning level in Visual Studio
- Fixed an endless recursion in Any, caused by the removal of one of the (apparently) unneeded copy constructors. As it turned out both are required. That leads to a warning in VS about a duplicate copy c-tor, which had to be suppressed therefore.
- Raised the warning level to W4 in both VS 2013 and VS 2015 and fixed all warnings resulting from that.
2016-08-01 16:47:17 +02:00
Nathan Burles 3ee53a79db Fixes comparisons of IntervalSets 2016-08-01 09:57:51 +01:00
Nathan Burles 3535830c98 Fixes ATN serialization 2016-08-01 09:54:10 +01:00
Mike Lischke 282e193e6a Corrected an include. 2016-07-31 16:10:39 +02:00
Mike Lischke eee86d8292 Small updates for VS 2013/2015.
Updated the demo project to also use static/dynamic libs like the runtime and fixed a few warnings in the Any class.
2016-07-31 13:28:01 +02:00
Mike Lischke 8a5f6815fe Rework of the visitor implementation
The translation from Java generics to templates in C++ lead to the need of virtual template functions, which is not supported by C++. Instead we use now the Any class for results of visits and no longer need templates for that part.
2016-07-30 20:03:27 +02:00
Tim O'Callaghan 7724dd2cd5 external project cmake example, needed set C++ 11 2016-07-24 22:13:17 +02:00
Tim O'Callaghan d6d50457ff Updated CMake for demo to:
- Only require JRE
- Support out of tree build from antlr repostitory
- Support Superproject build with ExternalAntlr4Cpp cmake module

ExternalAntlr4Cpp module has quickstart documentation for people to be
able to start working quicly with antlr4cpp from the base demo sources
see source file for example.
2016-07-24 21:58:45 +02:00
Mike Lischke 365e0f2df0 Fixed a few warnings. 2016-07-22 16:33:43 +02:00
Mike Lischke d46ef90aa0 Fixed some cmake issues. Closes issue #13 and issue #8.
Additionally a warning was fixed (std::move prevents copy elision)
2016-07-20 16:24:12 +02:00
Mike Lischke 196e8ab53d Actually use a channel in the demo grammar. 2016-07-20 15:22:09 +02:00
Mike Lischke 5e313471df Merge pull request #19 from nburles/fix-utf8-bom
Added code to detect and handle the UTF-8 BOM if present
2016-07-20 15:20:31 +02:00
Mike Lischke be2c98f64f Merge pull request #18 from nburles/fix-intervalset-iterator
vector::erase invalidates any iterators at/after the erase position
2016-07-20 15:16:26 +02:00
Mike Lischke 91a7657d73 A few small corrections after the previous merge. 2016-07-20 12:32:02 +02:00
Tom Wieczorek ea31615804
Use the iterative version of the ParseTreeWalker as default implementation 2016-07-20 09:18:08 +02:00
Tom Wieczorek 7ca7acd084
Use two queues instead of a custom linked memory structure 2016-07-20 09:17:50 +02:00
Nathan Burles 78de172790 Fix warnings with int to char cast 2016-07-19 11:46:24 +01:00
Nathan Burles d3027f18fb Added code to detect and handle the UTF-8 BOM if present, otherwise the utfConverter leaves it in the stream 2016-07-19 11:31:03 +01:00
Will Faught 7f42bc602b Add interface build checks for tree types and generated base listeners 2016-07-18 12:19:31 -07:00
Nathan Burles ba5cf0060c vector::erase invalidates any iterators at/after the erase position 2016-07-18 13:52:45 +01:00
Tom Wieczorek 53f2a67b9d
Add an iterative version of the ParseTreeWalker 2016-07-10 15:54:23 +02:00
Nic30 22794aa2d8 fix liblib in library names 2016-07-07 12:48:33 +02:00
Nic30 1ceb6a45dd indent fix 2016-07-07 12:43:03 +02:00
Nic30 027dde5e3e LexerAction instances shared_ptr fix 2016-07-07 12:33:59 +02:00
Will Faught a05dea54ec Fix test case build errors 2016-07-06 09:02:42 -07:00
Eric Vergnaud 0fed0b0684 Following #1218, ensure consistency of ATNConfigSet hashing strategy in JavaScript 2016-06-28 10:45:05 +02:00
Chris Heller c4785ab8be Document cmake minimum version.
Document the minimum cmake version needed to build C++ target (if compiling with cmake).  Also, fix a missing space in cmake command between directory path and defining where the ANTLR .jar is located.
2016-06-26 15:28:26 -07:00
Mike Lischke 8046c28a5e A few more text escape calls in DefaultErrorStrategy.
And some cleanup.
2016-06-26 11:35:38 +02:00
Mike Lischke c462e03126 Merge branch 'master_upstream' 2016-06-26 11:12:23 +02:00
Mike Lischke 2352ff03e1 getSerializedATN() wasn't properly overwritten. 2016-06-26 11:10:31 +02:00
nuuman a2d6b62a1a Update DefaultErrorStrategy.cpp
Property escape vocabulary reporting
2016-06-25 21:06:53 +02:00
Eric Vergnaud 26c409103d Fix #1217
The root cause was that ATNConfigSet was not using he required custom hashing strategy for ParserATNSimulator.
The commit includes a number of additional fixes, related to code that was never executed before due to the root cause.
A similar issue is also likely to exist in the JavaScript runtime, I'll fix it later.
2016-06-23 15:51:39 +02:00
Eric Vergnaud c260ce75d1 make it possible to add breakpoint 2016-06-23 15:06:14 +02:00
Mike Lischke c8f80b167d Small naming fix. 2016-06-22 11:24:26 +02:00
Mike Lischke a127f34a74 Changed Win deployment script to produce 2 smaller zips instead of a big one. 2016-06-22 10:56:38 +02:00
Mike Lischke 1da7e8eea0 Fixed #include. 2016-06-21 16:28:44 +02:00
Mike Lischke a2f5cf12fd Fixed + simplified loading text to parse from a file.
- The previous approach to load and convert UTF-8 data via a stream didn't work well, so I replaced that with a simple load-to-buffer + convert buffer from UTF-8 to UTF-32.
- Removed deleted Token.cpp file from XCode project.
2016-06-21 16:23:28 +02:00