Skip to content

Enable interactive error reporting in a more standard manner #1957

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

Conversation

GillesDuvert
Copy link
Contributor

@GillesDuvert GillesDuvert commented Dec 20, 2024

During interactive input one must see this:

GDL> n[z,]=3
     ^
% Syntax error.

or the same error in a procedure / include ('@')

GDL> test_const

n[1,] = 1
     ^
% Syntax error.
  At: /XXXX/YYYY/const.pro, Line 2
No parser output generated.
% Procedure not found: TEST_CONST
% Execution halted at: $MAIN$          
GDL> 

This is more or less what this patch does.

GDL> a="a string"
GDL> a,dist(3), cos(!dpi)
a string
       0.0000000       1.0000000       1.0000000
       1.0000000       1.4142135       1.4142135
       1.0000000       1.4142135       1.4142135
      -1.0000000000000000

not necessary super useful but works with IDL.
but

GDL> !x.tickv
% AutoPrint currently impossible on structure/objects elements.

because ANTLR2 delivers the expression to a too-specialized routine and breaking this is utterly dangerous.

In summary, waiting for ANTLR4, "implied print" handling (not expressed in the ANTLR2 syntax but treated at try{}catch() level) make things more complicated than necessary.

… cw_field to work correctly (atv uses cw_field for its editables text fields).

behaviour is now OK for cw_field and change suggested by @klimpel should still be OK too.
…or used by IDL, but not easily nor completely as the implied_print patches plus some other languages features not directly implementable in the ANTLR2 parser ( solved in the ANTLR4 parser ) ad at lot of complications.
…eractively things like

GDL> dist(3), cos(!dpi)
which are implied_print valid.
@GillesDuvert GillesDuvert merged commit 33938af into gnudatalanguage:master Dec 20, 2024
6 of 7 checks passed
@GillesDuvert GillesDuvert deleted the solve_59_reporting_syntax_error_online branch December 20, 2024 22:32
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

Successfully merging this pull request may close these issues.

Remove dangerous code in ANTLR gdlc.g no lineno info in error mesgs using @ (also wrong filename in error message)
1 participant