Commit Graph

1928 Commits

Author SHA1 Message Date
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
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
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
Mike Lischke 8c62740f16 Missed to commit an XCode project change. 2016-06-21 10:53:36 +02:00
Mike Lischke d718fa9f44 Windows runtime deployment.
- Created deployment script for Windows + updated doc/releasing-antlr.md.
- Created projects for both VS2013 and VS2015 to be used by the deployment script.
- Fixed trouble with a bug in VS2015 where std::codecvt_utf8<char32_t> is not properly supported.
- Fixed a few #include paths + a number of warnings.
2016-06-21 10:51:31 +02:00
Mike Lischke 89442c6cb8 Changes for deployment.
- Settled on a final library name scheme: base part is "libantlr4-runtime" on MacOS + Linux. The extension determines the type (.a static lib, .dylib dynamic lib in MacOS, .so dynamic lib in Linux). No more mention of target language (cpp) or type (static) in the lib name. On Windows we omit the lib prefix, so the name becomes: antlr4-runtime.dll + antlr4-runtime.lib. We may later want to add version information there, but doing that automatically is difficult.
- Updated XCode project and CMakeLists.txt file for the new naming scheme.
- Added deployment scripts for source code (for Linux + iOS) and MacOS.
- Added C++ section in docs/releasing-antlr.md.
2016-06-19 15:31:09 +02:00
Peter Boyer 97bf8d63f8 TODO 2016-06-17 19:21:11 -04:00
Peter Boyer 6c717889b2 Make protected members package public 2016-06-17 19:19:04 -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
Mike Lischke 19dbd8e746 A fix for the Linux demo project. 2016-06-17 15:54:21 +02:00
Mike Lischke 3b5b400d03 A few fixes for the previous listener change.
Also fixed runtime tests again.
2016-06-17 11:27:52 +02:00
Mike Lischke 4a7ec859aa Simplified parse tree listener handling.
No need to use shared_ptr for management. Listeners are, like the other main classes (parser, lexer, input stream etc.) provided by the application and hence managed there.
2016-06-17 10:22:19 +02:00
Peter Boyer 29eaba44b0 Merge pull request #34 from willfaught/style-charstream-commontoken-dfa
Clean up Go runtime char stream, common token, and dfa code
2016-06-16 14:45:01 -04:00
Will Faught 3e621970f5 Clean up Go runtime char stream, common token, and dfa code 2016-06-16 11:15:49 -07:00
Mike Lischke dd48c0fbd5 A few final touches to make runtime tests passing. 2016-06-16 11:20:42 +02:00
Mike Lischke e68cdc3c0e A few of the previously reverted changes are still good. 2016-06-15 13:46:27 +02:00
Mike Lischke 4a8010b4eb Revert "A few more places that no longer pass a shared_ptr around."
This reverts commit 728af59528.
2016-06-15 13:30:37 +02:00
Will Faught 538455eae6 ATN runtime format, style, and comment cleanup 2016-06-14 15:09:42 -07:00
Mike Lischke 728af59528 A few more places that no longer pass a shared_ptr around. 2016-06-14 15:17:23 +02:00
Mike Lischke dcb0d4aa62 Some cleanup. 2016-06-14 14:05:18 +02:00
Mike Lischke 7ac5252fe9 Explicitly delete copy c-tor + copy operator to for Visual Studio.
VS requires to have copy operations disabled on classes which hold vectors of unique pointers (clang is a bit more relaxed about this).
2016-06-13 17:38:57 +02:00
Mike Lischke 7488621983 Visual Studio build fix. 2016-06-13 16:47:32 +02:00
Mike Lischke b9c28d8c9c Signficantly simplified Token handling.
In order to lower the overhead when passing around Token instances via smart pointers and because the ownership is clear (token streams own them), these instances can be passed as raw pointers.
2016-06-13 13:12:02 +02:00
Mike Lischke 23eeae4b44 Simplification of the ATN config lookup handling.
No need for the ConfigLookup(Impl) class as we only need a way to determine if a config has been added to a set or not. This can be done much simpler by using individual hash codes produced by either ATNConfigSet or OrderedATNConfigSet (idea taken from C# runtime).
2016-06-12 16:08:16 +02:00
Mike Lischke c920d57331 DFA states member is now a set (instead of a map). 2016-06-11 12:57:29 +02:00
Mike Lischke e9d2a04be1 Removed shared_ptr instances for ATNConfigSet.
ATNConfigSet instance follow a clear ownership (all owned by DFAState instances, which stay alive all time). Hence we can use a unique_ptr for memory management instead and pass raw pointers around where needed.
2016-06-10 16:13:15 +02:00
Mike Lischke fec23ce989 Simplified equality check in ATNConfigSet. 2016-06-10 14:58:22 +02:00
Mike Lischke b8fcb5f30d More performance increase for C++ target (25% now).
All shared_ptr<> now use const& for function parameters to avoid constant copies + locks. Ownership and lifetime control is still ensured by the owning containers. Code templates have been updated as well.
2016-06-09 12:02:30 +02:00
Mike Lischke 1cbbc1b760 Merge branch 'antlr-upstream' 2016-06-07 17:44:53 +02:00
Mike Lischke 3a95a36e3f 12% speed improvement for C++ runtime. 2016-06-07 16:27:25 +02:00
Mike Lischke 963f4fc507 ... and for Linux the same. 2016-06-06 16:15:30 +02:00
Mike Lischke b90398f8a6 A few fixes for Visual Studio after added the xpath stuff. 2016-06-06 16:13:38 +02:00
Mike Lischke ff129beadf Some smaller fixes for Windows. 2016-06-06 15:58:14 +02:00
Mike Lischke a4bc611fd5 Changed namespaces + fixed runtime tests.
- Changed namespace chain (org::antlr::v4::runtime) to just antlr4 in all files.
- Fixed runtime tests for that.
- Added conversion of the xpath code, which compiles now (no tests, tho, as there are runtime tests for it).
- Removed TestRig stuff. That doesn't work in C++.
2016-06-06 15:55:27 +02:00
Mike Lischke 4a6b68c6f6 All C++ runtime tests pass now.
- A few remaining changes had to be done for the C++ runtime tests which now completely pass.
- Added a runtime testing overview document.
- Added a description of C++ target.
- Updated the ANTLR release document.
2016-06-04 12:11:38 +02:00
Mike Lischke ac664a91b8 A few more fixes. 2016-06-02 17:32:19 +02:00
Mike Lischke b7ade0ade1 TestParseTrees + TestSemPredEvalLexer C++ test groups pass now. 2016-06-02 12:22:24 +02:00
Mike Lischke 28ccc4962b TestParseTrees passes now. 2016-06-01 15:20:11 +02:00
Mike Lischke 86014ac3a6 TestParserExec tests pass now.
- A few more adjustments to make this test group pass.
- Fixed a few issues in C++ runtime as well.
2016-06-01 10:22:48 +02:00
Wolfgang Johannes Kohnen 950acca7c0 Sort values of BitSet.
* Fixes pboyer/antlr4#16
2016-05-31 17:13:01 +02:00
Mike Lischke 08f844af0e Fixed 2 problems found by runtime tests.
- TestLexerExce group passes now.
- Reverted wrong removal of action text output that prevent named actions from showing up properly.
2016-05-29 16:47:51 +02:00
Mike Lischke 815bb95982 TestLeftRecursion passes, but with some disabled tests.
There are a number of disabled tests that need extra work (all because of target specific action code).
2016-05-29 12:17:29 +02:00
Wolfgang Johannes Kohnen 4fd4e51810 runtime-testsuite/go: Make path construction slightly more robust.
* also piggy back a typo fix.
2016-05-28 11:15:14 +02:00
Mike Lischke a0665677c1 Lots of fine tuning to get more tests passing. 2016-05-27 22:38:42 +02:00
Peter Boyer 6ddc7c9d4f Merge pull request #9 from willfaught/master
Test fixes
2016-05-27 15:33:29 -04:00
Wolfgang Johannes Kohnen 0b0d202c49 runtime/Go semantic context: NewAND, NewOR create empty operands 2016-05-27 18:14:18 +02:00
Will Faught 92793a9dc8 Rename "this" receiver to "t" 2016-05-26 23:28:27 -07:00
Will Faught 10eb1a1970 Rename Lexer.mode to setMode
Also minor formatting.
2016-05-26 23:27:45 -07:00
Will Faught 1208f97696 Rename Go files back to snake case 2016-05-26 12:00:40 -07:00
Will Faught b503116e12 Move runtime/Go/src/antlr to runtime/Go/antlr 2016-05-26 11:51:28 -07:00
Will Faught fe1d61d9db Merging 2016-05-26 11:40:02 -07:00
Will Faught 103dc662c4 Fix "misMatched" 2016-05-26 11:35:49 -07:00
Will Faught 08c17b850e Rename Go files back to camel case 2016-05-26 11:32:45 -07:00
Will Faught bf88d2747c Move runtime/Go/antlr to runtime/Go/src/antlr 2016-05-26 11:26:03 -07:00
Mike Lischke 27b76b5a33 Fixed token toString() so it produces the output expected by the tests. 2016-05-26 12:20:26 +02:00
Will Faught 7080d04662 Export LL1Analyzer.look 2016-05-25 20:16:22 -07:00
Peter Boyer ed5b4d14f7 antlr4 -> antlr 2016-05-25 17:20:16 -04:00
Mike Lischke f103e05bc3 Some additions for better operation.
- Allow loading new input instead of setting up a new input stream.
- Made is<> template function inline, for hopefully faster execution.
- A few other fixes in stream + lexer classes.

- Reverted another rename from context to _localctx in the Cpp.stg file as this is used for certain actions.
2016-05-24 17:39:21 +02:00
Wolfgang Johannes Kohnen 7652b9af79 Go runtime: Change misMatched to mismatched.
That seemed to be a find/replace accident. Apparently this change turns
the tests ...

 * testTokenMismatch
 * testTokenMismatch2
 * testNoViableAltAvoidance
 * testNoViableAlt
 * testExprAmbiguity_2

... to green. Although I am not sure about testExprAmbiguity_2 as that
one doesn't have mis[Mm]atched in its output AFAICS.
2016-05-23 11:26:34 +02:00
Mike Lischke 9e30f3f265 A few minor changes related to building via cmake. 2016-05-23 09:40:48 +02:00
Mike Lischke be65ccd25c Moved the library build instructions to the library readme. 2016-05-22 11:18:16 +02:00
Will Faught 90ac6c0f63 Change "a" back to "this" in comment 2016-05-21 17:08:48 -07:00
Mike Lischke aafc76a7eb Fixed big memory consumption problem.
- The ATN simular generated lots of duplicate DFAStates that consumed a lot of memory, due to missing hashing/== functionality. By using an own hasher/comparer for the unordered_map in the DFA this problem could be solved. Memory consumption is now 100% stable on a low level (e.g. 115MB for a fairly complex parser) and doesn't increase anymore after the warmup phase.
- Fixed also a number of things reported by the clang static analyzer.
- Fixed a bug in Parser.cpp where the stop token in the current context would be set twice overriding a previously set value.
- Optimized token range check via ATN::nextTokens, by not duplicating the stored interval set for a given state.
- Slightly improved IntervalSet::contains() by moving some tests out of the loop and not using intermediate variables.
2016-05-21 16:55:11 +02:00
Will Faught b4da149732 Lint: Remove underscores from names 2016-05-21 01:02:49 -07:00
Will Faught 71dba8cb91 Lint: Change all caps "LOOK" in names to camel case 2016-05-21 00:27:51 -07:00
Will Faught 29b6530a2b Lint: Omit redundant declaration types 2016-05-21 00:22:54 -07:00
Will Faught 5c4e28487e Lint: Replace -= 1 with -- 2016-05-21 00:22:54 -07:00
Will Faught c81f2a7901 Lint: Drop nil declaration assignments 2016-05-21 00:18:15 -07:00
Will Faught 056f3f62c1 Lint: Rename initialisms to uppercase 2016-05-21 00:13:27 -07:00
Will Faught 26df617532 Lint: Outdent else blocks for if blocks that return 2016-05-21 00:05:40 -07:00
Will Faught 33fd68778e Lint: Replace += 1 with ++ 2016-05-20 23:44:36 -07:00
Will Faught 9ed1ed1003 Lint: Use uniform receiver names 2016-05-20 23:41:06 -07:00
Will Faught 8a1b68feb4 Lint: Omit unused second range var 2016-05-20 23:27:24 -07:00
Will Faught 3b742ed8cb Lint: Rename generic "this" var 2016-05-20 23:25:05 -07:00
Will Faught 5361aedc0b Vet 2016-05-20 18:52:08 -07:00
Will Faught 21fa2d1310 Format 2016-05-20 18:52:08 -07:00
Will Faught baaf1fe72f Rename files to snake case 2016-05-20 18:52:02 -07:00
Will Faught 519277f78f Rename package antlr4 to antlr 2016-05-20 17:34:38 -07:00
Will Faught bff76c3e5a Move runtime/Go/LICENSE.txt to antlr 2016-05-20 17:34:04 -07:00
Will Faught 4200fc7c14 Delete unneeded README.md 2016-05-20 17:33:32 -07:00
Will Faught db5a5c5c17 Move runtime/Go/src/antlr4 to runtime/Go/antlr 2016-05-20 17:33:07 -07:00
Peter Boyer 3406acabe5 Correct nil check in ParserATNSimulator 2016-05-20 10:33:39 -04:00
Mike Lischke e6ebc5c36b Fixed demo compilation for Visual Studio 2013. 2016-05-19 17:33:25 +02:00
Mike Lischke e2d545fb2e Changed exception object back in error reporting + removed precompiled headers with cmake.
- Reverted the change from RecognitionException to exception_ptr (and removed the make_exception_ptr() call). This is not needed and only leads to object slicing. Instead we check directly the given exception object for the individual handling in reportError() and use std::current_exception() to get the exception pointer for our contexts.
- Removed precompiled header stuff from cmake file for the same reasons as I did in the XCode project (Visual Studio still pending).
2016-05-18 18:16:08 +02:00
Mike Lischke 0617dfff54 Rework of the include structure.
In order to ease including the antlr runtime in other projects the include structure has been changed:

- Removed precompiled header usage (only OSX, VS + cmake still need updates).
- Created umbrella header antlr4-runtime.h that contains everything needed in a target application.
- Changed all includes to use relative paths, so it is enough to add the src folder to the header search path in an application.

- Also fixed a smaller issue in the C++ template wrt the serialized ATN storage for large grammars.
2016-05-15 18:37:56 +02:00
Mike Lischke 2cbed81504 Further work to have full Unicode support.
- The upper char limit in Lexer.h was wrong. Now correctly set to 10FFFF.
- The lexer ATN simulator now uses lower + upper limit of char32_t instead of hardcoded values.
- Added a little hack to Interval, where a range ending with 0xFFFF will automatically be extended to 0x10FFFF. This is necessary until ANTLR generates full Unicode intervals. This hack allows to include Unicode chars beyond the BMP in char classes in a lexer.
- Fixed an error display issue in Lexer.
2016-05-14 15:57:37 +02:00
Mike Lischke 66a9ee53a0 The generation + runtime now uses std::string instead of std::wstring almost everywhere.
- In order to support UTF-8 the input streams now support loading data from UTF-8 strings and convert them internally to UTF32.
- Additionally, all the toString() functions that (unnecessarily) used wstring are now on string as well. Only some corner cases remain where we still have std::wstring (ATNSerializer).
- The transition classes use size_t instead of int now for vocabulary matching.
- The max char value in the lexer has been increased to 1FFFE, to allow matching the full Unicode range. This is also used in the Interval class to e.g. to negate sets.
- Renamed Strings.h to StringUtils.h, to avoid a conflict with an OSX header (used with Obj-C compilation, e.g. in a project that uses the runtime).
2016-05-13 18:19:12 +02:00
Mike Lischke 0eebbdd78c Updated VS solution with newly added files. 2016-05-12 13:36:27 +02:00
Mike Lischke 75bb338882 Added 2 newer support classes to the runtime.
With those 2 classes the port of the C++ runtime is essentially complete. We now do only bug fixing.
2016-05-12 13:32:10 +02:00
Mike Lischke 313c971cae Bug fixes + update C++ template.
- Also the ArrayPredictionContext has parent references (like the SingletonPredictionContext) which need to be strong refs or we may lose some of the parent contexts if they are not held somewhere else.
- Don't use WCHAR_MIN as lower bounds for char input checks, it's not 0 as you would expect but -2G, making so EOF succeed even though it should fail this check.
- Don't resize the parents array when merging parents + return states in PredictionContext or we will try to access parents outside of the available range.
- Use an unordered set when merging parents in PredictionContext, so that the normal equality pattern kicks in when comparing contexts.
- Some parameters in AbstractParseTreeVisitor where wrongly outcommented where only the param name should.

C++ template:
- No longer include the DEFAULT_MODE in the generated lexer (it's defined elsewhere).
- Corrected formatting and finished some reference rules that were not done yet.
2016-05-12 10:30:40 +02:00
Mike Lischke 23873b4a14 Fixed one more warning in VS. 2016-05-10 10:26:41 +02:00
Mike Lischke d8442c0bf6 Update VS solution (removed deleted file references). 2016-05-10 10:25:06 +02:00
Mike Lischke fda0210b50 Some updates to demo grammar, Cpp.stg and XCode projects.
- Reversed the meaning of grammar sections members + declarations to maintain the same meaning for members between C++ and Java target. Now members are placed in the public section of a class, while declarations use the private section. This change helps to minimize language specific parts in grammar actions.
- Removed deleted cpp files from XCode project.
- Cpp.stg:
  - Renamed all occurences of "result" back to "_localctx" as they appear in the Java.stg file. While the name "result" better fits the purpose the rename increases differences between targets, hence it was taken back, so we can use the same actions in all targets.
  - TokenPropertyRef_text is now complete.
2016-05-10 10:14:40 +02:00
Marcin Szalowicz 5653be36fa Runtime Cpp: disable warnings and remove unnecessary files
Signed-off-by: Mike Lischke <mike@lischke-online.de>
2016-05-09 15:24:03 +02:00
Mike Lischke 0835c52a67 Moved Marcin to Other Contributors list. 2016-05-09 15:06:08 +02:00
Mike Lischke 13b135f4e8 VS warns about /* */ comments if the are directly after a *. 2016-05-09 14:53:41 +02:00
Mike Lischke faddb83fe5 Enabled unused-parameter warning in XCode and fixed all occurences.
Some warnings in generated files cannot be fixed in a general way because usage of parameters depends on the grammar, hence we suppress unused-parameter warnings in the grammar (for lexer and parser files).
2016-05-09 14:51:46 +02:00
Mike Lischke 337f0467a8 Added yet another possible code section + EOF rework.
- @parser::context or @lexer::context are now also accepted for code that should be placed directly before the class declaration (e.g. additional types, like enums etc.)
- Reverted the removal of explicit EOF handling. Thought we can just live with the EOF macro, but that doesn't work out, so we go with the same approach as the ANTLR3 C target: #undef EOF and use EOF member constants as in the original Java code.
- Fixed a crash when trying to create a hash from a null parent in PredictionContext.cpp.
- Generated token and rule enums are now placed in the lexer/parser classes which allows to use them without qualfication within those classes, making so actions in a grammar more language independent. Outside code still has to use e.g. TParser::ID to access them.
- Made some lambda capture lists more explicit. Need to test yet if we can just use a default capture instead.
2016-05-09 14:09:00 +02:00
Mike Lischke 303684dd34 Removed jar that should not have been in the repository. 2016-05-06 17:16:06 +02:00
Mike Lischke 6c21223d2e Added cmake target (Linux + OSX) + fixed a number of warnings.
- Compiling with cmake brought up quite a number of new warnings. Some of them have to be disabled yet (dollar in identifier, four char constant, overloaded virtual). The others have all been fixed.
- Updated the README to include build instruction.
2016-05-06 16:48:59 +02:00
Renata Hodovan 4e3325c9da Fix initialization of ATNConfig when computing SLL prediction
termination condition.

The PredictionMode::hasSLLConflictTerminatingPrediction method aims to
create ATNConfig objects from another ATNConfig and SemanticContext
objects. In case of the Python targets, the initialization
happened without keyword arguments. Since the called __init__
method had default values set for all the parameters, the parameter
substitution worked by indices. As a consequence, the first ATNConfig
parameter was wrongly interpreted as an ATNState and the SemanticContext as
an alternative. The patch fixes this by adding the missing keywords.
2016-05-06 15:59:55 +02:00
Mike Lischke 297f00350c Added more supported grammar sections (named actions).
C++ target:
- More sections are now supported: pre + post include, declarations, definitions (in addition to header and members).
- Added specific variants of these sections for (base)listener + (base)visitor files (baselistenerpreinclude etc.).

Had to add named sections to VisitorFile.java + ListenerFile.java.
Also added the new namedActions parameter to all target stg files where needed.
2016-05-06 12:22:08 +02:00
Mike Lischke f30aa125a5 Updated VS solution after project restructuring. 2016-05-05 13:33:28 +02:00
Mike Lischke 6ac56de5f1 Updated OSX demo project after structure changes. 2016-05-05 13:14:01 +02:00
Mike Lischke a44741a73d No need for public headers in an OSX dylib. 2016-05-05 13:07:24 +02:00
Mike Lischke 5780755196 Reorganized runtime folder structure + created ios target in XCode.
The runtime folder now contains the individual project files for each platform (and associated files/folders). The actual source code moved down one level to folder src.
2016-05-05 13:06:17 +02:00
Mike Lischke a83849a0c4 Missing parts from the previous commit. 2016-05-05 11:50:20 +02:00
Mike Lischke bfe3a7cc63 Renamed XCode demo project and set install name for dylib.
The default install name is /usr/libs/antlrcpp.dylib which makes running the demo from command line not working (location and install name of the dylib differ). Since the probability that the lib is placed in an app bundle is much higher than that the lib is being installed in the system, the default has been changed to just the dylib name. This can be changed to anything else if needed in a concrete project.
2016-05-05 11:45:49 +02:00
Mike Lischke 6939b7f92c Split XCode demo + libraries into individual projects.
In order to allow building the OSX libraries without the demo project they have been split into 2.
2016-05-05 11:12:51 +02:00
Mike Lischke dd43278406 Linux + Mac build fixes.
- Updated XCode project (removed obsolete cpp files refs).
- Set channel datatype in lexer + tokens to size_t.
- Removed one unit test that no longer works, now that we require all objects in a vector given to murmur hash code computation to support the hashCode() function.
2016-05-05 10:17:12 +02:00
Mike Lischke 8ff852640a Updated Windows project to be compilable as both static and dynamic lib.
Removed a few unneeded cpp files on the way.

Note: building as DLL produces many of the well known compiler warnings C4251 (type needs to have a DLL interface ..) because the runtime uses many STL classes in exported classes. I tried exporting all those types via explicit template instantion, but once I hit unordered_map I gave up. Just crazy what you have to export just to make this map export properly (and I already had like 50 exports already in place). So at the end I disabled this warning on project level. So make sure you build this DLL and all binaries using it with exact the same compiler and linker settings (same C++ runtime etc.).
2016-05-04 19:04:33 +02:00
Mike Lischke aa88e7bc30 A bit more complex expression in demo parser.
Forgot to commit that with the last changeset.
2016-05-03 18:13:20 +02:00
Mike Lischke d98f3f7934 Fixed a number of subtle bugs that broke parsing.
Things start looking very promising now. We are ready for runtime tests.
2016-05-03 18:12:04 +02:00