Commit Graph

2832 Commits

Author SHA1 Message Date
Terence Parr 5f4b9b49da Merge pull request #2074 from ewanmellor/swift-intervalset-exceptions
Tidy up the exception behavior around IntervalSet and ATNConfigSet.
2017-10-27 08:27:09 -07:00
Ewan Mellor bb3f7e2c14
Make it possible for RecognitionException to release the parser and
token stream that triggered the error.

These are useful for error diagnostics, but if client code wants to throw
the RecognitionException but discard the parser and token stream, then
the fields in RecognitionException need to be cleared.

This adds RecognitionException.{clearRecognizer,clearInputStream} so that
client code can clear those fields if desired.  It also makes
RecognitionException.ctx weak, so it will go nil at the same time as
the parser is discarded.
2017-10-25 13:31:43 -07:00
Ewan Mellor cf011b57ee
Fix a retain cycle between a Token and the TokenSource that it came from.
This was causing all the tokens, streams, and lexers to be retained.  The
primary cycle was because of the backreference at CommonToken.source, and
the fact that the token streams buffer the tokens that they create.

Fix this by replacing the use of a (TokenSource?, CharStream?) pair with
TokenSourceAndStream, which does the same job but references its fields
weakly.  This means that Token.getTokenSource() and Token.getInputStream()
will return valid values as long as you retain the lexer / stream elsewhere,
but a Token won't itself retain those things.
2017-10-25 13:31:43 -07:00
Ewan Mellor 555c14956a
Fix retain cycle between Parser and ParserATNSimulator.
This was causing the entire parser to be retained, resulting in a large
memory leak.

This fix simply changes the reference from ParserATNSimulator to Parser
to be unowned.

