Commit Graph

6708 Commits

Author SHA1 Message Date
Ewan Mellor eb9124fff8
[Swift] Fix parse-cancellation in BailErrorStrategy.
BailErrorStrategy is supposed to throw an error that's different from
the ordinary recognition error, specifically so that it can be handled
differently by client code.  This was not ported over from Java correctly.

Fix this by moving parseCancellation from ANTLRError to ANTLRException,
adding its RecognitionException argument, and throwing it from the
two handlers in BailErrorStrategy.

Also remove ANTLRException.cannotInvokeStartRule, which is unused.
(The Java runtime uses it when ParseTreePatternMatcher throws a generic
exception, but we don't have that.)
2017-11-11 10:45:38 -08:00
parrt b4c34da1f0 Merge branch 'master' of github.com:antlr/antlr4 2017-11-05 08:49:04 -08:00
Terence Parr 676e6f4810
Merge pull request #2099 from ewanmellor/travis-swift-runtime-tests
Run the Swift runtime unit tests during the Travis run.
2017-11-04 12:17:44 -07:00
Terence Parr c1b7bf94f6
Merge pull request #2098 from jasonmoo/rule_context_methods_fix
Add RuleContext interface methods to reserved words
2017-11-04 12:17:13 -07:00
Ewan Mellor 376f7384c3
Run the Swift runtime unit tests during the Travis run.
These are the unit tests that are written in Swift, not the more
in-depth runtime-testsuite tests (we were always running those).

I don't know why JAVA_HOME isn't set during run-tests-swift.sh, but it
isn't.  Set it, since runtime/Swift/boot.py expects it as part of the
parser generation.
2017-11-04 11:41:20 -07:00
Terence Parr 0fd2098b6c
Merge pull request #2096 from ewanmellor/mvn-clean-swift
Include the Swift runtime in "mvn clean".
2017-11-04 10:51:42 -07:00
Terence Parr 58ddf07905
Merge pull request #2093 from ewanmellor/swift-lexer-init-required
Make CharStream.init(CharStream) required (in the Swift runtime).
2017-11-04 10:50:51 -07:00
Terence Parr 85aaf1b0d9
Merge pull request #2092 from ewanmellor/swift-fix-unbufferedcharstream
Fix UnbufferedCharStream in the Swift runtime.
2017-11-04 10:50:29 -07:00
Terence Parr 5809f71d0e
Merge pull request #2091 from ewanmellor/travis-cache-dotnet-osx
Add Travis-side caching of the dotnet package that we download from Microsoft
2017-11-04 10:50:00 -07:00
Terence Parr 21a38b3cea
Merge pull request #2086 from ewanmellor/message-output
Improve the "gnu" message format
2017-11-04 10:49:37 -07:00
Terence Parr 22842da4cb
Merge pull request #2085 from ewanmellor/fix-message-format-cmdline-option
Fix the -message-format command line option.
2017-11-04 10:48:39 -07:00
Terence Parr fe992fa69d
Merge pull request #2084 from ewanmellor/fix-outputdirectory-error-handling
Very minor fix in error handling path for the -o command line option.
2017-11-04 10:47:50 -07:00
Terence Parr 4bff008527
Merge pull request #2082 from ewanmellor/appveyor-cache
Add cache entries to appveyor.yml.
2017-11-04 10:47:06 -07:00
Terence Parr 1813da0166
Merge pull request #2079 from ewanmellor/travis-dont-cache-antlr
Remove ~/.m2/repository/org/antlr from the Travis cache.
2017-11-04 10:46:43 -07:00
parrt 56b01f309c Merge branch 'mike-lischke-output-path' 2017-11-04 10:34:38 -07:00
parrt 121e767409 fold in Mike Lischke's PR https://github.com/antlr/antlr4/pull/2065 to make the output directory exact if you use a new option `-Xexact-output-dir`. Fixes #1087, Fixes #753, Fixes #638. 2017-11-04 10:34:09 -07:00
parrt 5665502bf9 Merge branch 'output-path' of git://github.com/mike-lischke/antlr4 into mike-lischke-output-path 2017-11-04 09:48:12 -07:00
Terence Parr 1701d769d3
Update antlr-project-testing.md 2017-11-04 09:20:11 -07:00
Jason Mooberry dadc96c2ee Sign contributors.txt 2017-11-02 17:28:42 -04:00
Jason Mooberry ff2b6344b5 Exclude RuleContext interface methods from parse rule names to avoid rule/method name collision. Fixes #2080. 2017-11-02 17:19:22 -04:00
Ewan Mellor 0e0ad04f01
Include the Swift runtime in "mvn clean".
Add an entry to pom.xml so that the runtime/Swift subdirectories that contain
build output are removed when "mvn clean" is used.
2017-11-01 15:03:27 -07:00
Ewan Mellor afd4e0bc3f
Fix UnbufferedCharStream.
The call to stream.read needs to use buffer.count, not buffer.capacity,
as the maxLength.  Otherwise, some bytes get dropped on the floor and the
stream is corrupted.

Remove the code to pad self.data back to up to its previous capacity when
copying data at the end of release.  This came over from the Java port, but
I don't think it makes sense in Swift, given the copy-on-write Array
value semantics.  Instead, just copy the tail of the buffer if there is
anything left to read (i.e. self.data gets smaller) and when there is nothing
in the buffer to read, reset to the specified bufferSize (i.e. self.data
goes back to the specified self.bufferSize.

Remove debug print statement that was accidentally left in.
2017-10-31 15:14:34 -07:00
Ewan Mellor 5bb93813a0
Make CharStream.init(CharStream) required (in the Swift runtime).
This makes it possible for client code to use CharStream as a generic type
constraint and construct Lexer subclasses generically.
2017-10-31 14:44:43 -07:00
Terence Parr 64ae36b3e8
Merge pull request #2090 from gendalph/master
CMake build fixes for Visual Studio
2017-10-30 13:38:09 -07:00
gendalph aa143175c9 Fix destructor 2017-10-30 22:56:57 +03:00
gendalph 1a4f5770dd update CMAKE_POLICY CMP0026 NEW 2017-10-30 22:56:57 +03:00
gendalph 886e6b0ed2 CMake build fixes for Visual Studio
Remove unsupported cmd line options (gcc).
Disable warning for DLL.
2017-10-30 22:56:57 +03:00
Terence Parr d8996c74e3
Merge pull request #1930 from jm-mikkelsen/master
Rework C++ Runtime Interval, IntervalSet, ATN and ATNState
2017-10-29 15:57:06 -07:00
Jan Mikkelsen 3041b8e012 Style changes for main antlr4 codebase
- Add "explicit" to Interval(size_t, size_t) constructor.
- Change an IntervalSet constructor to delegate part of the construction

- Add "explicit" to Interval(size_t, size_t) constructor.
- Change an IntervalSet constructor to delegate part of the construction
2017-10-30 07:42:20 +11:00
Ewan Mellor 63d83a8bcc
Add a note to the documentation regarding -message-format gnu's suitability
for Xcode.

Mention use of -o while we're here.
2017-10-29 12:12:58 -07:00
Ewan Mellor 4729fe8285
Change the "gnu" message format.
Add the column to the location; this is something that GCC and other
GNU tools do, and is obviously useful for IDEs.

Move the message ID so that it reads e.g. "... [error 50]". This mimics
GCC's [-Wformat] kind of thing and is more obvious than the (50) that we
were using before.
2017-10-29 12:03:04 -07:00
Ewan Mellor 8f639f28dd
Put full filepaths in error messages when not using the default message format.
When the default "antlr" message format is used, ErrorManager deliberately
only includes the filename in any error message, not the full path, to
keep the messages short.  However, if the error message is intended to be
parsed by an IDE, this is no good.

Address this by printing the full path when using alternate message formats.
There are two formats available today -- "gnu" and "vs2005".  I think it's
reasonable to assume that people would use these for IDE compatibility, and
so using the full path for these is appropriate.  Also, they didn't work
until very recently, so this isn't breaking any existing behavior.
2017-10-29 12:03:04 -07:00
Ewan Mellor f2638b290d
Fix the -message-format command line option.
ErrorManager.setFormat was being called before the command line options
were parsed in handleArgs.  This meant that setFormat was always called
with the default, and so the command line option never took effect.

This option apparently only worked for 2.5 hours on Sep 6 2012 ;-)

Closes #992.
2017-10-29 11:58:16 -07:00
Ewan Mellor a465f777ea
Add cache entries to appveyor.yml.
These cache the Maven and nuget package directories.
2017-10-29 11:50:14 -07:00
Ewan Mellor c8c577c332
Very minor fix in error handling path for the -o command line option.
If the specified output path was a file and not a directory, the error
handling intended to invalidate outputDirectory, but due to an apparent
copy-paste error, it invalidated libDirectory instead.
2017-10-29 11:49:06 -07:00
Terence Parr 6693ba73a5
Merge pull request #2083 from gendalph/master
Updating contributors file.
2017-10-29 09:18:08 -07:00
gendalph bd5620381c Updating contributors file. 2017-10-29 12:33:36 +03:00
Ewan Mellor 026c6736dc
Add Travis-side caching of the dotnet package that we download from Microsoft.
This avoids hitting the Microsoft server every time.  The download isn't
super-reliable, so this should help with build reliability.

This extends the cache timeout, because the package is large and the
upload was timing out.
2017-10-28 14:32:33 -07:00
Ewan Mellor 6b504fee43
Remove ~/.m2/repository/org/antlr from the Travis cache.
Caching ~/.m2 is useful; caching org/antlr inside there is not.  It causes
unnecessary re-submission of the cache every build.
2017-10-28 14:26:34 -07:00
Jan Mikkelsen 0f6082eb15 Merge https://github.com/antlr/antlr4 2017-10-28 16:08:54 +11:00
Jan Mikkelsen 156ecb6c58 Revert "Remove byte order mark on utf8 files."
This reverts commit b106f8ee08.
2017-10-28 16:00:01 +11:00
Terence Parr 089550df8e
Merge pull request #1990 from milanaleksic/master
Allowing Go runtime compilation to succeed under ARM
2017-10-27 15:54:28 -07:00
Terence Parr 1f8c5bdf6a
Merge pull request #1951 from Griffon26/coverity_fixes
C++ runtime: Fix two issues found by coverity
2017-10-27 10:45:26 -07:00
Terence Parr 5008c32084
Merge branch 'master' into coverity_fixes 2017-10-27 10:45:18 -07:00
Terence Parr 1230aa08ef
Merge branch 'master' into coverity_fixes 2017-10-27 10:44:29 -07:00
Maurice van der Pot 73c17ffbd2 Updated contributors.txt 2017-10-27 19:42:26 +02:00
Terence Parr 0ff8c60a1f Merge pull request #2068 from JavaDDD/patch-2
getting-started.md
2017-10-27 08:29:26 -07:00
Terence Parr 2c3f0c9f0c Merge pull request #2067 from JavaDDD/patch-1
Update getting-started.md
2017-10-27 08:28:56 -07:00
Terence Parr bce47ca744 Merge pull request #2076 from ewanmellor/swift-retain-cycles
Fix retain cycles in the Swift runtime
2017-10-27 08:28:14 -07:00
Terence Parr 2bfaec72ee Merge pull request #2075 from ewanmellor/swift-unbufferedcharstream
Implement UnbufferedCharStream in the Swift runtime.
2017-10-27 08:27:45 -07:00