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

Support simple arithmetic expressions in computed fields #88

Merged
merged 8 commits into from
Oct 25, 2023

Conversation

johnstairs
Copy link
Member

@johnstairs johnstairs commented Oct 24, 2023

Adding the following to computed field expressions:

  1. Floating-point literals (1.2)
  2. Simple arithmetic ((2 + 3) ** 4)
  3. Type conversions (myfield as int)

In a future change, we add more operators like | and << and support such expressions in enum and flag value definitions.

Addresses #73

tooling/internal/cpp/types/types.go Outdated Show resolved Hide resolved
Copy link
Contributor

@hansenms hansenms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. We can do more expansion of this later, e.g. adding boolean fields....isSquare(size(arr,0) == size(arr,1)), etc. But let us let that evolve as the need arises.

@johnstairs johnstairs merged commit 2d61ba3 into main Oct 25, 2023
14 checks passed
@johnstairs johnstairs deleted the johnstairs/arithmetic-expressions-2 branch October 25, 2023 22:08
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.

None yet

3 participants