Ditto between Lexer and LexerATNSimulator, except this reference is made
weak because LexerATNSimulator.recog is nullable.  (That difference is
dubious IMHO, but I'm leaving it intact for now.)
2017-10-25 13:31:43 -07:00
Ewan Mellor d0c9744305
Fix a retain cycle through TerminalNodeImpl.parent.
This refers back up the parse tree, and meant that the
whole tree was leaked.  Fix this by making the parent field weak.
2017-10-25 13:31:43 -07:00
Ewan Mellor 5885d54c25
Fix a retain cycle through RuleContext.parent.
This refers back up the tree of RuleContext instances, and meant that the
whole tree was leaked.  Fix this by making the parent field weak.
2017-10-25 13:31:43 -07:00
Ewan Mellor 64048caf12
Implement UnbufferedCharStream in the Swift runtime.
This is a port of the equivalent code in the Java runtime.

This required a change to the CharStream interface: getText was documented
as throwing exceptions, but it wasn't actually declared as such.  The
UnbufferedCharStream.getText implementation throws exceptions (in order to
match the semantics of the Java implementation), so this declaration is now
needed, and callsites need to be adjusted appropriately.
2017-10-25 13:31:19 -07:00
Ewan Mellor 7dd4017f41
Tidy up the exception behavior around IntervalSet and ATNConfigSet.
These classes throw exceptions if the instance is read-only, and only in
that case.  This means that there is no need for us to propagate exception
declarations in the cases where we have guaranteed by construction
that the instance is writable.  In particular, this means that IntervalSet
and ATNConfigSet's constructors won't throw exceptions(!)  The set options
that return a new set (e.g. complement) no longer throw either.

To help with this, this cset adds BitSet.firstSetBit().  This is equivalent
to BitSet.nextSetBit(0), but is guaranteed not to throw an exception.

As a consequence, ANTLRErrorListener / DiagnosticErrorListener no longer
throw exceptions through any of their functions (syntaxError and report*),
and DefaultErrorStrategy can no longer throw exceptions as part of its
internal operations (though of course it can still throw exceptions if
recovery fails and a real parsing error needs to be reported).
Also, LL1Analyzer no longer throws exceptions at all, and so ATN.nextTokens
doesn't throw either.
2017-10-25 13:30:40 -07:00
Ewan Mellor fbe8c0d2a6
Tidy up the exception handling around RecognitionException.
This removes the generic parameter on RecognitionException, to make it
easier to handle them.  This means that we no longer need to store them as
AnyObject and cast them back again.  To do this, we add RecognizerProtocol,
which is a non-generic equivalent of the Recognizer interface (at least, the
parts of it that we need for error handling).

Remove all paths where the RecognitionException subclasses were throwing
exceptions in their initializers.  This is just insane.
2017-10-25 13:30:08 -07:00
Ewan Mellor 7e03b0857a
Remove Utils.RuntimeException.
This was doing nothing for us that we couldn't already get with fatalError,
so it was just cluttering things.
2017-10-25 13:28:40 -07:00
Ewan Mellor 6c11160b51
Remove tokenNames / getTokenNames from the Recognizer interface.
This has been ported over from the Java code, but it was deprecated there.
There's no point having it in the Swift runtime because we don't have the
legacy code to support.  Also, it wasn't implemented properly, so it
never worked.

Remove {DFA,IntervalSet}.toString(_:[String?]?)
and the inits in ParserInterpreter and DFASerializer for the same reason.
Switch the unit tests to use the alternate toString(_:Vocabulary).
2017-10-25 13:28:40 -07:00
Ewan Mellor 23f532ddbd
Minor tidyups in the Swift runtime.
This fixes some hangovers from the port from Java:
* unnecessary type annotations;
* failure to use "if let" for nil checks;
* comments with Java code in them;
* a couple of fields that should have been declared private;
* some whitespace issues.

No semantic change.
2017-10-25 13:28:40 -07:00
Ewan Mellor f41316f934
Remove some stub functions from ATNSimulator.
These were ported over from the Java runtime, but they were all deprecated
there, and were commented as such here.  There is no point having them in
the Swift runtime because we don't have legacy code to support.
2017-10-25 13:28:40 -07:00
Ewan Mellor 8c03ef3138
Remove unused Utils.{readFile2String,readFile2StringByPath,writeFile}. 2017-10-25 13:28:39 -07:00
Ewan Mellor 5a99f1f7a8
Remove unused generic type parameter on UnbufferedTokenStream. 2017-10-25 13:28:38 -07:00
parrt aaa4250328 Fixes #2069 to catch env var security exception 2017-10-23 14:40:13 -07:00
Mike Lischke 16242e43c0 Merge branch 'master' into interpreter2 2017-10-22 13:48:10 +02:00
Ewan Mellor 70db334a58
Improve MurmurHash in a number of ways:
Use Swift's overflowing operators rather than multipliedReportingOverflow
etc.

Use UInt32 for the hash values.  This matches how MurmurHash3 is generally
defined (e.g. on Wikipedia).

Add support for decoding Strings (UTF-8, then little-endian) and hashing
the resultant UInt32 values.

Add a test set, using test patterns from Ian Boyd (public domain).
2017-10-21 15:23:27 -07:00
Terence Parr 98745bbdf8 Merge branch 'master' into master 2017-10-21 13:18:11 -07:00
Terence Parr b8fd54780a Merge pull request #1974 from matthauck/cmake-windows
Add MSVC support to c++ cmake build
2017-10-21 13:16:23 -07:00
Terence Parr db5a0aeaf2 Merge pull request #1955 from sharwell/fix-closurebusy
Avoid adding to closureBusy before all ATNConfig properties are set
2017-10-21 13:13:48 -07:00
Terence Parr 593b49fa3d Merge pull request #1983 from shirou/master
[Go] Add CommonTokenStream test.
2017-10-21 13:00:02 -07:00
Terence Parr 8a551095dc Merge branch 'master' into export-lexer-methods 2017-10-21 12:58:22 -07:00
Terence Parr 0839970e00 Revert "CMake build fixes for Visual Studio" 2017-10-21 12:55:16 -07:00
Terence Parr fa72e72de0 Merge pull request #2011 from gendalph/master
CMake build fixes for Visual Studio
2017-10-21 12:53:53 -07:00
Hanzhou Shi 0dce38109c Update boot.py and swift-target.md to reflect Swift 4 migration changes. 2017-10-21 12:44:44 -07:00
Terence Parr c9c7561701 Merge pull request #2032 from ewanmellor/swift-4
Migrate the Swift runtime to Swift 4.
2017-10-21 12:26:29 -07:00
Terence Parr 38aaf88097 Revert "[Go] Interval" 2017-10-21 12:00:25 -07:00
Terence Parr 24c149603d Merge pull request #1978 from neatnerd/go-target
[Go] Interval
2017-10-21 09:38:00 -07:00
Terence Parr 1985fede5d Merge pull request #2052 from ewanmellor/swift-remove-nullPointer
Remove ANTLRError.nullPointer from the Swift runtime.
2017-10-21 09:19:54 -07:00
Ewan Mellor 7aa6b544d9
Redo Package.swift for Swift Package Manager 4.0. 2017-10-20 10:12:47 -07:00
Ewan Mellor 8a292c0f4f
Migrate the Swift runtime to Swift 4.
Remove a number of generic type constraints, since these can now
be inferred by the compiler.

Match the syntax change when passing a tuple into a function (adding
an extra set of parens).

Change filterPrecedencePredicates to avoid a now-illegal cast.

Match the renames truncatingBitPattern -> truncatingIfNeeded,
multiplyWithOverflow -> multipliedReportingOverflow, etc.  In
some cases the multiplyWithOverflow calls are replaced by
overflowing operators (e.g. &*) instead.
2017-10-20 10:12:46 -07:00
Ewan Mellor 365d4f40bb
Refactor to avoid forced casts. 2017-10-20 10:12:46 -07:00
Ewan Mellor 4bafc74e6c
Remove unused functions from StringExtension.
Some of these are subject to change for Swift 4, but since they are unused
we should remove them anyway.
2017-10-20 10:12:46 -07:00
Ewan Mellor 8ba2c0ba4f
Add entries to .gitignore for the files that are generated by
Swift Package Manager.
2017-10-20 10:12:46 -07:00
Arshinskiy Mike 5297bf2697 Modified open interval logic
Added tests
2017-10-14 20:31:38 +02:00
Arshinskiy Mike d297c9ddda added initial tests for interval set 2017-10-14 15:15:41 +02:00
Terence Parr 7d2a0978b5 Merge branch 'master' into fix-unicode-2031 2017-10-12 09:38:16 -07:00
Ewan Mellor 5df3b2bbdf
Remove ANTLRError.nullPointer from the Swift runtime.
This was copied from the API of the equivalent code in Java when
the runtime was ported to Swift.  It is meaningless in Swift, and
was unused.
2017-10-12 00:52:44 -07:00
Terence Parr c861e09d39 Merge pull request #1977 from nielsbasjes/EmptyGetText
Fixed empty CodePointCharStream throwing exception on getText.
2017-10-10 12:47:00 -07:00
Terence Parr cb558ccb48 Merge pull request #1954 from kosak/no-attribute-on-enum-class
Remove the useless visibility attribute from this "enum class" declaration
2017-10-10 12:40:31 -07:00
Terence Parr a308cd5d8d Merge branch 'master' into ignore-cmake-policy-0054 2017-10-10 12:36:01 -07:00
Eric Vergnaud 44031b544d fix #2031 2017-09-30 17:07:40 +08:00
Ewan Mellor 99d32dc861
Add some version numbers to pom.xml.
This silences warnings from Maven.
2017-09-28 16:10:26 -07:00
Terence Parr e6d60007e7 Merge pull request #1956 from renatahodovan/syntax-errors
Python: add public getter to parsers to access syntax error count.
2017-09-17 11:20:56 -07:00
Terence Parr f86835928f Merge branch 'master' into master 2017-09-17 11:20:10 -07:00
Terence Parr 8f50bd0df6 Merge branch 'master' into master 2017-09-17 11:17:14 -07:00
Robert Jacobson 8f30ae6610 Import RuleContext into the antlr4 module namespace. See Issue #2012. 2017-09-16 16:16:01 -04:00
gendalph 50d2d3ef55 CMake build fixes for Visual Studio
Remove unsupported cmd line options (gcc).
Disable warning for DLL.
2017-09-12 22:10:59 +03:00
Eddy Reyes 168ac02b22 Export lexer method GetAllTokens 2017-08-29 19:11:36 -05:00
Eddy Reyes 2423359b28 Export Lexer methods
- They can be called in target-specific grammar actions, therefore must
  be exported.
- Their Java analogues are public methods.
2017-08-22 23:37:26 -05:00
Milan Aleksić 3beb771882 Fixed #1858: replacing implicit type with uint
This fix allows compilation and execution under ARM architecture, since default type couldn't handle all possible values
2017-08-21 13:13:37 +02:00
WAKAYAMA Shirou 06f2dfebdf [Go] remove assert lib and re-implement in this package. 2017-08-08 11:03:37 +09:00
WAKAYAMA Shirou bfd7a20e99 [Go] Add CommonTokenStream test.
This test is run by `go test`.
and also add test and testing utils.

Note: `github.com/stretchr/testify/assert` is required.
This assert library is almost same functionality for Java assert.
2017-08-07 20:31:55 +09:00
Jan Martin Mikkelsen 5fd7a6eadb Merge branch 'master' of https://github.com/jm-mikkelsen/antlr4 2017-08-05 15:39:01 +10:00
Jan Martin Mikkelsen b106f8ee08 Remove byte order mark on utf8 files. 2017-08-05 15:38:11 +10:00
Jan Martin Mikkelsen e70e41282c Style changes as requested 2017-08-05 13:46:24 +10:00
Jan Mikkelsen 7d36c5f6b8 Merge https://github.com/antlr/antlr4 2017-08-05 13:14:14 +10:00
Arshinskiy Mike ba75dc9550 Added additional interval math functionality 2017-08-03 01:03:28 +02:00
Niels Basjes ac9f75303e Fixed empty CodePointCharStream throwing exception on getText. Fixes #1949 2017-08-02 14:30:46 +02:00
Terence Parr 590fa8394c Merge pull request #1942 from neatnerd/master
[Go] Implemented TokenStreamRewriter
2017-08-01 15:08:35 -07:00
Terence Parr a0421807db Merge pull request #1969 from sharwell/propagate-error-sets
Report InputMismatchException with original context information
2017-08-01 13:36:10 -07:00
Hanzhou Shi 22caddc12f Autopass for doc conversion. 2017-07-29 23:28:15 -07:00
Hanzhou Shi 82b2480fe5 Tweak HTML comments. 2017-07-29 22:53:44 -07:00
Hanzhou Shi 0137218930 Removing dead code, malformed documentations, etc. 2017-07-29 17:27:33 -07:00
Arshinskiy Mike dced604c7c Corrected Start/Stop spelling 2017-07-29 22:05:46 +02:00
neatnerd c1c069cf5e Merge branch 'master' into master 2017-07-28 23:56:51 +02:00
neatnerd ca9409c7bc Remove duplicate comments 2017-07-28 23:55:40 +02:00
Matt Hauck a2fcad61f0 Differentiate windows static lib suffix to avoid being clobbered
Since the install target install static and shared libs into same
folder, and because on windows a shared lib also outputs a shared
.lib file to link against, need to make sure the static/shared
.lib files do not clobber each other.
2017-07-28 13:12:47 -07:00
Matt Hauck 11d185f744 add some missing flags; fix debug build 2017-07-27 22:08:13 -07:00
Matt Hauck b41782964b Add MSVC support to c++ cmake build 2017-07-27 21:37:09 -07:00
Matt Hauck 95338f710e Ignore Cmake policy CMP0054 2017-07-27 20:54:59 -07:00
Sam Harwell 0803c74eb2 Report InputMismatchException with original context information
Fixes #1922
2017-07-27 18:34:13 -05:00
WAKAYAMA Shirou 1b11cbed18 Merge remote-tracking branch 'upstream/master' 2017-07-27 21:52:12 +09:00
Venkat Peri e01af374d2 'requires' SUPERclass for Lexers in split mode, symbols/modes/channels available on Lexer prototype for use in lexer actions (this.SOME_MODE) like in Java actions, Utils.escapeWhiteSpace uses regex for global replace (was replacing only first occurnce of \n etc). 2017-07-22 18:11:37 -04:00
Mike Lischke 8149ff77fa Consequently use static_cast for (s)size_t casts.
Also fixed XCode tests.
2017-07-19 10:43:36 +02:00
Renata Hodovan 6e02088e6a Python: add public getter to parsers to access syntax error count.
ANTLR parsers in Java are allowed to access the number of encountered
syntax errors via the getNumberOfSyntaxErrors method. However, the
Python variants must use the protected _syntaxErrors member to get this
value. The patch defines the same getter for Python targets too.
2017-07-18 18:29:36 +02:00
Sam Harwell c8805ab584 Avoid adding to closureBusy before all ATNConfig properties are set
Setting ATNConfig properties can change the hash code of the instance, leading
to cases where the closureBusy set places objects in the wrong buckets. While
this has not led to known cases of stack overflow, it has led to cases where
one or more buckets contains a large number of duplicate objects, and the set's
add operation goes from O(1) to O(n).
2017-07-18 07:27:36 -05:00
Corey Kosak 2bce3a74d4 Remove the useless visibility attribute from this "enum class" declaration.
When compiling under gcc, ANTLR4CPP_PUBLIC macro expands to the following
gcc visibility attribute:
 __attribute__((visibility ("default")))

(when compiling under Windows it expands to the corresponding __declspec
attribute)

This change was introduced in commit 8ff852640a

Although the attribute makes perfect sense when applied to a "class"
declaration, it makes no sense (has no effect) when applied to an
"enum class" declaration. I assume that doing so was unintentional; that
when the change was introduced it was it was added mechanically to all
"class XXX" instances in the source code, a process which accidentally
picked up one "enum class XXX" instance.

Although it has no effect on the object code, it leads to the following
warning when compiling under gcc:
/usr/local/include/antlr4-runtime/atn/PredictionMode.h:18:31: error: type attributes ignored after type is already defined [-Werror=attributes]
   enum class ANTLR4CPP_PUBLIC PredictionMode {

This is a problem for people who would like their builds to be warning-free.

Happily, this declaration can be safely removed. The "enum class" construct
(just like with regular enum) does not cause any linker symbols to be
emitted. So having a linker attribute on the type does not actually have any
effect. It can therefore be safely removed.
2017-07-17 17:54:17 -04:00
vaibhavaingankar09 8b3da13259 fix to the ATN deserialiser issue on big endian architecture 2017-07-17 06:45:29 +00:00
Maurice van der Pot 162e2657b8 Fix two issues found by coverity 2017-07-15 17:20:59 +02:00
WAKAYAMA Shirou b36044108a [Go] Expose Start and Stop of Interval. 2017-07-10 09:51:07 +09:00
Arshinskiy Mike 1ce5f91573 [Go] Implemented TokenStreamRewriter
TokenStreamRewriter implementation was missing
Ported code from Java version; however, there are couple of deviations due to difference between composition (Go) and inheritance (Java) concepts
Ported tests from Swift for LexerA
2017-07-09 09:39:46 +02:00
WAKAYAMA Shirou 1054e658b2 [Go] change Interval.contains to public instead of add wrapper function. 2017-07-07 14:41:01 +09:00
WAKAYAMA Shirou 749fa81993 [Go] Add exported getter method to Interval. 2017-07-07 13:14:16 +09:00
Mike Lischke 6319d62409 Don't create VS 2013 packages anymore by default.
Can be enabled on demand.
2017-07-02 14:31:01 +02:00
Mike Lischke b7060ba1f5 Visual Studio build fixes for previous C++ patch.
VS 2013 doesn't accept certain C++11 constants like std::numeric_limits, so we have to return to the code used before that mentioned patch.
2017-07-02 14:29:54 +02:00
Mike Lischke f33fca6789 XCode build fixes for previous C++ patch. 2017-07-01 19:30:02 +02:00
Mike Lischke aa2d34bdfd Merge branch 'master' into interpreter2 2017-06-30 13:44:11 +02:00
Jan Martin Mikkelsen d4b18697f2 Fix unsafe usage on _edgeLock
Iterators on an unordered_map were being dereferenced after dropping a
read lock, leading to races where iterators could be invalidated before
they were used.
2017-06-30 10:47:43 +10:00
Jan Martin Mikkelsen d7f5e1834b Rework C++ Interval, IntervalSet, ATN and ATNState
- Remove the readonly status from IntervalSet.
- Remove virtual functions from IntervalSet and Interval. These are
  passed by value throughout the C++ runtime; meaningful inheritance is
  not possible anyway.
- Moving the atomic flag into ATNState as a "now cached" flag.
- Return a const reference from ATN::nextStates(ATNState*) so the readonly
  status is enforced by the compiler not at runtime in the code.
- Use value semantics using std::move to reduce the number of copies performed,
  constent with how these classes are used in the C++ runtime source.
- Remove type-unsafe varargs constructor in IntervalSet, replace with
  type-safe varadic templates implementation.
2017-06-27 11:04:50 +10:00
Jan Martin Mikkelsen 0c4473ea1a Merge https://github.com/antlr/antlr4 2017-06-26 17:22:44 +10:00
alimg 60cce436c2 Merge branch 'master' of https://github.com/antlr/antlr4 into py-input-mismatch-error 2017-06-25 19:02:26 +03:00
Terence Parr 645855a65a Merge pull request #1926 from ericvergnaud/fix-unicode-lexer
Fix #1925
2017-06-25 08:38:10 -07:00
Eric Vergnaud c3b742e090 also fix in go 2017-06-25 14:49:21 +08:00
Eric Vergnaud 0166ba95ac fix JavaScript too 2017-06-25 13:44:24 +08:00
Eric Vergnaud ff4ffa613b Fix ATN deserialisation for unicode chars FFFE and FFFF 2017-06-25 12:05:57 +08:00
alimg f0d1a093ed Python: fix reported input alternatives are not in par with Java version 2017-06-19 18:55:48 +03:00
Daniel Katz 952b971728 Update .Net NuGet package name to 4.7 with .NET Core target 2017-06-14 11:22:47 +03:00
Jan Martin Mikkelsen fdcfefa0a9 Convention: Change virtual dtor to empty bodies 2017-06-12 20:26:17 +10:00
Jan Martin Mikkelsen fad048897e SemanticContext::Operator: explicit virtual dtor 2017-06-12 19:44:34 +10:00
Jan Martin Mikkelsen 63fc7cb7a7 LexerActionType.h: Use antlr4-common.h for size_t 2017-06-12 19:42:04 +10:00
Jan Martin Mikkelsen aab2c043f0 Fix missed curly brace convention fix. 2017-06-12 11:26:06 +10:00
Jan Martin Mikkelsen 8c45d71673 Undo remove cast to same type in generated code 2017-06-12 11:13:42 +10:00
Jan Martin Mikkelsen 577b1d61bb Comply with curly brace conventions. 2017-06-12 11:10:32 +10:00
Jan Martin Mikkelsen 8fd4bcfa33 Add defined() before #if SYM > val evaluations
- Change "#if SYM > x" to "#if defined(SYM) && SYM > x" as a pattern. In
  StringUtils.h this follows the pattern used earlier in the file.
2017-06-12 10:46:29 +10:00
Jan Martin Mikkelsen 274e3c2d3b Change Lexer::{MORE,SKIP} def back to negative
- Explicitly cast negative values to size_t instead of using an offset
  from std::numeric_limts<size_t>::max().
2017-06-12 10:44:30 +10:00
Jan Martin Mikkelsen 6e46b168f5 Naming convention fix for qualifing shadowed args
- Change qualifying suffix from "_in" to "_" to confirm with
  conventions.
2017-06-12 10:23:47 +10:00
Jan Martin Mikkelsen dde893d365 Merge https://github.com/antlr/antlr4 2017-06-12 10:07:55 +10:00
Terence Parr e9155ef9cb Merge pull request #1908 from mike-lischke/master-build-fix
[C++] Build fix/correction for UTF32 conversion.
2017-06-11 08:54:46 -07:00
Terence Parr 35cf1ba4ff Merge pull request #1907 from mike-lischke/optimizations
[C++] Small optimizations
2017-06-11 08:54:21 -07:00
Mike Lischke ef49f61819 Formatting 2017-06-11 13:31:33 +02:00
Jan Martin Mikkelsen 70402f8eff ATN: Remove race condition in addState(ATNState*)
This is a proposed fix to bug #1826 which removes a race condition where
multiple threads could update ATNState::nextTokenWithinRule, leading to
corrupted std::vector instances in an InstanceSet.
2017-06-11 11:23:33 +10:00
Jan Martin Mikkelsen 4a359c1831 ATN: Handle empty, read-only, nextTokenWithinRule
ATN::nextTokens(ATNState* s) updates s->nextTokenWithinRule if the
IntervalSet is empty, and then sets it to be read only. However, if the
updated IntervalSet value was also empty, it becomes a read-only empty
set, causing an exception on a second call on the same state.

This was exposed a change I made to make IntervalSet::operator=()
respect the _readonly flag. (Which in turn was found by compiling with a
high warningly level.)

The approach in this update is to perform the update if the updated
value is not empty or if the current value is not read only. This
preserves the previous behaviour of creating a read-only empty set and
working on subsequent calls. It will throw on an attempt to update a
read-only value, where previously the read-only value would be silently
discarded and set to updatable.
2017-06-11 09:53:47 +10:00
Jan Martin Mikkelsen eb02a05efb Possible fix for max_align_t breakage in Travis CI
The Travis CI build is failing after an include of <cstddef> -- This is
an attempt to work around that by including <stddef.h> instead. Problem
not apparent in my FreeBSD environment.
2017-06-10 19:56:31 +10:00
Jan Martin Mikkelsen 2d011c8e3a Remove C++14 auto return type on utf8_to_utf32
- Also remove static instance of std::wstring_convert. Access to
  std::wstring_convert<>::{from,to}_bytes() is not guaranteed to be thread
  safe.
2017-06-10 18:46:46 +10:00
Jan Martin Mikkelsen 092afb283e C++ runtime changes for high warning levels
These changes are for compiling with high warning levels and -Werror.
There are no functional changes in this commit. Compiled with gcc 5.4
and clang 3.8.

Summary:

- Put virtual destructors into the appropriate .cpp file instead
  of the inline version in the header to avoid many vtables.
- Change C-style casts to modern C++ casts.
- Add explicit casts in some signed to/from unsigned conversions.
- Remove unreached code in BufferedTokenStream.cpp and
  LexerATNSimulator.cpp.
- Remove shadowed variables by qualifying constructor arguments with
  the name name as a member variable.
- Add explicitly defined copy constructors and assignment operators
  where required by gcc's -Weff-c++.
- Use std::numeric_limits<size_t>::max() instead of assigning a negative
  number.
- Remove semi-colons after function definitions.
- Remove unneccessary casts.
- In preprocessor statements "#if label > value" change to
  "#if defined(label) && label > value" to avoid warnings about the
  undefined symbol being seen as zero.
- Remove ANTLR4CPP_PUBLIC from "enum class" definitions.
- Change the FinalAction move constructor to move instead of copy the
  _cleanUp std::function object. (A side-effect of explicitly
  initialising member variables as required by gcc's -Weff-c++. I turned
  this one off because most constructors needed to be touched,
  especially the classes implemented with InitializeInstanceFields()).
- Mark hex digit conversion functions as file static in guid.cpp.
2017-06-10 17:29:25 +10:00
Jan Martin Mikkelsen 9845382e86 Implement IntervalSet::operator=() using the same semantics as the copy
constructor, put the destructor into the .cpp file so the vtable doesn't
get generated everywhere.
2017-06-10 16:47:01 +10:00
Mike Lischke cec714f745 Corrections for VS 2015. 2017-06-04 14:26:55 +02:00
Mike Lischke 19f584da05 Fixed build after UTF32 string convesion patch.
Also made converter local vars in conversion routines, instead of static global vars.
2017-06-04 12:24:06 +02:00
Mike Lischke 4fdcff6f05 Merge branch 'master-upstream' 2017-06-04 12:13:56 +02:00
Hanzhou Shi 4c0bbfd768 Marking Mutex.synchronized with rethrow. 2017-06-03 22:57:22 -07:00
Hanzhou Shi 53b83d7184 Refactored synchronization by using mutex. 2017-06-03 22:57:22 -07:00
Hanzhou Shi 13769268c9 fixing string issue. 2017-06-03 22:57:21 -07:00
Hanzhou Shi a64ec12e73 fixing tests, and some cleanups. 2017-06-03 22:57:21 -07:00
Hanzhou Shi a879297bb5 swift build & swift test support Linux platform 2017-06-03 22:57:21 -07:00
Hanzhou Shi d66f89db52 Removed xcworkspace. 2017-06-03 22:57:20 -07:00
Hanzhou Shi 67f683d0ac Adding generation of dyanmically linked lib. 2017-06-03 22:57:20 -07:00
Mike Lischke 47d639e7b7 Merge branch 'master-upstream' 2017-06-01 09:04:43 +02:00
lys0716 22034daf25 Typo in the comments of IntStream.java
An extra word is in the comments.

Signed-off-by: Yishuang Lu luyscmu@gmail.com
2017-05-31 21:17:29 -07:00
Terence Parr fd5efc250d Merge pull request #1891 from kosak/master
Make ParseTreeWalker::DEFAULT provide an IterativeParseTreeWalker
2017-05-31 10:22:19 -07:00
Terence Parr 053c594fec Merge pull request #1886 from ericvergnaud/nuget-version
Set version to 4.7.1 because 4.7.0 already exists on Nuget
2017-05-31 10:21:49 -07:00
Terence Parr 7ce775dcaa Merge pull request #1862 from hanjoes/swift-py-script
Supporting Script for Swift Runtime
2017-05-31 10:19:19 -07:00
Terence Parr 745c88a7c9 Merge pull request #1830 from mike-lischke/issue1827
Channel parameter in c-tor is now a size_t - fixes #1827.
2017-05-31 10:16:10 -07:00
Terence Parr 2c4a55c10a Merge pull request #1849 from shravanrn/master
Fix the utf8 convertor for VS2017
2017-05-31 08:01:31 -07:00
Corey Kosak 381fddebd5 Make ParseTreeWalker::DEFAULT provide an IterativeParseTreeWalker
as intended.

The existing code intended for ParseTreeWalker::DEFAULT to provide a
IterativeParseTreeWalker. However, the implementation initialized
ParseTreeWalker::DEFAULT by doing a (value) copy of an
IterativeParseTreeWalker, which sliced the object and therefore,
unfortunately, transformed it back into a regular ParseTreeWalker.

This change implements the desired behavior. Furthermore by making DEFAULT
a reference, we are able to preserve the interface to existing code.
2017-05-29 22:21:01 -04:00
Eric Vergnaud 44ab88c6f9 Set version to 4.7.1 because 4.7.0 already exists on Nuget 2017-05-28 20:47:58 +08:00
Will Fuqua e39543a257 add build script and update docs 2017-05-27 00:02:54 +07:00
Will Fuqua e88eba13fb add dotnetcore dll to nuspec
as part of this, add OutputPath to the csproj so it matches the mono csproj OutputPath
2017-05-26 23:12:47 +07:00
Shravan Narayan 9220df2e37 Merge branch 'master' into master 2017-05-15 16:58:55 -07:00
shravanrn@gmail.com de6f04be0b Fix the utf8 convertor in VS2017 2017-05-15 16:53:05 -07:00
Terence Parr f2ee752a58 Merge pull request #1848 from davesisson/master
Fix tests for PR #1844.
2017-05-12 09:18:46 -07:00
Terence Parr c1663e7c0f Merge pull request #1845 from xied75/dotnetcore
[dotnet] speed up tests; rename runtime dll ready for nuget
2017-05-12 08:00:38 -07:00
Jim Allman 892aa4a376 Fix other calls to InputStream constructor. 2017-05-11 17:08:24 -04:00
Jim Allman 5e648f0867 Add `new` keyword to return proper InputStreams
Currently the JS runtime sometimes returns (and mangles) the global
`window` object instead of a proper InputStream. This is prevented by
using the `new` keyword in all cases.
2017-05-11 16:27:42 -04:00
Hanzhou Shi 834f1ede27 Find antlr4 runtime instead of hardcoding. 2017-05-09 21:31:32 -07:00
Hanzhou Shi c53bd27734 Get rid of xcodeproj file. 2017-05-08 22:37:21 -07:00
Hanzhou Shi 55f9c06509 Now can generate xcode project. 2017-05-08 22:36:29 -07:00
Hanzhou Shi 9f41e6fd9d Adding support for generating local ANTLR Swift repo. 2017-05-08 22:28:46 -07:00
Hanzhou Shi d5f37015ab Adding more commands and comments. 2017-05-07 22:48:36 -07:00
Hanzhou Shi c13964868c Renaming test.py to boot.py and make it more general. 2017-05-07 22:37:48 -07:00
Mike Lischke 25eeb94498 Rule names are now always written to interpreter data file.
Updated loaders for Java and C++.
2017-05-05 17:00:41 +02:00
Mike Lischke a53c49ff44 Merge branch 'master-upstream' 2017-05-04 09:58:10 +02:00
David Sisson fc8b14b1dc io.Copy surprisingly returns the number of bytes it copies so we need to explicitly ignore that. 2017-04-29 18:45:45 -07:00
David Sisson 32a8874a29 Add proper error handling semantics to FileStream. 2017-04-27 21:40:44 -07:00
Dong Xie 5fffe4bb2e [dotnet] try to get test run faster; update from 1.0.1 to 1.0.3; fix test dir removal not recursive 2017-04-27 17:23:48 +01:00
Mike Lischke d12e755c02 Properly sorted exceptions in the forward declaration list.
Removed some duplicate classes there too.
2017-04-26 16:18:50 +02:00
Mike Lischke 126eec7092 2 corrections (C++ runtime and interpreter data writer)
- A wrong check for EOF has been corrected in the UnbufferedTokenStream (now using the correct data type for the cast to avoid warnings).
- The interpreter data write function no longer implicitly writes out imported grammars. Grammars are merged and hence contain everything from imported grammars already. If interpreter data for an imported grammar is required pass that grammar explicitly to the ANTLR tool.
2017-04-23 13:05:27 +02:00
Mike Lischke 3bffb070b2 Final touches on Java part. 2017-04-21 17:32:44 +02:00
Mike Lischke 8d420e3d24 A few changes that slipped through. 2017-04-21 17:23:39 +02:00
Mike Lischke 76394af71a Channel parameter in c-tor is now a size_t - fixes #1827.
A bit cleanup on the way.
2017-04-19 14:13:01 +02:00
Terence Parr 43e73c548b Merge pull request #1822 from mike-lischke/master
Small fix in cmake file. Fixes #1809.
2017-04-17 09:56:49 -07:00
Terence Parr efc0a14879 Merge pull request #1810 from xied75/dotnetcore
[dotnet] update to .netcore v1.0.1; add osx build
2017-04-17 09:55:32 -07:00
Mike Lischke d812528c89 Added new InterpreterDataReader to VS solution.
Fixed a few warnings too.
2017-04-15 16:56:00 +02:00
Mike Lischke 8995f0559f Adds a new option to allow ANTLR to generate interpreter data.
Especially when you want to use LexerInterpreter and/or ParserInterpreter in any of the non-Java targets you have to provide the ATN and other data. The classes to generate these values are not in the runtime, however. Hence we need a way to tell ANTLR to produce that in a way that can be consumed by all targets.

This patch adds a new command line parameter (-interpreter) which causes ANTLR to parse the given grammars as usual and then let it generated a file for each grammar with the required interpreter values. A new InterpreterDataReader class has been added to the Java + C++ runtimes. This class can load the data file (a plain text file) and generate the structures that can directly be fed to the interpreters.
2017-04-15 16:55:49 +02:00
Mike Lischke 1503821fa6 Small fix in cmake file. Fixes #1809. 2017-04-13 09:08:56 +02:00
Terence Parr 42e6b09d54 Merge pull request #1813 from FloorGoddijn/master
CPP target runtime: fixed a memleak
2017-04-07 09:31:40 -07:00
parrt 5616e370e4 add null check to findNodeSuchThat 2017-04-06 15:41:21 -07:00
Floor ea3d9d8fb4 fixed a memleak ( "previous' was not deleted when one of the break statements was hit) 2017-04-05 10:44:48 +02:00
Dong Xie da4987dc38 [dotnet] update to .netcore v1.0.1; add osx build 2017-04-04 15:26:40 +01:00
Hanzhou Shi 07048fe787 Fixing unit tests. 2017-04-02 09:41:55 -07:00
Hanzhou Shi b5caa8e945 Migrating to Swift 3.1. 2017-04-01 22:47:45 -07:00
hanzhos e254f346a4 Fixing Xcode project setting. 2017-03-31 14:56:52 -07:00
Terence Parr b4be1900bc Merge pull request #1793 from cmd-johnson/master
Obsolete String.contains(_:) of Swift runtime
2017-03-31 14:44:34 -07:00
parrt a4622ec8dc set version to 4.7.0 for npm 2017-03-30 14:40:58 -07:00
Jonas Auer 531f9f85dc Merge remote-tracking branch 'upstream/master' 2017-03-30 23:32:07 +02:00
Jonas Auer 7212b5d445 Fix spelling of StringExtension.swift 2017-03-30 23:28:47 +02:00
Jonas Auer acad3365cf Remove public modifier from String extension 2017-03-30 23:16:51 +02:00
Jonas Auer 315c28af7c Remove unused String.contains(_:) extension 2017-03-30 23:16:35 +02:00
parrt 62baf4bd0a [maven-release-plugin] prepare for next development iteration 2017-03-30 14:11:59 -07:00
parrt d4d7e3d3bc [maven-release-plugin] prepare release 4.7 2017-03-30 14:11:49 -07:00
parrt 930e31d470 Merge branch 'master' of github.com:antlr/antlr4 2017-03-30 11:07:02 -07:00
parrt e6a9adf276 update 4.6 -> 4.7 in files 2017-03-30 11:06:44 -07:00
parrt b5648f405b tweak documentation about various targets 2017-03-30 10:44:28 -07:00
Ben Hamilton a1c225dd23 Use UTF-8 by default in UnbufferedCharStream and allow specifying charset 2017-03-29 14:53:04 -07:00
Terence Parr 6e474eb43e Merge pull request #1776 from bhamiltoncx/js-char-streams
New JavaScript CharStreams functions
2017-03-29 14:38:41 -07:00
Terence Parr 828461337f Merge pull request #1775 from bhamiltoncx/csharp-char-streams
New C# CharStreams static factory class
2017-03-29 14:37:06 -07:00
parrt c3ed9a992d Add more about unbuffered streams. tweak style of code 2017-03-29 13:56:57 -07:00
parrt 0b36aca0e6 Merge branch 'master' into deprecate-old-streams 2017-03-29 13:43:28 -07:00
Terence Parr 0c38662134 Merge pull request #1799 from bhamiltoncx/tidy-java-unbuffered-char-stream
Small tidy-up for Java UnbufferedCharStream
2017-03-29 13:42:26 -07:00
Terence Parr 04972c2676 Merge pull request #1798 from bhamiltoncx/csharp-unbuffered-char-stream-code-points
C#: Change UnbufferedCharStream to use 32-bit Unicode code points and 32-bit buffer
2017-03-29 13:42:06 -07:00
Ben Hamilton 9c61db36b0 Small tidy for Java UnbufferedCharStream 2017-03-29 13:32:55 -07:00
parrt ef0ff3275f Merge branch 'master' into deprecate-old-streams 2017-03-29 13:30:33 -07:00
parrt 496f9c398d update unicode doc, code comments 2017-03-29 13:29:23 -07:00
Ben Hamilton 366dbac8d1 C#: Change UnbufferedCharStream to use 32-bit Unicode code points and 32-bit buffer 2017-03-29 13:29:10 -07:00
Ben Hamilton 8108b342ad Change UnbufferedCharStream to use 32-bit Unicode code points and 32-bit buffer 2017-03-29 13:14:18 -07:00
Ben Hamilton 200379802a Tidy comments and add tests to ensure UTF-16 and UTF-32 support Unicode code points > U+FFF 2017-03-29 10:06:08 -07:00
Jonas Auer 79eb3721e4 Obsolete String.contains(_:) of Swift runtime
Starting with iOS 10, macOS 10.12, tvOS 10.0 and watchOS 3.0, Foundation contains
its own definition of String.contains(_:), which conflicts with the extension
provided by antlr.
2017-03-28 11:52:32 +02:00
Ben Hamilton ab0655598e Improve memory usage of CodePointCharStream: Use 8-bit, 16-bit, or 32-bit buffer 2017-03-27 16:46:42 -07:00
Terence Parr b1360c4e28 Merge pull request #1789 from bhamiltoncx/interval-set-binary-search
IntervalSet perf: Use binary search for IntervalSet.contains(el)
2017-03-24 13:59:09 -07:00
Ben Hamilton 850abe1c81 IntervalSet perf: Use binary search for IntervalSet.contains(el) 2017-03-24 12:19:38 -07:00
Hanzhou Shi e334b0df86 Adding visitor tests. 2017-03-23 22:51:21 -07:00
Hanzhou Shi 91ce56c7fd Tweak Run Script phase. 2017-03-23 22:51:21 -07:00
Hanzhou Shi c3dc1b0d68 Update grammar name to align with JAVA tests. 2017-03-23 22:51:21 -07:00
Hanzhou Shi 2dab85ce2b Fixed printing of RewriteOps, now tests are passing. 2017-03-23 22:51:21 -07:00
Hanzhou Shi cb396a5047 Fixes #550 by separate op for insertAfter. 2017-03-23 22:51:21 -07:00
Hanzhou Shi cefd2c6528 Adding TokenStreamRewriterTests. 2017-03-23 22:51:20 -07:00
Hanzhou Shi 6d2b5b6790 Added "run script" build phase that can generate parser files. 2017-03-23 22:51:20 -07:00
Ben Hamilton f72e22550c charstreams-js 2017-03-22 11:03:16 -07:00
Ben Hamilton 307df9c68d New C# CharStreams static factory class 2017-03-20 13:07:08 -07:00
Peter Boyer eee59b9f7f Merge remote-tracking branch 'upstream/master' into racefix2 2017-03-19 17:59:13 -04:00
parrt 549d657ba4 rm dead code, tweak spaces, style. 2017-03-16 17:09:37 -07:00
Terence Parr 1f6a329692 Merge pull request #1765 from bhamiltoncx/unicode-cleanup-and-doc
Tidy up CharStreams and add new doc/unicode.md
2017-03-16 17:03:06 -07:00
Ben Hamilton 4f2168600d Tidy up CharStreams API. Add new doc/unicode.md 2017-03-16 17:01:46 -06:00
Peter Boyer 11b4ee61f0 Protect shared DFA state with mutexes 2017-03-16 12:43:21 -04:00
parrt e7979dcf63 rollback #1740. Useful stuff but breaks C++ unit tests. 2017-03-15 10:34:27 -07:00
Robert van der Hulst ef49021c8b Fixed portability problems in C# target. Also cleaned up some XML doc comments 2017-03-15 10:15:43 +01:00
parrt 1b0a8aa2e8 Fixes #1747 2017-03-14 10:35:22 -07:00
Peter Boyer 9a13551424 Fix performance issue in PredicitionMode 2017-03-12 15:29:20 -04:00
Peter Boyer 747efb8f0e Private comparable 2017-03-12 14:57:27 -04:00
Peter Boyer e41db9a250 Make Hasher package private 2017-03-12 14:56:25 -04:00
Peter Boyer db447513e5 Refactor hash methods 2017-03-12 14:53:58 -04:00
Peter Boyer d8998ec00d Remove last vestiges of old hash string impl 2017-03-12 14:32:27 -04:00
Peter Boyer df08e69a7d Cleanup 2017-03-12 14:24:36 -04:00
Peter Boyer ff44cc5d28 Imports 2017-03-12 14:19:34 -04:00
Peter Boyer d43e63c362 Remove another dead hash string impl 2017-03-12 14:18:55 -04:00
Peter Boyer e22d94a817 Remove dead Hash methods 2017-03-12 14:17:15 -04:00
Peter Boyer 1a28a0429b Cleanup LexerActionExecutor 2017-03-12 14:14:26 -04:00
Peter Boyer 6ff55d0bfe Fix bug in BaseATNConfigSet HashCode 2017-03-12 14:10:53 -04:00
Peter Boyer 86bf2fe089 Delete more Hash implementations 2017-03-12 13:28:26 -04:00
Peter Boyer 9ea82bc47a Cleanup 2017-03-12 13:26:59 -04:00
Peter Boyer f4061adeb2 Use HashCode for ATNConfigSet, DoubleDict 2017-03-12 13:24:56 -04:00
Peter Boyer 3bc902e2ff Change DoubleDict to use int 2017-03-12 13:14:19 -04:00
Peter Boyer b62aea3ce3 ATNConfig HashCode 2017-03-12 13:11:58 -04:00
Peter Boyer 4b5fd91c1d Minor mod 2017-03-12 12:53:51 -04:00
Peter Boyer fe7eee84bd Revert refactor 2017-03-12 12:49:35 -04:00
Peter Boyer 6482b0157b Use murmurHash for AND, OR 2017-03-12 12:48:20 -04:00
Peter Boyer 994e6a0c8d NewSet cleanup 2017-03-12 12:38:08 -04:00
Peter Boyer e9307171c7 Cleanup 2017-03-12 12:30:35 -04:00
Peter Boyer b49858faca BaseSingletonContext HashCode 2017-03-12 12:29:27 -04:00
Peter Boyer cdd3807611 ArrayPredictionContext hash 2017-03-12 12:21:31 -04:00
Peter Boyer 4f4a9c9d66 Some cleanup 2017-03-12 12:12:01 -04:00
Peter Boyer 4254fb63c6 Get older token file 2017-03-12 12:09:08 -04:00
Peter Boyer b5c5ce2188 Get older recog 2017-03-12 12:08:18 -04:00
Peter Boyer e1bce5284a Checkout older lexer atn simulator 2017-03-12 12:06:59 -04:00
Peter Boyer 2132555b6b Get old changes from ATN deserializer 2017-03-12 12:06:07 -04:00
Peter Boyer 60d03df245 Cleanup 2017-03-12 12:01:28 -04:00
Peter Boyer 760ed2796c Borrow changes from wxio 2017-03-12 12:00:34 -04:00
parrt b16cfd6edb add copyright 2017-03-10 15:17:29 -08:00
parrt 8dd87d4966 cleanup 2017-03-10 14:57:24 -08:00
parrt 3d945eed2a Fixes #1620. Make handbuilt lexer to avoid cyclic dependence of tool and plugin. 2017-03-10 14:54:48 -08:00
Terence Parr 197ea6e4e4 Merge branch 'master' into master 2017-03-10 13:53:14 -08:00
harry-tallbelt 2a118e284f Fixed null pointer exception for JS 2017-03-08 15:00:14 +02:00
Terence Parr b8c74be628 Merge pull request #1731 from hanjoes/fixtest
Remove generated files from repository and add testRig for Swift target
2017-03-07 12:38:19 -08:00
Mike Lischke e810ca6084 Fixed regression introduced by wrong optimization. Fixes #1708. 2017-03-07 20:15:10 +01:00
chund 313ab9dcce Merge branch 'master' into master 2017-03-06 08:59:50 +01:00
Hanzhou Shi 0c71574c8e Specify output folder so generated files can be ignored correctly. 2017-03-05 20:56:29 -08:00
Hanzhou Shi e1898324df Run "swift test" in test. 2017-03-05 20:49:02 -08:00
Hanzhou Shi b66ffe86f9 Remove generated parser files and added testRig.
Current version of swift package manager doesn't support shell command
or any mechanism that we can leverage to generate parser files. Adding
a python script to kick off the unit tests.
2017-03-05 20:44:22 -08:00
Mike Lischke 1cf28851c2 Merge branch 'master_upstream' into optimizations 2017-03-04 14:58:41 +01:00
Mike Lischke e002b177c6 Fixed crash with multi threaded parsers warming up at the same time.
The lock for the shared DFA state needs to protect a few more operations than just the addDFAState stuff and had to move up one call level. This in turn requires now 2 places where the lock must be aquired.
2017-03-04 14:20:09 +01:00
Dong Xie e49b0977f5 fix #1725; get dotnet target test run 2017-03-04 01:42:44 +00:00
Terence Parr 4a5e65c5e7 Merge pull request #1701 from Thomasb81/Fix_syntaxError_proto
[Cpp] Fix syntaxError prototype issue
2017-03-03 13:30:00 -08:00
thomasb8138 26e41343a6 Remove IRecognizer reference in xcode project (reverted from commit f6b09429b6) 2017-03-03 21:39:17 +01:00
D054757 f4e955b528 Improve error message in exceptions 2017-03-03 13:46:55 +01:00
thomasb8138 f6b09429b6 Remove IRecognizer reference in xcode project 2017-03-03 08:49:52 +01:00
thomasb8138 ce40463986 Remove IRecognizer reference from MSVCS project 2017-03-03 08:49:10 +01:00
parrt d9d21fe9b3 found 2 cases that called function on empty set. 2017-03-02 14:18:00 -08:00
parrt 6572b08095 Fixes #1703 properly this time. addendum to #1718 2017-03-02 14:13:27 -08:00
thomasb8138 b681d76b4a Remove IRecognize class + rename rename to Recognize 2017-03-02 23:09:30 +01:00
thomasb8138 ef6058ba6f Merge branch 'Fix_syntaxError_proto' 2017-03-02 23:01:51 +01:00
parrt 37fdf66c13 Fixes #1703. Updated comments to ensure people test isNil() or size() before requesting min, max, any single element. 2017-03-02 10:49:25 -08:00
Terence Parr 6245938be9 Merge pull request #1712 from mike-lischke/cpp-demo-fix
Using new Unicode syntax for C++ demo project.
2017-03-02 10:40:41 -08:00
parrt 3df19fbcc8 make format consistent with most of antlr project 2017-03-02 10:38:48 -08:00
parrt e353fa0484 update comment @since tag to 4.7.1 2017-03-01 14:53:43 -08:00
Terence Parr e04e7a40cc Merge pull request #1697 from hanjoes/master
Swift imple of #1665, #1674.
2017-03-01 14:50:50 -08:00
Terence Parr 7f479fa5dc Merge pull request #1700 from jvasileff/patch-1
Fix minor typo: possessive "its"
2017-03-01 14:45:46 -08:00
Terence Parr 0539fb4b0d Merge pull request #1699 from Thomasb81/fix_1698
Fix for #1698
2017-03-01 14:43:12 -08:00
Terence Parr 26249918f5 Merge pull request #1694 from mike-lischke/master
C++ implementation of issue #1665 and issue #1674
2017-03-01 14:41:15 -08:00
Mike Lischke e368fb30ea Using new Unicode syntax for C++ demo project. 2017-02-28 15:32:25 +01:00
Terence Parr 39ba47554a shift setParent up one level 2017-02-27 12:13:12 -08:00
thomasb8138 5c9f174f28 Fix typo 2017-02-26 20:31:32 +01:00
thomasb8138 c668c931fd Fix syntaxError prototype in order to use Recognizer instead of IRecognizer. 2017-02-26 20:11:08 +01:00
John Vasileff 10fdcaa432 Fix minor typo: possessive "its" 2017-02-26 00:22:31 -05:00
thomasb8138 2d390b7a71 TokenStreamRewriter::replace(const std::string &programName, size_t from, size_t to, const std::string& text) expect a valid reference on std::string object. Not a null pointer. 2017-02-25 19:11:34 +01:00
Hanzhou Shi 38c3aaae8f Implements #1674 "augment TerminalNode with setParent()" for Swift target. 2017-02-25 09:17:37 -08:00
Mike Lischke 382d8f1e92 Merge branch 'master_upstream' 2017-02-25 10:48:32 +01:00
Mike Lischke a55baba44c More versions updated. 2017-02-25 10:48:12 +01:00
Hanzhou Shi 392c637565 Implements #1665 for Swift target. Slightly different because #899 was not addressed in Swift target. 2017-02-24 23:14:24 -08:00
Mike Lischke a4e0948600 Updated version number. 2017-02-24 20:08:17 +01:00
Mike Lischke 126112fbbc C++ implementation of issue #1665 and issue #1674 2017-02-24 08:44:21 +01:00
parrt 6215f18ec3 rename 4.6.1 to 4.7 everywhere 2017-02-23 14:48:58 -08:00
Terence Parr 05dad185f3 Merge pull request #1690 from mike-lischke/master
Fixed a number of data type + signedness issues in the C++ target
2017-02-23 14:10:29 -08:00
Ben Hamilton fd4246cf3f Implement new extended Unicode escape \u{10ABCD}. Bump UUID. Add lots more tests. 2017-02-23 09:39:44 -08:00
Mike Lischke cd6bb1f2a0 Merge branch 'master_upstream' 2017-02-23 10:57:31 +01:00
Terence Parr ce09abb480 Merge pull request #1679 from Thomasb81/Issue_1666
Issue 1666
2017-02-22 13:14:37 -08:00
Terence Parr 1dc70310a3 Merge pull request #1685 from KvanTTT/master
Fix C# Pair.cs, Right arrow escaping in XML Comments
2017-02-22 13:09:57 -08:00
thomasb8138 cb177712f6 Use reference instead of pointer 2017-02-22 21:55:46 +01:00
Mike Lischke 0101770e5f Fixed a number of data type + signedness issues.
The UnbufferedCharStream had a few invalid casts which could lead to wrong numbers. This patch also fixes issue #1619.
2017-02-22 12:09:52 +01:00
Mike Lischke 14991143d4 Merge branch 'master_upstream' 2017-02-22 11:32:22 +01:00
Mike Lischke 4a940aeeda Fix for issue #1608 (runtime build failure with gcc 6.3.1)
Additionally, a warning has been removed.
2017-02-22 11:31:57 +01:00
Ivan Kochurkin f24b19ff8a Right arrow escaping in XML Comments. 2017-02-22 02:57:01 +03:00
Ivan Kochurkin 160f893922 Fix C# Pair.cs, #1634. 2017-02-22 02:47:11 +03:00
thomasb8138 78a20b72a3 Clean fix 2017-02-21 23:43:13 +01:00
parrt 912342b01f tweak to C++ runtime; nullptr not 0 2017-02-21 09:39:02 -08:00
Terence Parr 91df265278 Merge pull request #1672 from bhamiltoncx/code-point-transitions
New class CodePointTransitions to create SetTransitions for Unicode code points > U+FFFF
2017-02-20 14:37:36 -08:00
Thomasb81 1341d35f37 Merge branch 'master' into Issue_1666 2017-02-20 22:49:16 +01:00
thomasb8138 df0cd343c1 Fix https://github.com/antlr/antlr4/issues/1666 2017-02-20 22:27:15 +01:00
Mike Lischke 528f675dd6 Some compilers need the functional include. 2017-02-20 12:42:53 +01:00
parrt 44942bc5fc Merge branch 'master' into lecode-official-master 2017-02-19 14:08:26 -08:00
Ben Hamilton 760d3eff82 Use generator expressions instead of list comprehensions 2017-02-18 11:55:49 -08:00
Ben Hamilton 7b9b0835b8 Python 2.7 InputStream: Properly support Unicode code points 2017-02-18 11:54:11 -08:00
parrt 81681abfb3 augment TerminalNode with setParent(). Technically, this is not backward compatible as it changes the interface but no one was able to create custom TerminalNodes anyway so I'm adding as it improves internal code quality. addChild now sets the parent rather than create. MUCH better. 2017-02-18 11:21:17 -08:00
Ben Hamilton 291638ca2d CodePointTransitions 2017-02-17 13:30:22 -08:00
Terence Parr 2b3508d57e Merge pull request #1662 from bhamiltoncx/no-more-char-casts
Get rid of all (char) casts
2017-02-17 13:21:16 -08:00
Terence Parr f5bbcaab51 Merge pull request #1664 from bhamiltoncx/csharp-error-message-unicode
Support Unicode values > U+FFFF in C# runtime error messages
2017-02-17 13:19:02 -08:00
parrt f8e7a2cf08 merge in dotnet stuff 2017-02-17 11:02:52 -08:00
Terence Parr 628aa8ff02 Merge pull request #1665 from parrt/factor-create-leaves
factor out the creation of error nodes and terminal nodes in the parser
2017-02-16 10:43:30 -08:00
parrt e200f2a56b factor out the creation of error nodes and terminal nodes in the parser so that they act like a built-in factory during parse tree construction. 2017-02-16 10:36:59 -08:00
Ben Hamilton f88e0cbfe0 Unicode SMP support for C# runtime error messages 2017-02-16 10:25:49 -08:00
Terence Parr 1df5cd6206 Merge pull request #1661 from bhamiltoncx/lexer-max-unicode
Change MAX_CHAR_VALUE to 0x10FFFF
2017-02-16 10:16:18 -08:00
Ben Hamilton 88ecb3d9fa Get rid of all (char) casts 2017-02-16 09:55:08 -08:00
Ben Hamilton b190b6eca6 MAX_CHAR_VALUE to 0x10FFFF 2017-02-16 09:46:09 -08:00
Ben Hamilton c35bbabc16 PR #1658: Also write stderr to file 2017-02-16 09:44:40 -08:00
Ben Hamilton 3188d6a883 Allow setting source name when creating CodePointCharStream from string 2017-02-14 15:49:00 -08:00
David Neumann e967463e91 Merge branch 'master' into master 2017-02-14 11:20:02 +01:00
Terence Parr fb805a589b Merge pull request #1643 from bhamiltoncx/fix-csharp-code-point-input-stream
Easy: Fix C# CodePointCharStream to actually work with code points > U+FFFF
2017-02-13 15:18:27 -08:00
Terence Parr 287f17b796 Merge pull request #1652 from bhamiltoncx/csharp-lexer-parser-output-file
C# support for lexer and parser output to a file
2017-02-13 15:10:54 -08:00
Terence Parr 9b7e2a81ce Merge pull request #1651 from bhamiltoncx/python-lexer-parser-output-file
Python 2 and Python 3 support for lexer and parser output to a file
2017-02-13 15:10:19 -08:00
Terence Parr 565f6299c0 Merge pull request #1650 from bhamiltoncx/js-fromcodepoint-polyfill
Fix JavaScript InputStream.getText() when input contains Unicode values > U+FFFF
2017-02-13 15:08:59 -08:00
Terence Parr 3cbc2af0cc Merge pull request #1655 from lionelplessis/fix-#1298-for-csharp
Fix #1298 for CSharp
2017-02-13 10:29:47 -08:00
Terence Parr ae5250685d Merge pull request #1637 from bhamiltoncx/char-streams
Make BaseJavaTest and TestRig work with Unicode values > U+FFFF
2017-02-10 14:11:34 -08:00
Ben Hamilton 6611c1ae27 C# runtime and test harness support for writing test output to file 2017-02-10 13:37:44 -08:00
Ben Hamilton 2c447a2b75 Python 2 and Python 3 support for lexer and parser output to a file instead of stdout 2017-02-10 13:11:24 -08:00
Ben Hamilton 51edf3cece Fix InputStream.getText() when input contains Unicode values > U+FFFF 2017-02-10 11:41:00 -08:00
Ben Hamilton 32a3a95da1 Import fromcodepoint.js 2017-02-10 11:40:55 -08:00
lionelplessis 895681044e Fix #1298 for CSharp 2017-02-10 17:55:10 +01:00
Ben Hamilton 2d24fa7457 Fix C# CodePointInputStream to actually work with SMP code points 2017-02-02 15:55:03 -08:00
Terence Parr 182f3c4647 Merge pull request #1628 from bhamiltoncx/js-string-codepointat-polyfill
JavaScript runtime: Optionally support decoding UTF-16 sequences to Unicode code points
2017-01-31 10:26:29 -08:00
Ivan Kochurkin e5867ee58f Java: LexerInterpreter ctor without channelNames argument marked as Deprecated. 2017-01-31 16:32:32 +03:00
Ivan Kochurkin b1a9daa6b0 C# runtime: LexerInterpreter ctor without channelNames argument marked as Obsolete.
LexerInterpreter.cs reformatted.
2017-01-31 16:29:49 +03:00
Ben Hamilton 499e44b03a Pass through source name 2017-01-30 14:16:33 -08:00
Ben Hamilton 38ba75e96e Inline test instead of using anonymous function 2017-01-30 13:52:14 -08:00
Ivan Kochurkin 7b8ba3550b channelNames support in LexerInterpreter (C#, C++, Java, Swift). 2017-01-31 00:34:10 +03:00
Ivan Kochurkin 8359a998b6 Updated generated files. 2017-01-31 00:34:10 +03:00
Ivan Kochurkin c3d96eb5d7 Added channelNames to all runtimes. 2017-01-31 00:32:21 +03:00
Terence Parr fb22b1dbcb Merge pull request #1639 from ericvergnaud/missing-js-export
missing js export
2017-01-30 13:26:18 -08:00
Terence Parr e8f45783cd Merge pull request #1630 from bhamiltoncx/python-runtime-test-utf-8
Use UTF-8 for Python runtime tests, allow specifying error handling
2017-01-30 11:32:55 -08:00
Terence Parr 444d35ecde Merge pull request #1632 from bhamiltoncx/csharp-runtime-unicode
New C# runtime class CodePointCharStream
2017-01-30 11:27:16 -08:00
Eric Vergnaud d5b88cda71 missing js export 2017-01-31 02:53:58 +08:00