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
Branches
No related tags found
No related merge requests found
Pipeline #6275 failed
FROM texlive/texlive 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 tikz-uml.sty /usr/local/texlive/2020/texmf-dist/tex/latex/tikz-uml/tikz-uml.sty
COPY jsonDoclet.jar /root/jsonDoclet.jar 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 RUN mktexlsr
all: docker all: docker
docker: docker:
docker build -t projlab . docker build -t projlab/projlab .
docker tag projlab projlab/projlab
docker push projlab/projlab
\ No newline at end of file
plab plab
test.yml test.yml
tmp tmp
out
\ No newline at end of file
build: build:
mkdir -p out mkdir -p out
go build -v -race -ldflags "-linkmode external -extldflags '-static'" -a -o out/plab 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 ( ...@@ -11,10 +11,19 @@ import (
"strings" "strings"
) )
type annotated interface {
GetAnnot() []Annot
}
type InternalType struct { type InternalType struct {
Name string Name string
QualifiedName string QualifiedName string
DocString string DocString string
Annotations []Annot
}
func (i *InternalType) GetAnnot() []Annot {
return i.Annotations
} }
type Annot struct { type Annot struct {
...@@ -26,23 +35,20 @@ type Annot struct { ...@@ -26,23 +35,20 @@ type Annot struct {
} }
type Params struct { type Params struct {
Name string InternalType
Annotations []Annot
Type InternalType Type InternalType
} }
type Method struct { type Method struct {
InternalType InternalType
Parameters []Params Parameters []*Params
ReturnType InternalType ReturnType InternalType
Exceptions []struct{} // TODO Exceptions []struct{} // TODO
Annotations []Annot
Modifiers string Modifiers string
} }
type Field struct { type Field struct {
InternalType InternalType
Annotations []Annot
Modifiers string Modifiers string
Type InternalType Type InternalType
} }
...@@ -59,7 +65,6 @@ type Class struct { ...@@ -59,7 +65,6 @@ type Class struct {
realClass *Class realClass *Class
} }
Methods []*Method Methods []*Method
Annotations []Annot
Modifiers string Modifiers string
Fields []*Field Fields []*Field
} }
...@@ -144,20 +149,51 @@ func readJson(fname string) (*Class, error) { ...@@ -144,20 +149,51 @@ func readJson(fname string) (*Class, error) {
return nil, e return nil, e
} }
for i, f := range c.Fields { replaceFieldType := func(field interface{}, newType string) {
ann := f.Annotations 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 { for _, a := range ann {
if a.TypeName == "Docs" { if a.TypeName == "Docs" {
for _, e := range a.Elements { for _, e := range a.Elements {
switch e.QualifiedName { switch e.QualifiedName {
case "projlab.Docs.type": case "projlab.Docs.type":
e.Value = strings.ReplaceAll(e.Value, "\"", "") 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 return &c, e
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment