Conversation
shivansh
left a comment
There was a problem hiding this comment.
This looks great! Please address the comments below.
| return strconv.ParseUint(string(T.Lit), 10, 64) | ||
| } | ||
|
|
||
| var ( |
There was a problem hiding this comment.
I'm not sure but are the variables holding compiled regular expressions required to be global ?
There was a problem hiding this comment.
of course it is not required to be global
in the same time it might be compiled once on package init and used everywhere later
| sdtPlaceholders = regexp.MustCompile(`\$(\d+)`) | ||
| sdtReplacement = []byte("X[$1]") | ||
| ) | ||
|
|
There was a problem hiding this comment.
I think a small comment here explaining the functionality of SDTVal() would be helpful in future. Something along the lines of -
// SDTVal converts a handwritten action expression into an equivalent expression
// usable by gocc during runtime.
// For e.g. the expression `<< $0.(int64) + $2.(int64), nil >>` is converted to
// `X[0].(int64) + X[2].(int64), nil`. `X` usually represents a slice of
// attributes in the code generated by gocc.
There was a problem hiding this comment.
there was no such explanation in the original code, so I do did not add it :)
are you sure any explanation is required here? this code is completely self-explaining FMPOV
c1d3e66 to
5fbf58b
Compare
$§wil be replaces by the name of the entity on preparing SDT call