Skip to content

Commit

Permalink
Merge #77
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 17, 2024
1 parent d0e936b commit 57c2fea
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ issues:

# go generate introduces these
- path: expressions/scanner.go
linters: [deadcode, unused, varcheck, revive, stylecheck, gocritic, unconvert]
linters: [deadcode, unused, varcheck, revive, stylecheck, gocritic, unconvert, gofumpt]
linters:
enable-all: true
disable:
Expand Down
2 changes: 1 addition & 1 deletion expressions/expressions.y
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {
%%
start:
cond ';' { yylex.(*lexer).val = $1 }
| ASSIGN IDENTIFIER '=' filtered ';' {
| ASSIGN IDENTIFIER '=' cond ';' {
yylex.(*lexer).Assignment = Assignment{$2, &expression{$4}}
}
| CYCLE cycle ';' { yylex.(*lexer).Cycle = $2 }
Expand Down
32 changes: 15 additions & 17 deletions expressions/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package expressions
import "strconv"

//line scanner.go:9
var _expression_actions = []byte{
var _expression_actions []byte = []byte{
0, 1, 0, 1, 1, 1, 2, 1, 10,
1, 11, 1, 12, 1, 13, 1, 14,
1, 15, 1, 16, 1, 17, 1, 18,
Expand All @@ -16,7 +16,7 @@ var _expression_actions = []byte{
7, 2, 2, 8, 2, 2, 9,
}

var _expression_key_offsets = []int16{
var _expression_key_offsets []int16 = []int16{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 14, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25,
Expand All @@ -27,7 +27,7 @@ var _expression_key_offsets = []int16{
283, 294, 305,
}

var _expression_trans_keys = []byte{
var _expression_trans_keys []byte = []byte{
34, 115, 115, 105, 103, 110, 32, 111,
111, 112, 32, 39, 48, 57, 99, 119,
121, 99, 108, 101, 32, 104, 101, 110,
Expand Down Expand Up @@ -69,7 +69,7 @@ var _expression_trans_keys = []byte{
122, 37,
}

var _expression_single_lengths = []byte{
var _expression_single_lengths []byte = []byte{
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 19,
Expand All @@ -80,7 +80,7 @@ var _expression_single_lengths = []byte{
5, 5, 1,
}

var _expression_range_lengths = []byte{
var _expression_range_lengths []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 4,
Expand All @@ -91,7 +91,7 @@ var _expression_range_lengths = []byte{
3, 3, 0,
}

var _expression_index_offsets = []int16{
var _expression_index_offsets []int16 = []int16{
0, 2, 4, 6, 8, 10, 12, 14,
16, 18, 20, 22, 24, 26, 29, 31,
33, 35, 37, 39, 41, 43, 45, 47,
Expand All @@ -102,7 +102,7 @@ var _expression_index_offsets = []int16{
271, 280, 289,
}

var _expression_indicies = []byte{
var _expression_indicies []byte = []byte{
2, 1, 3, 0, 4, 0, 5, 0,
6, 0, 7, 0, 8, 0, 9, 0,
10, 0, 11, 0, 12, 0, 2, 13,
Expand Down Expand Up @@ -142,7 +142,7 @@ var _expression_indicies = []byte{
66, 85, 49,
}

var _expression_trans_targs = []byte{
var _expression_trans_targs []byte = []byte{
23, 0, 23, 2, 3, 4, 5, 6,
23, 8, 9, 10, 23, 11, 23, 31,
14, 19, 15, 16, 17, 18, 23, 20,
Expand All @@ -156,7 +156,7 @@ var _expression_trans_targs = []byte{
37, 54, 37, 37, 57, 13,
}

var _expression_trans_actions = []byte{
var _expression_trans_actions []byte = []byte{
47, 0, 15, 0, 0, 0, 0, 0,
7, 0, 0, 0, 11, 0, 45, 0,
0, 0, 0, 0, 0, 0, 9, 0,
Expand All @@ -170,7 +170,7 @@ var _expression_trans_actions = []byte{
66, 0, 54, 60, 0, 0,
}

var _expression_to_state_actions = []byte{
var _expression_to_state_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
Expand All @@ -181,7 +181,7 @@ var _expression_to_state_actions = []byte{
0, 0, 0,
}

var _expression_from_state_actions = []byte{
var _expression_from_state_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3,
Expand All @@ -192,7 +192,7 @@ var _expression_from_state_actions = []byte{
0, 0, 0,
}

var _expression_eof_trans = []int16{
var _expression_eof_trans []int16 = []int16{
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 15, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0,
Expand All @@ -203,11 +203,9 @@ var _expression_eof_trans = []int16{
67, 67, 50,
}

const (
expression_start int = 23
expression_first_final int = 23
expression_error int = -1
)
const expression_start int = 23
const expression_first_final int = 23
const expression_error int = -1

const expression_en_main int = 23

Expand Down
4 changes: 4 additions & 0 deletions expressions/statements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ func TestParseStatement(t *testing.T) {
require.Equal(t, "a", stmt.Assignment.Variable)
require.Implements(t, (*Expression)(nil), stmt.Assignment.ValueFn)

stmt, err = ParseStatement(AssignStatementSelector, "a = 1 == 1")
require.NoError(t, err)
require.Equal(t, "a", stmt.Assignment.Variable)

stmt, err = ParseStatement(CycleStatementSelector, "'a', 'b'")
require.NoError(t, err)
require.Equal(t, "", stmt.Cycle.Group)
Expand Down
51 changes: 26 additions & 25 deletions expressions/y.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57c2fea

Please sign in to comment.