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

Feature Request, Not Show Offset Chars at Error Line! #55

Closed
QuestionPython opened this issue Feb 1, 2017 · 8 comments
Closed

Feature Request, Not Show Offset Chars at Error Line! #55

QuestionPython opened this issue Feb 1, 2017 · 8 comments

Comments

@QuestionPython
Copy link

QuestionPython commented Feb 1, 2017

Hi
Feature Request, Not Show Offset Chars at Error Line(yycolumn)!

Example error text :

example/test.ank:11: syntax error:

example/test.ank:11:** syntax error:

so 11:** , here ** why empty?
error of (lexer and parser) both just show line and not show offset current error line!

carefull link for example , have startColumn and column :

i also work on this , file anko.go :

fmt.Fprintf(os.Stderr, "%s:%d: %s\n", source, e.Pos.Line, err)
changed to :

fmt.Fprintf(os.Stderr, "%s:%d:%d %s\n", source, e.Pos.Line,e.Pos.Column, err)

so now also show offset/column of error. 👍 👍


One-Test

now again compile go build anko.go and next test with a input :

print(5***2)
print("\n")

file : http://ilestra.com/input-1.txt

now error is : example/test.ank:1:12 syntax error: unexpected ')'
say in offset 12 have error but in offset 12 code end.
and error of me available in offset 10. 👎 👎


Two-Test

also now with another test input :

print(456456);print(456***);print(5**2)
print("\n")

file : http://ilestra.com/input-2.txt

also now error say : example/test.ank:1:27 syntax error: unexpected ')'
but offset/column of my error available in 25 or 26.


Tree-Test

also again test with input :

print(456456);print( @#$%^&*(((((( ));print(5**2)
print "\n"

file : http://ilestra.com/input-3.txt

error now: example/test.ank:1:29 syntax error: unexpected $end

Output of column/offset is expected to be 28 or 29


Github delete space of my test's code. so i also upload file.

I think Lexer need some changes.
may problem is $$.SetPosition($1.Position()) in some yacc rule?

can you check/fix this?

@mattn mattn changed the title Report Bug, Not Show Offset Chars at Error Line! Feature Request, Not Show Offset Chars at Error Line! Feb 1, 2017
@mattn mattn closed this as completed in e207bf3 Feb 2, 2017
@QuestionPython
Copy link
Author

QuestionPython commented Feb 2, 2017

good, but test one also have bug.
mean :

print(5*****2)# say column 10
print(5***2) # say column 12 (this have bug)

please check/fix this.

@mattn
Copy link
Owner

mattn commented Feb 2, 2017

I can't understand your english. Please explain clearly. And please check that your english is right on Google Translate before report.

@QuestionPython
Copy link
Author

QuestionPython commented Feb 2, 2017

Please try your two input to the interpreter.

this is fixed :

print(5*****2)# say column 10


but this not fix :

print(5***2) # say column 12 (this have bug)

@mattn
Copy link
Owner

mattn commented Feb 2, 2017

because anko doesn't have such a operator. it's not a bug.

@QuestionPython
Copy link
Author

QuestionPython commented Feb 2, 2017

anko have * and ** operator.
but not have *** operator

also with input :

print(5*****2)# say column 10

this is not bug. and is right. 👍


so with input :

print(5***2) # say column 12

but just say column 10. 👎

so have bug!

@QuestionPython
Copy link
Author

QuestionPython commented Feb 2, 2017

another exampel : print(5++2)

input.txt:1:10 syntax error: unexpected NUMBER, expecting VARARG or ',' or ')'

so why say column 10?
column here is 9. but say 10.
and error is for + operator but this say ) operator.

@mattn
Copy link
Owner

mattn commented Feb 2, 2017

It's not a bug. Anko support pointer dereference.

var a = 1
p = &a
println(1***p)

This is same as:

var a = 1
p = &a
println(1**(*p))

anko parse 1***2 as 1**(*2). off course, 2 may be a broken address.

@mattn
Copy link
Owner

mattn commented Feb 2, 2017

another exampel : print(5++2)

anko can treat C like ++ operator. so it is parsed like print((5++)2) so 2 is broken letter.

So not a bug, this too.

Repository owner locked and limited conversation to collaborators Feb 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants