Deprecate core:odin/printer + format in favor of OLS.

This commit is contained in:
Jeroen van Rijn
2024-05-24 14:49:11 +02:00
parent e2af3652c5
commit dc744411c5
7 changed files with 6 additions and 2607 deletions
+3
View File
@@ -0,0 +1,3 @@
package odin_format
#panic("The format package has been deprecated. Please look at https://github.com/DanielGavin/ols")
-41
View File
@@ -1,41 +0,0 @@
package odin_format
import "core:odin/printer"
import "core:odin/parser"
import "core:odin/ast"
default_style := printer.default_style
simplify :: proc(file: ^ast.File) {
}
format :: proc(filepath: string, source: string, config: printer.Config, parser_flags := parser.Flags{}, allocator := context.allocator) -> (string, bool) {
config := config
pkg := ast.Package {
kind = .Normal,
}
file := ast.File {
pkg = &pkg,
src = source,
fullpath = filepath,
}
config.newline_limit = clamp(config.newline_limit, 0, 16)
config.spaces = clamp(config.spaces, 1, 16)
config.align_length_break = clamp(config.align_length_break, 0, 64)
p := parser.default_parser(parser_flags)
ok := parser.parse_file(&p, &file)
if !ok || file.syntax_error_count > 0 {
return {}, false
}
prnt := printer.make_printer(config, allocator)
return printer.print(&prnt, &file), true
}