Commit Graph

105 Commits

Author SHA1 Message Date
Eric Vergnaud 6398a06fba fixes #1530 and #1531 2016-12-20 23:27:08 +08:00
Eric Vergnaud e15e88a049 fix unicode issue 2016-12-13 21:33:19 +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 76d421a89e add copyrights on Python2 2016-12-08 11:40:30 -08:00
parrt f597069728 Update copyright on Python2 2016-12-08 11:40:30 -08:00
parrt 2bad631cce 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
Vladi Lyga 8b60373c43 fix: enable to access interval as a list 2016-11-30 17:16:35 +02:00
Vladi Lyga f50fb7df15 Fix error when Interval is rewritten with a tuple 2016-11-30 13:55:54 +02:00
Vladi Lyga 377f2f5c89 Merge remote-tracking branch 'antlr4/master' 2016-11-30 11:31:24 +02:00
Vladi Lyga 238b55a0b6 Extensive TokenStreamRewriter tests + many python2 runtime fixes.
Including fix for https://github.com/antlr/antlr4/issues/550
2016-11-30 11:27:04 +02:00
Eric Vergnaud ccde4051bd fixed the 2 failing tests with left recursion optimisation 2016-11-30 00:40:01 +08:00
Eric Vergnaud ec5f64a459 start migrating, but 2 tests are failing 2016-11-29 00:05:13 +08:00
Eric Vergnaud 3026c3cc94 start migrating 2016-11-28 23:05:43 +08:00
parrt aeaba48a0b pull in lygav python impl of TokenStreamRewriter 2016-11-22 12:34:46 -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
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
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
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
Vlad 5a0608be2e fix op filter error when trying to replaceSingleToken 2016-09-02 22:20:08 +03:00
Vlad ae435d06c8 add TokenStreamRewriter to Python2 runtime 2016-09-02 15:36:11 +03: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
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
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
Rajiv Subrahmanyam e5f011a9a1 #999: Using unicode(c) instead of str(c) to avoid exception when unicode string contains high byte chars 2015-09-17 22:23:10 -07: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 295d235728 typo 2015-08-26 23:40:41 +08:00
Eric Vergnaud 980072b6b4 more tuning 2015-08-26 23:40:14 +08:00
Eric Vergnaud 3a10724919 typo 2015-08-26 23:39:31 +08:00
Eric Vergnaud 1b5437aeab more tuning 2015-08-26 23:39:04 +08:00
Eric Vergnaud e6d27c7a7c use native tuple hash instead of str hash 2015-08-26 02:13:56 +08:00
Terence Parr 53678867ca rm a few local test files 2015-06-30 15:04:20 -07:00
Terence Parr fe207fb3ee mv files into proper position for folding into main antlr4 repo; delete already moved stuff 2015-06-30 14:13:56 -07:00