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

Add positional information to AST Nodes #5108

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Add positional information to AST Nodes #5108

merged 1 commit into from
Apr 29, 2024

Conversation

mattnibs
Copy link
Collaborator

@mattnibs mattnibs commented Apr 16, 2024

Closes #3899

@mattnibs mattnibs marked this pull request as ready for review April 16, 2024 22:48
@mattnibs mattnibs requested a review from a team April 17, 2024 16:04
@mattnibs
Copy link
Collaborator Author

I should say this pr comes with a couple of loose ends that will need to be addressed in later work.

  1. Template literals are a hot mess and are going to have totally wrong positions. They need to have their own ast node instead of the hacked up solution we currently use.
  2. String positions are off- they currently refer to only the contents of the string and not the quotes. This will get resolved once we fix Template literals.
  3. Positional information for operator arguments / flags is not great and this lead me to have to do hacky stuff to get positions working for various operators that rely on them (e.g., load, file, get, pool). The big problem here is that each Op implements flags or optional args in its own way are there is no standardized ast.Node for flags that is used across all ops. We should do this.

compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/parser/api.go Outdated Show resolved Hide resolved
test.zed Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/job.go Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
@mattnibs mattnibs force-pushed the ast-node-pos branch 5 times, most recently from e66470a to 8bc2035 Compare April 22, 2024 20:35
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/zed/value.go Outdated Show resolved Hide resolved
compiler/parser/support.go Outdated Show resolved Hide resolved
compiler/parser/support.go Outdated Show resolved Hide resolved
zfmt/ast.go Outdated Show resolved Hide resolved
compiler/semantic/expr.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
compiler/ast/zed/value.go Outdated Show resolved Hide resolved
compiler/ast/zed/value.go Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
@mattnibs mattnibs force-pushed the ast-node-pos branch 2 times, most recently from 7f14fc2 to d0ce3df Compare April 26, 2024 16:55
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/ast/ast.go Outdated Show resolved Hide resolved
compiler/parser/parser.peg Outdated Show resolved Hide resolved
compiler/semantic/expr.go Outdated Show resolved Hide resolved
compiler/semantic/op.go Outdated Show resolved Hide resolved
@mattnibs mattnibs merged commit 183e432 into main Apr 29, 2024
3 checks passed
@mattnibs mattnibs deleted the ast-node-pos branch April 29, 2024 17:29
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.

panic: reflect.Set: value of type *ast.Cast is not assignable to type zed.Any
2 participants