Commit Graph

107 Commits

Author SHA1 Message Date
Sam Harwell 8b21cc3dfb Fix DefaultErrorStrategy.sync handling of end of rule
This change updates the default sync() strategy to match the strategy used
for selecting an alternative when prediction leaves the decision rule prior
to reaching a syntax error.

Closes #1545
2016-12-23 16:28:46 -06:00
Eric Vergnaud 6398a06fba fixes #1530 and #1531 2016-12-20 23:27:08 +08:00
parrt c4c2966dbd update doc 2016-12-15 20:42:29 -08:00
Terence Parr 6a20919cb7 Merge pull request #1476 from renatahodovan/python-target-1472
Implement the fix of #1298 for Python targets.
2016-12-11 14:49:28 -08:00
Terence Parr c7e27664c2 Merge pull request #1471 from renatahodovan/visit-error-node
Call visitErrorNodes properly in Python targets.
2016-12-11 14:48:21 -08:00
Renata Hodovan 58d51450d4 Implement the fix of #1298 for Python targets.
The patch adapts the fix in PR #1472 for Python targets.
2016-12-10 02:41:08 +01:00
Terence Parr 82372aae2c Merge pull request #1460 from renatahodovan/intervalset-range-fix
Fix AttributeError when trying to write an immutable variable in Python.
2016-12-09 16:05:11 -08:00
Renata Hodovan bd09023209 Call visitErrorNodes properly in Python targets.
The consume method of the Parser class calls visitTerminal on both
TerminalNodes and ErrorNodes even if the comment above states that
ErrorNodes should be visited by visitErrorNodes. This behaviour
is also inconsitent with the Java target. The patch fixes this in
both Python targets.
2016-12-09 19:41:23 +01:00
parrt 2c99f187a0 make it read "Copyright (c) 2012-2016 The ANTLR Project" 2016-12-08 11:43:06 -08:00
parrt 1b1a9862c4 contributors->authors 2016-12-08 11:43:06 -08:00
parrt 61e8eba4fc fix typo 2016-12-08 11:43:06 -08:00
parrt c0e4f07602 add copyrights on Python3 2016-12-08 11:40:30 -08:00
parrt fed78dbd28 update copyrights on Python3 2016-12-08 11:40:30 -08:00
parrt 06973a8ea9 fix typo in copyright 2016-12-08 11:40:30 -08:00
parrt efc3f82f38 rm redundant license files 2016-12-08 11:40:30 -08:00
Renata Hodovan a7227b4499 Fix AttributeError when trying to write an immutable variable in Python.
The `removeOne` function of IntervalSet tries to directly
rewrite the start field of an immutable range variable when
splitting an existing interval. This causes AttributeError which
is fixed by the patch.
2016-12-08 11:05:00 +01:00
Eric Vergnaud 6e071f4950 implement LR optimisation in Python3 + align naming + DFAState ctor bugs 2016-11-30 00:40:42 +08:00
parrt 9d3415ed8a Merge branch 'master' of git://github.com/ghosthope/antlr4 into ghosthope-master 2016-11-25 12:28:14 -08:00
ghosthope 04e9078dd9 from master 2016-11-23 13:58:43 +03:00
Terence Parr f3be375c3a Merge pull request #1379 from ericvergnaud/python3-token-stream-rewriter
port from python 2 version
2016-11-21 11:34:16 -08:00
Terence Parr 37ff8a3161 Merge pull request #1248 from renatahodovan/configset-contains
Fix comparisons in ATNConfigSet.__contains__ of Python targets.
2016-11-21 10:08:51 -08:00
Eric Vergnaud 9d926d6c2a port from python 2 version 2016-11-20 15:56:43 +08:00
parrt d9490e16da undo damage done by intellij pulling out imports from python :( 2016-11-19 18:29:04 -08:00
parrt 144baa9ade cannot raise string exceptions 2016-11-19 15:09:13 -08:00
Terence Parr 30e4ec29c8 Merge pull request #1251 from renatahodovan/execATN-conflictingAlts
Fix the initialization of conflictingAlts in execATN in Python targets.
2016-11-19 14:58:39 -08:00
parrt c0b5a40bcf Python3 target filterPrecedencePredicates should take collection:set not list as hint. Manual implementation of https://github.com/antlr/antlr4/pull/1247/files 2016-11-19 14:51:12 -08:00
Terence Parr f0177c96f8 Merge pull request #1246 from renatahodovan/nextToken-self-fix
Fix eofToken access in ListTokenSource.nextToken() by Python targets.
2016-11-19 14:43:06 -08:00
Terence Parr db5d306285 Merge pull request #1187 from renatahodovan/atnconfig_instantiate
Fix initialization of ATNConfig when computing SLL prediction termination condition.
2016-11-19 14:21:22 -08:00
Terence Parr 1ba897ace4 Merge pull request #1186 from renatahodovan/python-enterrule-typo
Fix typo in the parser of the Python3 runtime.
2016-11-19 14:16:17 -08:00
parrt ffaedd209d Set version in code to 4.6. 2016-11-06 11:21:06 -08:00
Renata Hodovan 03d5fb1244 Make Python targets more pythonic.
The Python implementations are completely synchronous
with the Java version even if some of the constructs
can be expressed with simpler Python solutions. These are
typically the all, any, count, next builtins or the list
comprehensions, etc. Beside using them makes the code
clearer, they are also prefered by the standard and can
result in performance speedup. The patch contains such
equivalent transformations in the Python targets.
2016-09-25 10:33:27 +02:00
Renata Hodovan c15b0d9a36 Fix the initialization of conflictingAlts in execATN in Python targets.
The Java target initializes the conflictingAlt local variable
based on the conflictingAlts property of the target state.
However, the Python targets resets it to None. The patch makes the
initializations consistent.
2016-08-10 01:32:12 +02:00
Renata Hodovan 543a069440 Fix comparisons in ATNConfigSet.__contains__ of Python targets.
The __contains__ method of ATNConfigSet used different hashing
function (hash) for indexing the config dictionary than the
getOrAdd method (hashCodeForConfigSet) which filled it.
Furthermore, they also used different methods for comparing
ATNConfig objects. The patch makes them consistent.
2016-08-09 22:52:37 +02:00
Renata Hodovan 510e21d7cb Fix eofToken access in ListTokenSource.nextToken() by Python targets.
At the end of the nextToken() function, setting the eofToken field was
attempted without the 'self' keyword, resulting in accessing
and setting a new local and unused variable. The patch supplements
the missing 'self' keywords for both targets.
2016-08-09 15:32:12 +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
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
Renata Hodovan 54168905b0 Fix typo in the parser of the Python3 runtime.
The last parameter name of Parser::enterRule in the Python3 runtime
was mistakenly combined with its type. The patch fixes this.
2016-04-30 12:14:31 +02:00
parrt cd0913712a set code string versions to 4.5.3 2016-03-30 16:21:50 -07:00
parrt 9e98714a1d Add ability to set parse tree internal node super class with option contextSuperClass. Provide impl in Java target that has altNum backing field. Add test across targets to set/get alt num. Fixes #1152. 2016-03-30 11:00:47 -07:00
Terence Parr c92ddcbd06 update version to 4.5.2 in source / packaging stuff. 2016-01-30 09:54:47 -08:00
parrt 5299d436aa Merge branch 'patch-1' of git://github.com/cooperra/antlr4 into cooperra-patch-1
# Conflicts:
#	contributors.txt
2016-01-28 10:47:03 -08:00
Terence Parr 8a4aa39de2 fix links 2015-11-23 16:19:45 -08:00
hkff e051b1a0f8 Fixing BufferedTokenStream.getTokenStream() calls 2015-10-21 16:34:44 +02:00
hkff 0e09f8b659 Adding getTokenSource in BufferedTokenStream 2015-10-21 14:15:57 +02:00
Eric Vergnaud 3e807138d5 local replica of #1010 2015-10-05 21:28:30 +08:00
Eric Vergnaud 27855f7ed4 remove slow asserts 2015-08-26 23:43:03 +08:00
Eric Vergnaud d7d59c53a7 more tuning 2015-08-26 23:42:14 +08:00
Eric Vergnaud 1b3f74495f typo 2015-08-26 23:41:21 +08:00
Eric Vergnaud 980072b6b4 more tuning 2015-08-26 23:40:14 +08:00
Eric Vergnaud 1b5437aeab more tuning 2015-08-26 23:39:04 +08:00
Eric Vergnaud 2f4f36d60c typos 2015-08-26 02:14:19 +08:00
Eric Vergnaud 164a34ba6e use native tuple hash instead of str hash 2015-08-26 01:17:23 +08:00
Eric Vergnaud cfb557cc90 add performance test 2015-08-26 01:15:59 +08:00
Robbie Cooper 3c08f49a1a Fix NameError in LexerATNSimulator.reset()
Without this line, one gets "NameError: name 'Lexer' is not defined" when calling reset(). This is the same way __init__() assigns self.mode.
2015-08-05 02:31:57 -04:00
parrt ad6a1bda3f rm generated files, update a manifest 2015-07-17 12:43:41 -07:00
Terence Parr 5d2d75d2e3 looks like i had python2 and 3 swapped. java, python3, c# pass. python2, js each have same single test failing: testCharSetWithQuote1 2015-06-29 18:09:37 -07:00
parrt d1f95085fe all Python3 runtime tests pass. Using same "get resource" mechanism to find runtime python code as I did for C#. 2015-06-29 18:09:35 -07:00