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

Error and debug messages point to wrong line/column #77

Closed
NoelTautges opened this issue Jan 26, 2025 · 1 comment · Fixed by #78
Closed

Error and debug messages point to wrong line/column #77

NoelTautges opened this issue Jan 26, 2025 · 1 comment · Fixed by #78
Labels
bug Something isn't working

Comments

@NoelTautges
Copy link
Contributor

Describe the bug

In error messages that happen at the end of a line, the error message sometimes highlights the next line as the source of the error.

With the --debug flag, the previous/current/next characters all say the same line/column, and the column is sometimes 0.

To Reproduce
The code to reproduce your issue if applicable:

test_errors.cherri:

output(0)
alert("Test!")

Commands:

cherri test_errors.cherri --debug --hubsign

Debug output

Parsing test_errors.cherri...
Parsing includes...
### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

Done.


Invalid value 8 (number) for argument 'output' (text).
output(text output)

----- test_errors.cherri:2:1
1 | output(8)
2 | alert("Test!")
    ^
###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
) 2:0

Current Character:
LF 2:0

Next Character:
a 2:0

Current Line:
alert("Test!")
## TOKENS ##

## DEFINITIONS ##
Name: test_errors
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Client Version: 3036.0.4.2
iOS Version: 18.0

## VARIABLES ##

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###

### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

Expected behavior

I expected the error message to highlight the correct line (columns are a bit more complicated with parsing!), and the character debug messages to have the correct line/column.

Version Information:

  • Cherri version: Cherri Compiler v0.2.4-beta
  • Linux version: Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Golang version: go version go1.22.3 linux/amd64

Additional context

Thank you for making this, it's a boon to the world.

@NoelTautges NoelTautges added the bug Something isn't working label Jan 26, 2025
@NoelTautges
Copy link
Contributor Author

I have a PR for this one but I was too tired to get it up last night 😅

electrikmilk pushed a commit that referenced this issue Feb 2, 2025
* Process newline changes when advancing past newline, not when advancing to it

* Remove special newline handling from copy-paste actions

* Make `lineCharIdx` 0-based

* Fix previous/next characters on debug report

* Remove compensations for `lineIdx` incrementing when advancing to newline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant