package main
import "github.com/byte-mug/semiparse/scanlist"
import "github.com/byte-mug/semiparse/parser"
import "github.com/byte-mug/semiparse/cparse"
import "github.com/byte-mug/semiparse/ecparse"
import "strings"
import "fmt"
//import "text/scanner"
const src = `
//object.getX:int(arg);
i[].Array;
//a = b + c;
`
func buildParser() *parser.Parser {
p := new(parser.Parser).Construct()
cparse.RegisterExpr(p)
cparse.RegisterType(p)
cparse.RegisterExprCast(p)
ecparse.RegisterExprOCX(p)
return p
}
func main() {
s := new(scanlist.BaseScanner)
s.Init(strings.NewReader(src))
s.Dict = cparse.CKeywords
l := s.Next()
p := buildParser()
res := p.Match("Expr",l)
fmt.Println(res.Result)
fmt.Println(res.Data)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
extensible code parser and infrastructure for C-like language.
License
byte-mug/semiparse
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
extensible code parser and infrastructure for C-like language.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published