Skip to content

Update nex for go modules and fix linter (revive and staticcheck) issues#58

Open
stgarrity wants to merge 9 commits intoblynn:masterfrom
userclouds:master
Open

Update nex for go modules and fix linter (revive and staticcheck) issues#58
stgarrity wants to merge 9 commits intoblynn:masterfrom
userclouds:master

Conversation

@stgarrity
Copy link

I was messing around with this testing something, and my IDE kept complaining about lint errors ... so rather than fix the output, I figured I'd patch and push it back in case useful to anyone else! Tests pass (I included a diff of the changes when I needed to update your checksum) and should be no functional change, but easier with standard tooling. Thanks for publishing this!

the diff of the old->new generated code is

```
$ diff temp_old temp_new
7a8,9
>
> // Lexer is a generated lexer.
11c13
<   ch_stop chan bool
---
>   chStop chan bool
19,25d20
<   // The 'l' and 'c' fields were added for
<   // https://github.com/wagerlabs/docker/blob/65694e801a7b80930961d70c69cba9f2465459be/buildfile.nex
<   // Since then, I introduced the built-in Line() and Column() functions.
<   l, c int
<
<   parseResult interface{}
<
39,41c34,36
<   yylex.ch_stop = make(chan bool, 1)
<   var scan func(in *bufio.Reader, ch chan frame, ch_stop chan bool, family []dfa, line, column int)
<   scan = func(in *bufio.Reader, ch chan frame, ch_stop chan bool, family []dfa, line, column int) {
---
>   yylex.chStop = make(chan bool, 1)
>   var scan func(in *bufio.Reader, ch chan frame, chStop chan bool, family []dfa, line, column int)
>   scan = func(in *bufio.Reader, ch chan frame, chStop chan bool, family []dfa, line, column int) {
64c59
<         if -1 == st || mark[st] { break }
---
>         if st == -1 || mark[st] { break }
86c81
<           if -1 == x[1] { continue }
---
>           if x[1] == -1 { continue }
98c93
<             if -1 == x[1] || mark[x[1]] { break }
---
>             if x[1] == -1 || mark[x[1]] { break }
131c126
<             case stopped = <- ch_stop: {
---
>             case stopped = <- chStop: {
138c133
<             scan(bufio.NewReader(strings.NewReader(text)), ch, ch_stop, family[matchi].nest, line, column)
---
>             scan(bufio.NewReader(strings.NewReader(text)), ch, chStop, family[matchi].nest, line, column)
155c150
<   go scan(bufio.NewReader(in), yylex.ch, yylex.ch_stop, dfas, 0, 0)
---
>   go scan(bufio.NewReader(in), yylex.ch, yylex.chStop, dfas, 0, 0)
192a188
> // NewLexer creates a new default Lexer.
197,198c193,195
< func (yyLex *Lexer) Stop() {
<   yyLex.ch_stop <- true
---
> // Stop stops the lexer.
> func (yylex *Lexer) Stop() {
>   yylex.chStop <- true
```
@purpleidea
Copy link
Collaborator

Heya, sorry for the delay in replying. I'm sorta maintaining this repo, I suppose, since the original author has kind of abandoned it, but I don't have many free (unsponsored) cycles at the moment. I'll try to get to this at some point, but no promises. Thanks for the patches!

In particular if any of these patches fix any bugs, in particular, please let me know and I'll try and prioritize that.

@stgarrity
Copy link
Author

all good, no rush -- these are all formatting changes to make it easier to use, no actual bugs :)

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.

2 participants