source: other-projects/gli-rsyntax-textarea/REGENERATE-FLEX.sh@ 29358

Last change on this file since 29358 was 25801, checked in by ak19, 12 years ago

REGENERATE-FLEX did not correctly handle substitutions yyreset() and zzRefill(). It incorrectly also changed functions that called these files, which we did not want. The revised 'sed' expression now looks for the declaring type information infront of the function names as a way to differeniate these from other locations, which call the function definitions.

File size: 1.3 KB
Line 
1#!/bin/bash
2
3pushd src/java/org/fife/ui/rsyntaxtextarea/modes/ > /dev/null
4
5
6editedFlex=0;
7unchangedFlex=0;
8
9flex_jar=$GEXTRSYNTAX/lib/JFlex.jar
10
11if [ "x$GSDLOS" = "xcygwin" ] ; then
12 flex_jar=`cygpath -w $flex_jar | sed 's/\\\\/\\\\\\\\/g'`
13elif [ "x$GSDLOS" = "xmingw" ] ; then
14 flex_jar=`echo $flex_jar | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
15fi
16
17
18for f in *.flex ; do
19# echo "Checking $f ..."
20 j="${f%.*}.java"
21 if [ "$f" -nt "$j" ] ; then
22 echo ""
23 echo "****"
24 echo "* Regenerating $f"
25 echo "****"
26 echo ""
27
28 java -cp "$flex_jar" JFlex.Main $f
29 #bash -x jflex $f
30
31 cat $j \
32 | sed 's/public final void yyreset/public final void YYRESETOLD/g' \
33 | sed 's/YYRESETNEW/yyreset/g' \
34 | sed 's/private boolean zzRefill/private boolean ZZREFILLOLD/g' \
35 | sed 's/ZZREFILLNEW/zzRefill/g' \
36 > $j.new
37
38 /bin/mv $j.new $j
39 ((editedFlex +=1))
40
41 else
42# echo "... does not need to be regenerated"
43 ((unchangedFlex +=1))
44 fi
45
46
47done
48
49echo "===="
50echo "$unchangedFlex Flex files unchanged"
51echo ""
52
53if [ $editedFlex -ge "1" ] ; then
54 echo ""
55 echo "****"
56 echo "* $editedFlex flex file(s) regenerated."
57 echo "* Use ./COMPILE.sh to recompile the modified code and regenerate the jar file"
58 echo "****"
59 echo ""
60fi
61
62popd > /dev/null
63
Note: See TracBrowser for help on using the repository browser.