Commit Graph

4845 Commits

Author SHA1 Message Date
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 be2e71130a TestListeners C++ tests pass now.
- Needed a few adjustments in the test templates for this, which required to change target test templates for all other languages too.
2016-06-02 10:18:19 +02:00
Mike Lischke 28ccc4962b TestParseTrees passes now. 2016-06-01 15:20:11 +02:00
Mike Lischke 6bf1193839 All tests of TestLeftRecursion.java now pass.
- Fixed all disabled tests and enabled them.
- Some more adjustments of the test template + target template was needed.
- Worked on semicolon usage in Cpp.stg to avoid double semicolons. Might need more work, tho.
2016-06-01 12:08:13 +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
Mike Lischke 814a1821be TestParserErrors passes now.
Fixed a bug in the Cpp.stg file where more input was consumed than should be.
2016-05-30 16:27:12 +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
Mike Lischke a0665677c1 Lots of fine tuning to get more tests passing. 2016-05-27 22:38:42 +02:00
Mike Lischke 95b7f488a4 Merge branch 'master' into feature/addtests 2016-05-26 12:21:43 +02:00
Mike Lischke 27b76b5a33 Fixed token toString() so it produces the output expected by the tests. 2016-05-26 12:20:26 +02:00
Mike Lischke 657be5f1ac Fixed generation code for lexer tests. 2016-05-25 13:36:52 +02:00
David Sisson b1b8de748a Fixed a number of issues in the generated tests. Many more to go. 2016-05-24 19:17:50 -07:00
David Sisson bdc4f6a48f Merge branch 'feature/addtests' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-24 11:45:21 -07:00
David Sisson bebb63a126 Updated generation a bit. 2016-05-24 11:44:43 -07:00
Mike Lischke 89c01af247 Merge branch 'master' into feature/addtests 2016-05-24 17:40:29 +02: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
David Sisson 3e21e0b6e3 Regenerate all of the tests with the latest test generation template. 2016-05-24 08:30:50 -07:00
David Sisson b920bb7011 Added run support to the test runner. 2016-05-24 02:00:15 -07:00
David Sisson a3e89e56c5 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-24 01:51:18 -07:00
David Sisson e969299399 remove accidentally checked-in library file 2016-05-24 01:46:10 -07:00
David Sisson b3a17b00a2 Set up so we compile link all of the files in the test directory. Does not run the binary afterwards, but that's because there's still a print being generated somewhere (and I have no idea where it's coming from). 2016-05-24 01:44:17 -07:00
Mike Lischke 9e30f3f265 A few minor changes related to building via cmake. 2016-05-23 09:40:48 +02:00
Mike Lischke 7d69f24201 Small corrections to make the test module compile. 2016-05-22 19:15:36 +02:00
Mike Lischke 3da5b86000 Merge branch 'master' into feature/addtests 2016-05-22 17:16:33 +02:00
Mike Lischke be65ccd25c Moved the library build instructions to the library readme. 2016-05-22 11:18:16 +02:00
David Sisson c8e60b7fe0 Down to one issue -- tree::ParseTree and tree:RuleNode aren't related as they are in some tests. Need to find either the right relationship or come up with an alternative test. 2016-05-21 15:59:22 -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
David Sisson ae4dcbabbd properly escape templates 2016-05-20 22:15:48 -07:00
David Sisson 6aa03ed9a2 attempts compilation 2016-05-20 22:14:28 -07:00
David Sisson b0d5fed2cf Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-20 21:37:37 -07:00
Mike Lischke e6ebc5c36b Fixed demo compilation for Visual Studio 2013. 2016-05-19 17:33:25 +02:00
David Sisson e572d178b8 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-18 21:21:52 -07: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
David Sisson 1d6c66ec45 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-16 17:35:47 -07:00
David Sisson cc50675a66 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 2016-05-16 17:34:57 -07: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
David Sisson 33e3825dba Merge branch 'feature/addtests' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-14 10:56:34 -07:00
David Sisson 03024cb466 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-14 10:55:42 -07:00
David Sisson d95a0b664b Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 2016-05-14 10:55:07 -07: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 1cf3fafcde Merge branch 'master' into feature/addtests 2016-05-12 10:32:50 +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
David Sisson eb5760b872 Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests 2016-05-10 20:46:55 -07:00
David Sisson 33ba47b6a5 Merge commit '303684dd34095f2f569b6b635ddb3f6f43d116e8' into feature/addtests 2016-05-10 08:44:26 -07:00
Mike Lischke 23873b4a14 Fixed one more warning in VS. 2016-05-10 10:26:41 +02:00