forked from Red54/plantumlqeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
language.sh
executable file
·50 lines (44 loc) · 1.16 KB
/
language.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#set -x
#
# Output
# ;skinparameter <- Prefix => SKINPARAMETER
# ;379 <- No of items
# ActivityArrowColor <- Item 1 => SKINPARAMETER_ACTIVITYARRORCOLOR = "ActivityArrowColor";
# ActivityArrowFontColor
# ActivityArrowFontName
# ActivityArrowFontSize
echo "#ifndef LANGUAGE_H"
echo "#define LANGUAGE_H"
echo
echo "// Generated with $0 (see java plantuml.jar -language)"
echo
echo "#include <QString>"
echo "#include <QRegExp>"
prefix=""
java -jar ${1:-plantuml.jar} -language | while read line; do
if [[ "${line}" =~ \;[a-z]+ ]]; then
if [ -n "${all}" ]; then
echo "const QRegExp ${prefix}_KEYWORDS = QRegExp(\"\\\\b(${all})\\\\b\");"
fi
prefix=$(echo ${line^^} | tr -d ';')
all=""
echo
echo "// $(echo ${line} | tr -d ';') keywords"
continue
elif [[ "${line}" =~ \;[0-9]+ ]]; then
continue
elif [ -z "${line}" -o "${line}" = ";EOF" ]; then
continue
else
suffix=$(echo ${line^^} | tr -d '@!'| tr -s ' ' '_')
echo "const QString ${prefix}_${suffix} = \"${line}\";"
if [ -z "${all}" ]; then
all="${line}"
else
all="${all}|${line}"
fi
fi
done
echo
echo "#endif // LANGUAGE_H"