Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/eventlist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ jobs:
test "$COVERAGE_INT" -gt 975
working-directory: ./tools/eventlist

# Temporarily disabled until we move on codeclimate
- name: Upload coverage to Codecov
if: false
uses: codecov/codecov-action@v5
with:
files: ./tools/eventlist/build/cover.out
Expand Down
74 changes: 49 additions & 25 deletions tools/eventlist/pkg/eval/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ func (v *Value) getValue() (Value, error) {
// the assignment process.
//
// Parameters:
// v1 - The Value to be assigned to the receiver.
//
// v1 - The Value to be assigned to the receiver.
//
// Returns:
// An error if the assignment fails or if the receiver is not a variable.
//
// An error if the assignment fails or if the receiver is not a variable.
func (v *Value) setValue(v1 *Value) error {
if v.v == nil {
return typeError("not a variable", "")
Expand All @@ -78,10 +80,12 @@ func (v *Value) setValue(v1 *Value) error {
// If the receiver Value is not of type List, it returns a type error.
//
// Parameters:
// v1 - The Value to be added to the list.
//
// v1 - The Value to be added to the list.
//
// Returns:
// An error if the receiver Value is not of type List, otherwise nil.
//
// An error if the receiver Value is not of type List, otherwise nil.
func (v *Value) addList(v1 Value) error {
if v.t == Nix {
v.t = List
Expand Down Expand Up @@ -280,11 +284,13 @@ func (v *Value) Function(v1 *Value) error {
// right-shifted by the offset and stored back in the Value struct.
//
// Parameters:
// sz - The number of bytes to extract.
// off - The starting byte position for extraction.
//
// sz - The number of bytes to extract.
// off - The starting byte position for extraction.
//
// Returns:
// An error if the type of the value is not Integer.
//
// An error if the type of the value is not Integer.
func (v *Value) Extract(sz uint32, bigEndian bool, off uint32) error {
if v.t != Integer {
return typeError("Extract", "")
Expand Down Expand Up @@ -659,10 +665,12 @@ func (v *Value) Mod(v1 *Value) error {
// compatible, a typeError is returned.
//
// Parameters:
// v1 - The value to be added to the receiver.
//
// v1 - The value to be added to the receiver.
//
// Returns:
// An error if the types are not compatible for addition, otherwise nil.
//
// An error if the types are not compatible for addition, otherwise nil.
func (v *Value) Add(v1 *Value) error {
switch v.t {
case Integer:
Expand Down Expand Up @@ -750,10 +758,12 @@ func (v *Value) Shl(v1 *Value) error {
// it returns a typeError.
//
// Parameters:
// v1 - The Value containing the integer by which the receiver's integer value will be shifted.
//
// v1 - The Value containing the integer by which the receiver's integer value will be shifted.
//
// Returns:
// An error if either value is not of type Integer, otherwise nil.
//
// An error if either value is not of type Integer, otherwise nil.
func (v *Value) Shr(v1 *Value) error {
if v.t != Integer || v1.t != Integer {
return typeError("shr", "")
Expand Down Expand Up @@ -885,10 +895,12 @@ func (v *Value) LessEqual(v1 *Value) error {
// The resulting type always is forced to be Integer.
//
// Parameters:
// v1 *Value - The Value to compare with the current Value.
//
// v1 *Value - The Value to compare with the current Value.
//
// Returns:
// error - Returns a type error if the types of the Values are incompatible for comparison, otherwise returns nil.
//
// error - Returns a type error if the types of the Values are incompatible for comparison, otherwise returns nil.
func (v *Value) Greater(v1 *Value) error {
switch v.t {
case Integer:
Expand Down Expand Up @@ -999,10 +1011,12 @@ func (v *Value) GreaterEqual(v1 *Value) error {
// The resulting type always is forced to be Integer.
//
// Parameters:
// v1 - The Value object to compare with the current Value object.
//
// v1 - The Value object to compare with the current Value object.
//
// Returns:
// error - An error if the types are not supported for comparison, otherwise nil.
//
// error - An error if the types are not supported for comparison, otherwise nil.
func (v *Value) Equal(v1 *Value) error {
switch v.t {
case Integer:
Expand Down Expand Up @@ -1057,10 +1071,12 @@ func (v *Value) Equal(v1 *Value) error {
// The resulting type always is forced to be Integer.
//
// Parameters:
// v1 (*Value): The Value object to compare with.
//
// v1 (*Value): The Value object to compare with.
//
// Returns:
// error: An error if the types are incompatible, otherwise nil.
//
// error: An error if the types are incompatible, otherwise nil.
func (v *Value) NotEqual(v1 *Value) error {
switch v.t {
case Integer:
Expand Down Expand Up @@ -1112,10 +1128,12 @@ func (v *Value) NotEqual(v1 *Value) error {
// The result of the operation is stored in the current Value.
//
// Parameters:
// v1 - The Value to perform the bitwise AND operation with.
//
// v1 - The Value to perform the bitwise AND operation with.
//
// Returns:
// An error if either Value is not of Integer type, otherwise nil.
//
// An error if either Value is not of Integer type, otherwise nil.
func (v *Value) And(v1 *Value) error {
if v.t != Integer || v1.t != Integer {
return typeError("And", "")
Expand All @@ -1130,10 +1148,12 @@ func (v *Value) And(v1 *Value) error {
// receiver's integer field.
//
// Parameters:
// v1 - The Value to XOR with the receiver.
//
// v1 - The Value to XOR with the receiver.
//
// Returns:
// An error if either Value is not of type Integer, otherwise nil.
//
// An error if either Value is not of type Integer, otherwise nil.
func (v *Value) Xor(v1 *Value) error {
if v.t != Integer || v1.t != Integer {
return typeError("Xor", "")
Expand Down Expand Up @@ -1165,10 +1185,12 @@ func (v *Value) Or(v1 *Value) error {
// as an Integer (1 for true, 0 for false).
//
// Parameters:
// v1 - The Value to perform the logical AND operation with.
//
// v1 - The Value to perform the logical AND operation with.
//
// Returns:
// error - Returns a typeError if either Value is not of type Integer or Floating.
//
// error - Returns a typeError if either Value is not of type Integer or Floating.
func (v *Value) LogAnd(v1 *Value) error {
if v.t != Integer && v.t != Floating || v1.t != Integer && v1.t != Floating {
return typeError("LogAnd", "")
Expand All @@ -1189,10 +1211,12 @@ func (v *Value) LogAnd(v1 *Value) error {
// otherwise, the result is 0 (false). The result is stored in the current Value (v) as an Integer type.
//
// Parameters:
// v1 - The Value to perform the logical OR operation with.
//
// v1 - The Value to perform the logical OR operation with.
//
// Returns:
// error - Returns a typeError if either Value is not of type Integer or Floating.
//
// error - Returns a typeError if either Value is not of type Integer or Floating.
func (v *Value) LogOr(v1 *Value) error {
if v.t != Integer && v.t != Floating || v1.t != Integer && v1.t != Floating {
return typeError("LogOr", "")
Expand Down
6 changes: 4 additions & 2 deletions tools/eventlist/pkg/eval/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func GetVar(n string) (*Variable, error) {
// - i: The integer value to assign to the variable.
//
// Returns:
// A pointer to the newly created Variable instance.
//
// A pointer to the newly created Variable instance.
func SetVarI(n string, i int64) *Variable {
val := Value{t: Integer, i: i}
v := new(Variable)
Expand All @@ -99,7 +100,8 @@ func SetVarI(n string, i int64) *Variable {
// - val: The value to be assigned to the variable.
//
// Returns:
// A pointer to the newly created Variable.
//
// A pointer to the newly created Variable.
func SetVar(n string, val Value) *Variable {
v := new(Variable)
v.n = n
Expand Down
Loading