Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage return in constant throws off scanner #6

Open
danmcmahill opened this issue Nov 21, 2019 · 2 comments
Open

Carriage return in constant throws off scanner #6

danmcmahill opened this issue Nov 21, 2019 · 2 comments

Comments

@danmcmahill
Copy link

danmcmahill commented Nov 21, 2019

the carriage return in this LAP file throws off the scanner.

    262     constant  define-key
    263     varref    map
    264     constant  "^M"
    267     constant  il-electric-return
    270     call      3
    271     discard

This seems to fix that but probably isn't so DOS friendly:

diff --git a/lapdecompile/main.py b/lapdecompile/main.py
index de0cd58..a4c029a 100755
--- a/lapdecompile/main.py
+++ b/lapdecompile/main.py
@@ -54,7 +54,7 @@ def control_flow(name, instructions, show_assembly, write_cfg):
 
 def deparse(path, outstream, show_assembly, write_cfg, show_grammar, show_tree):
     # Scan...
-    with open(path, "r") as fp:
+    with open(path, "r", newline="\n") as fp:
         scanner = LapScanner(fp, show_assembly=show_assembly)
         pass

a similar change would go at the very bottom of scanner.py

@danmcmahill
Copy link
Author

what's the best way for me to contribute little things like that? Fork, create branch with the patch, push, and then PR on your repo?

@rocky
Copy link
Owner

rocky commented Nov 21, 2019

Yes - the standard process is is

  1. Fork code
  2. Create branch in your repository for the change. (This is called a "topic" branch).
  3. Commit code in your repository.
  4. Put in a PR for that fork.

As for the other problems, I'll write a detailed answer of what's up later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants