PseudocodeEditor / editor

The codemirror 6 editor for CIE spec Pseudocode
https://editor.pseudonaja.app
21 stars 2 forks source link

Procedure / Function with File handling #32

Closed chris7380 closed 8 months ago

chris7380 commented 8 months ago

Describe the bug when running any code that involve file handling inside a function or procedure. I get errors.

Here is a sample code:

PROCEDURE Hello DECLARE LineOfText : STRING OPENFILE "FileA.txt" FOR READ OPENFILE "FileB.txt" FOR WRITE WHILE NOT EOF("FileA.txt") DO READFILE "FileA.txt", LineOfText IF LineOfText = "" THEN WRITEFILE "FileB.txt", "----------------------------" OUTPUT "No data is added" ELSE WRITEFILE "FileB.txt", LineOfText OUTPUT LineOfText, "is added to the file" ENDIF ENDWHILE CLOSEFILE "FileA.txt" CLOSEFILE "FileB.txt" ENDPROCEDURE

CALL Hello

ERRORS I get:

PS2.runFile(args.file) PS2.run("".join(lines)) Interpretor(statements).interpret() stmt.interpret() stmt.interpret() environ.remove_variable(handle.vname) scope = Environment.scopes[i].variables AttributeError: 'dict' object has no attribute 'variables'

Coding-Cactus commented 8 months ago

I don't seem to be able to recreate this error. Could you please provide some more details? Thanks.

https://github.com/PseudocodeEditor/editor/assets/65423356/39f49ccd-f764-4f48-9b30-3e9f3a015b05

chris7380 commented 8 months ago

it was giving me this error

i think now the error is fixed