Commit Graph

4776 Commits

Author SHA1 Message Date
David Sisson bebb63a126 Updated generation a bit. 2016-05-24 11:44:43 -07: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
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
David Sisson 9920efd353 More updates to the C++ test runner. 2016-05-09 21:45:14 -07:00
David Sisson db6f3c983d Added the start of linker support. 2016-05-09 20:53:33 -07: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
David Sisson a212755734 Cleaned up the test runner. 2016-05-08 21:27:40 -07:00
David Sisson cbe9c2f1f7 Returned other tests to active duty. 2016-05-06 20:19:48 -07:00
David Sisson eddf2a1b36 updating BaseCppTest.java 2016-05-06 20:07:40 -07:00
David Sisson b976a4942d fix which tests to run for cpp 2016-05-06 19:48:57 -07:00
David Sisson 358bde8844 Updated runtime tests with updated generation templates. 2016-05-06 19:33:13 -07:00
Mike Lischke 303684dd34 Removed jar that should not have been in the repository. 2016-05-06 17:16:06 +02:00
Mike Lischke ce1e72b9a1 Merge branch 'feature/templates-org' 2016-05-06 17:01: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