straightdave / lesphina

Syntax analyzer of Golang source code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lesphina Build Status

Syntax analyzer of Golang source code.

lesphina & arion

Usage

Load from source file

import "lesphina"
var les = lesphina.Read("my_go_code.go")

Now most of language entries are in les.Meta structure.

Query

q := les.Query()

var theEntryIWant Entry

// ByKind() and ByName() could be chained
// using First() or All() to resolve this query
theEntryIWant = q.ByKind(KindInterface).ByName("someName").First()

theInterfaceIWant, ok := theEntryIWant.(*Interface)

// use it if ok!

Once les := lesphina.Read() is called, les.Query() could be called many times and would return a clean query handle each time.

You can use ~ at the beginning or the end of query words in ByName():

entries := q.ByName("Prefix~").All()
entries2 := q.ByName("~Suffix").All()

About

Syntax analyzer of Golang source code


Languages

Language:Go 100.0%