summaryrefslogtreecommitdiffstats
path: root/java/etc/make_javajet_sed.sed
blob: a55afe547d7e8613b8d6aad013e89f2dacc60525 (plain)
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
#
# sed script to be run on the output of the javajet builder to make the generated java
# more comprehensible for development/debugging purposes
# the script generates a sed script which can be run on the original input in order
# to substitute all the TEXT_ constant references to their values
#
# e.g.
# 1) cat SDOClass.java | grep "protected final String TEXT_" | sed -f <thisfile> > SDOClass.sed
# 2) cat SDOClass.java | sed -f SDOClass.sed > SDOClassSed.java
# then the file can be formatted in eclipse say, and fix up the class name to SDOClassSed
# and you should be able to see what's going on better
#
#
# add to the output script a line which removes the constant declarations
1i\
/protected final String TEXT_/d
# arrange the var name/value pairs regularly
/protected final String TEXT_/ s/[ \t]*protected final String TEXT_\([0-9][0-9]*\) = \(.*\);[ \t]*$/TEXT_\1 \2/
# escape special characters in the value
s/\\/\\\\/g
s/\//\\\//g
s/\'/\\\'/g
# build the substitution pattern for line 2 of the output script
s/ /\\\(\[\^0-9\]\\\)\//
s/$/\\1\//
s/^/\/generate(Object argument)\/,$s\//