Documentation
¶
Overview ¶
Package parser implements a parser for KCL source files.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseFile ¶
Example ¶
package main import ( "fmt" "kusionstack.io/kclvm-go/pkg/compiler/parser" ) func main() { const hello_k = ` # Copyright 2020 The KCL Authors. All rights reserved. import some.pkg as pkgName schema Person: name: str = 'kcl' age: int = 1 go = Person { name: 'golang' } if go.name == 'golang': print("hello KCL") ` f, err := parser.ParseFile("hello.k", hello_k) if err != nil { fmt.Println(err) return } fmt.Println(f.Module) }
Output:
Types ¶
Click to show internal directories.
Click to hide internal directories.