Commit Graph

104 Commits

Author SHA1 Message Date
rocky
f4ceb6304d Allow 3-part version string lookups, e.g 2.7.1
We allow a float here, but if passed a string like
'2.7'. or  '2.7.13', accept that in looking up
either a scanner or a parser.
2017-08-13 09:17:07 -04:00
rocky
246495febd Bang more on BUIlD_MAP_UNPACK
there are still bugs. Note:

{**{'x': 1}, **{'y': 2}} and
{{'x': 1}, **{'y': 2}}

generate the same Python 3.5+ bytecode.
2017-05-02 21:55:41 -04:00
rocky
91b86ac156 BUILD_MAP_UNPACK'ing of dictionaries in 3.5 2017-05-02 05:51:48 -04:00
rocky
50687e6317 Reduse scope of LOAD_ASSERT as expr to 3.4+ 2017-04-22 22:10:55 -04:00
rocky
b35546157f LOAD_ASSERT can also be an expr
This may have the undesirable property that assert statements might get
tagged with equivalant low-level Python code that uses "raise
AssertionError", but so be it.

Fixes #103
2017-04-22 20:03:21 -04:00
rocky
8cdaac93ab Add if1else. Fixes #101 2017-04-13 21:27:22 -04:00
rocky
6773a66b99 Tidy use of load_attrs 2017-04-03 06:53:12 -04:00
rocky
e1111e3f50 Python 2.6 a == b or c == d == 3 grammar bug 2017-02-28 09:18:36 -05:00
rocky
29122340e6 Python 2.7 check jump targets of "and" 2017-02-28 00:15:39 -05:00
rocky
2fbbc728b1 Python 2.6 parsing bugs ..
and some parser list nonterminal cleanup
2017-02-25 04:45:10 -05:00
rocky
db7a26d47d option -g: show start-end range when possible 2016-12-11 09:02:28 -05:00
rocky
813bce4697 Merge branch 'master' of github.com:rocky/python-uncompyle6 2016-12-09 21:13:31 -05:00
rocky
a5d2237435 Python 3.x else clause detection and..
- Strengthen verify check.
- weak verification on Python 3.5 for now
2016-12-09 21:10:10 -05:00
rocky
d22931cb49 Get ready for release 2.9.7
Some of the many lint things. Linting is kind of stupid though.
2016-12-04 09:36:30 -05:00
rocky
a5a0f45dde Try new spark 2.5.1 grammar syntax shortcuts
This package I now declare stable
2016-11-28 07:55:00 -05:00
rocky
1e324e0e8d Misc changes
scanner26.py: make scanner2.py and scanner26.py more alike
scanner2.py: check that return stmt is last in list. (May change)
main.py: show filename on verify error
test/*: add more
2016-11-26 21:41:45 -05:00
rocky
7ab4e1fbdb Start grammar reduction checks 2016-11-26 15:38:00 -05:00
rocky
cbcfd53dae Python 2.6 grammary bug and..
__pkginfo.py__: Bump spark_parser version for parse_flags 'dups'
2016-11-23 21:44:53 -05:00
rocky
f8917aaf88 Remove redundant 2.7 (and 2.x) grammar rules 2016-11-22 17:31:36 -05:00
rocky
50c2e1bda9 Revert augassign change but..
Make note of what's going on and add grammar test for bad
situations we have in Python 2.6 (and perhaps others)
2016-11-11 09:08:02 -05:00
rocky
f4999f6300 augassign semantic action bug 2016-11-11 08:41:55 -05:00
rocky
a685c60606 Make parse 3.0 be its own thing 2016-11-05 21:02:49 -04:00
rocky
d2ac293cf6 Merge branch 'master' into python-3.0 2016-11-05 21:01:50 -04:00
rocky
0e7da031b2 Split out 3.1-3.3 parsers from parser3.py
This is anticipation of extending annotation to Python 3.2+
2016-10-28 07:07:18 -04:00
rocky
8feb472d51 Split out Python 3.1 parser from rest.
__pkginfo__.py: use Python 3.1 bytecode fixes
2016-10-25 21:47:02 -04:00
rocky
b54a19c6ff Start Python 3.0 decoding
Fix some Python 3.1 bugs
2016-10-24 02:11:26 -04:00
rocky
0480455ae1 DRY Python 3.6 grammar rules 2016-10-22 12:29:36 -04:00
rocky
8b240a80e7 Get ready for release 2.9.0 ...
- Use xdis 3.0.0 protocol load_module. Needs bump in requirements.txt
  and _pkg_info_.py
- Start Python 1.5 decompiling - another round of work is needed to remove
  bugs
- small cleanups
2016-10-10 09:33:49 -04:00
rocky
056f600da1 Start Python 2.1 bytecode decompile 2016-10-07 22:42:30 -04:00
rocky
b52f341d46 Python 3: "or" doesn't have optional come_from 2016-10-05 22:54:50 -04:00
rocky
649e4518fe Python 3: "and" doesn't have optional come_from 2016-10-05 03:34:29 -04:00
rocky
fe46015b78 PY3 COME_FROM_LOOP bug
There are still more in sre...
2016-09-27 04:59:06 -04:00
rocky
1fc8ac4700 Interval order COME_FROMs in Python3
This bug had possibly caused lots of grammar pollution which may need
addressing.

We want to process COME_FROMs to the same offset to be in *descending*
order so we have the larger range or biggest instruction interval
last. (I think they are sorted in increasing order, but for safety
we sort them). That way, specific COME_FROM tags will match up
properly. For example, a "loop" with an "if" nested in it should have
the "loop" tag last so the grammar rule matches that properly

Adjust Python 3 grammar for more COME_FROM -> COME_FROM_LOOP. And
remove optional COME_FROM_LOOP where possible. Previously, the
optional-ness was a result of inner nestings gobbling up the
COME_FROM.

We'll probably want to go back and fix this up in Python2.
2016-09-26 09:26:51 -04:00
rocky
c0b4a5e703 Fix some Test failures
Fix py.test pytest/test_grammar.py -

Comprehension sorts of things removed from parser that
don't exist in earlier pythons

scanners/tok.py Add back in "to" when needed
2016-09-22 01:27:58 -04:00
rocky
c4e6af6e4f Add 3.6 parser 2016-09-08 05:44:45 -04:00
rocky
c7788e4545 disassemble -> ingest where appropriate
As part of tokenization for (de)parsing, we need to do something like a
disassembly, but is is really a little different.

Disassembly, strictly speaking, is done by the xdis module now.
What "ingestion" does is massage the instruction tokens to a form that is
more amenable for parsing.

In sum, ingestion is different than disassembly, although disassembly is
generally the first part of ingestion.
2016-09-04 11:43:02 -04:00
rocky
ddc5460030 Start to handle Python 3.1 bytecode 2016-08-26 20:50:08 -04:00
rocky
d8598f61e4 Start handling Python 2.2 bytecode and...
Fix some bugs in Python 2.3-2.5 bytecode handling
2016-08-13 07:16:50 -04:00
rocky
ac121076e6 Split out 3.5 parser 2016-07-27 19:09:25 -04:00
rocky
04ae94ee9e Add python 3.4 grammar checking
DRY grammar testing
2016-07-27 18:32:15 -04:00
rocky
3f7c4209d9 Start to segregate and clean up grammar 2016-07-27 17:35:21 -04:00
rocky
5ffd9b2be7 2.6 and 2.7 while1 grammar rule
Fixes issue #40
2016-07-27 13:19:42 -04:00
rocky
87dc5ad80c Start grammar checker 2016-07-27 11:02:01 -04:00
rocky
6c5bd6289f More PyPy grammar rules
* assert one and two-arg form
* trystmt

Simplify adding multiple grammar rules
2016-07-26 10:21:12 -04:00
rocky
281f429223 Handle PyPy BUILD_MAP_0 where actual kw_args > 0 2016-07-25 17:50:19 -04:00
rocky
7c4316d4fb Start handling pypy 2.7
Need to understand whether we care compiling pypy.
Pypy 2.7 list comprehensions are different and use
its own opcode.
2016-07-21 02:58:50 -04:00
rocky
063e517a7c Better parse error formatting
Start to move away for compiler-oriented terminology:
   Favor "instructions" over "tokens".
Syntax error -> Parse error.
2016-07-17 16:27:17 -04:00
rocky
0ee52aeeef Isolate pseudo op IMPORT_NAME_CONT
I think this is a holdover from pre 2.3 days. Possibly it can be dropped altogether.
2016-07-14 21:05:09 -04:00
rocky
9fdf70f68d Python 3.(4?) while1 bug
Clean up while1 grammar a tad
2016-07-11 10:18:18 -04:00
rocky
21da5e787e Start splitting off 3.4 grammar from rest 2016-07-09 21:11:14 -04:00