Skip to content

Instantly share code, notes, and snippets.

@korzio
Created February 6, 2021 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korzio/10413d8a7ccf739e09545fbc784898f5 to your computer and use it in GitHub Desktop.
Save korzio/10413d8a7ccf739e09545fbc784898f5 to your computer and use it in GitHub Desktop.
Filter(func(i interface{}) bool {
tok := i.(interState)
return tok.Return != ""
}).
Map(func(_ context.Context, i interface{}) (interface{}, error) {
var tok token.Token
tok.Literal = i.(interState).Return
tok.Type = token.INT
if isOperator(tok.Literal) {
tok.Type = token.TokenType(tok.Literal)
}
return tok, nil
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment