-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting on an automatic code sorter thing, got some ideas how to do it even better than previous times discovered that nobody has actually done what i did before even, but i am sure there was something, but maybe not, maybe i ended up writing it because there wasn't so, this collapses all of the code into main and test files, i will write the sorter/splitter and have it actually organise packages in a really consistent way
- Loading branch information
Showing
10 changed files
with
642 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"go/ast" | ||
"go/parser" | ||
"go/token" | ||
) | ||
|
||
func main() { | ||
src := ` | ||
package p | ||
func f(x, y int) { | ||
print(x + y) | ||
} | ||
` | ||
|
||
fset := token.NewFileSet() | ||
f, err := parser.ParseFile(fset, "", src, 0) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// Print identifiers in order | ||
for n := range ast.Preorder(f) { | ||
id, ok := n.(*ast.Ident) | ||
if !ok { | ||
continue | ||
} | ||
fmt.Println(id.Name) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
|
||
"realy.lol/context" | ||
"realy.lol/lol" | ||
) | ||
|
||
type ( | ||
B = []byte | ||
S = string | ||
E = error | ||
N = int | ||
Ctx = context.T | ||
) | ||
|
||
var ( | ||
log, chk, errorf = lol.Main.Log, lol.Main.Check, lol.Main.Errorf | ||
equals = bytes.Equal | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.