Skip to content
Snippets Groups Projects
Commit 85cc78fe authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

add stuff

parent 4aa20186
No related branches found
No related tags found
No related merge requests found
Pipeline #6275 failed
FROM texlive/texlive
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get -y upgrade && apt-get -y install openjdk-11-jdk-headless hunspell-hu hunspell-en-gb hunspell-en-us
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get -y upgrade && apt-get -y install openjdk-11-jdk-headless hunspell hunspell-hu hunspell-en-gb hunspell-en-us
COPY tikz-uml.sty /usr/local/texlive/2020/texmf-dist/tex/latex/tikz-uml/tikz-uml.sty
COPY jsonDoclet.jar /root/jsonDoclet.jar
COPY plab/out/plab /usr/bin/plab
COPY ./plab/out/plab /usr/bin/plab
ADD robinbird/build/distributions/robinbird.tar /
RUN mktexlsr
all: docker
docker:
docker build -t projlab .
docker tag projlab projlab/projlab
docker push projlab/projlab
\ No newline at end of file
docker build -t projlab/projlab .
plab
test.yml
tmp
out
\ No newline at end of file
build:
mkdir -p out
go build -v -race -ldflags "-linkmode external -extldflags '-static'" -a -o out/plab
podman:
podman run --rm -it -v $PWD:/build golang:alpine sh -c "apk add make build-base; cd /build; make"
\ No newline at end of file
......@@ -11,10 +11,19 @@ import (
"strings"
)
type annotated interface {
GetAnnot() []Annot
}
type InternalType struct {
Name string
QualifiedName string
DocString string
Annotations []Annot
}
func (i *InternalType) GetAnnot() []Annot {
return i.Annotations
}
type Annot struct {
......@@ -26,23 +35,20 @@ type Annot struct {
}
type Params struct {
Name string
Annotations []Annot
InternalType
Type InternalType
}
type Method struct {
InternalType
Parameters []Params
Parameters []*Params
ReturnType InternalType
Exceptions []struct{} // TODO
Annotations []Annot
Modifiers string
}
type Field struct {
InternalType
Annotations []Annot
Modifiers string
Type InternalType
}
......@@ -59,7 +65,6 @@ type Class struct {
realClass *Class
}
Methods []*Method
Annotations []Annot
Modifiers string
Fields []*Field
}
......@@ -144,20 +149,51 @@ func readJson(fname string) (*Class, error) {
return nil, e
}
for i, f := range c.Fields {
ann := f.Annotations
replaceFieldType := func(field interface{}, newType string) {
field.(*Field).Type.Name = newType
}
replaceMethodType := func(field interface{}, newType string) {
field.(*Method).ReturnType.Name = newType
}
replaceMethodParamType := func(field interface{}, newType string) {
field.(*Params).Type.Name = newType
}
do := func(arr []annotated, replace func(field interface{}, newType string)) {
for i, f := range arr {
ann := f.GetAnnot()
for _, a := range ann {
if a.TypeName == "Docs" {
for _, e := range a.Elements {
switch e.QualifiedName {
case "projlab.Docs.type":
e.Value = strings.ReplaceAll(e.Value, "\"", "")
c.Fields[i].Type.Name = e.Value
replace(arr[i], e.Value)
}
}
}
}
}
}
tmp := make([]annotated, 0, len(c.Fields))
for i := range tmp {
tmp[i] = &c.Fields[i].InternalType
}
do(tmp, replaceFieldType)
tmp = make([]annotated, 0, len(c.Methods))
for i := range tmp {
tmp[i] = &c.Methods[i].InternalType
}
do(tmp, replaceMethodType)
tmp = make([]annotated, 0)
for i := range c.Methods {
for j := range c.Methods[i].Parameters {
tmp = append(tmp, c.Methods[i].Parameters[j])
}
}
do(tmp, replaceMethodParamType)
return &c, e
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment