-
Notifications
You must be signed in to change notification settings - Fork 48
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
Report entity name to SDT function #85
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Please address the comments below.
@@ -91,33 +91,14 @@ func (T *Token) UintValue() (uint64, error) { | |||
return strconv.ParseUint(string(T.Lit), 10, 64) | |||
} | |||
|
|||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but are the variables holding compiled regular expressions required to be global ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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