Commit 3e57c20
committed
parser: Add Token() to Node interface
Add Token() to ast Node interface so that we can more accurately
pinpoint the error position, e.g.:
func numf n:num
print n
end
numf "abc"
The example above only highlighted the end of line with the `numf` with
a message saying first argument is of wrong type, but now it also
highlights `"abc"` correctly.
This is still problematic for error sources that are whole nodes, e.g.:
numf "abc"+"123"
Should probably highlight all of `"abc"+"123"` rather than just the
first token. However, the might end up as undesired result for _very_
long expressions or multiline array / map literals.1 parent a9e1f04 commit 3e57c20
File tree
5 files changed
+217
-90
lines changed- pkg
- evaluator
- parser
5 files changed
+217
-90
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
| 792 | + | |
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| |||
0 commit comments