1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2008 Jean Privat <jean@pryen.org>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
21 # first sed start from first line to line /*I*/ and remove /*.*/
22 # second sed clones /*B*/ productions, substitute /*B*/ with no_bra and delete /*N*/ lines
23 # third sed from line /*I*/ to last line and remove /*.*/
24 nit.sablecc3
: nit.sablecc3xx
25 @
test -f nit.sablecc3
&& chmod
+w nit.sablecc3 || touch nit.sablecc3
26 @echo
-n
"// This file is autogenerated, no dot modify it" > nit.sablecc3.t
27 sed
-n
-e
'1,/\/\*I\*\//{s/\/\*[BIN]\*\///g;p}' nit.sablecc3xx
>> nit.sablecc3.t
28 sed
-n
-e
'/\/\*B\*\//,/;/{s/\/\*B\*\//_nobra/g;/\/\*N\*\//d;p}' nit.sablecc3xx
>> nit.sablecc3.t
29 sed
-n
-e
'/\/\*I\*\//,$${s/\/\*[BIN]\*\///g;p}' nit.sablecc3xx
>> nit.sablecc3.t
32 sed
-n
-e
'1,/\/\*I2\*\//{s/\/\*[BIN]2\*\///g;p}' nit.sablecc3.t
>> nit.sablecc3
33 sed
-n
-e
'/\/\*B2\*\//,/;/{s/\/\*B2\*\//_withelse/g;/\/\*N2\*\//d;p}' nit.sablecc3.t
>> nit.sablecc3
34 sed
-n
-e
'/\/\*I2\*\//,$${s/\/\*[BIN]2\*\///g;p}' nit.sablecc3.t
>> nit.sablecc3
36 cp nit.sablecc3 nit.sablecc3.t
38 sed
-n
-e
'1,/\/\*I3\*\//{s/\/\*[BIN]3\*\///g;p}' nit.sablecc3.t
>> nit.sablecc3
39 sed
-n
-e
'/\/\*B3\*\//,/;/{s/\/\*B3\*\//_nopar/g;/\/\*N3\*\//d;p}' nit.sablecc3.t
>> nit.sablecc3
40 sed
-n
-e
'/\/\*I3\*\//,$${s/\/\*[BIN]3\*\///g;p}' nit.sablecc3.t
>> nit.sablecc3
43 @sed
-i
-e
'{s/\/\/#.*//}' nit.sablecc3
44 @chmod
-w nit.sablecc3
46 # Note that parser_nodes is automatically synced with the grammar
47 parser.nit
: nit.sablecc3 xss
/*.xss
48 cp parser_abs.nit parser_abs.nit.bak || true
49 ${SABLECC} -c nit.sablecc3.dump
-t xss
/main.xss
-p usermodule parser_nodes nit.sablecc3
50 diff
-u parser_abs.nit.bak parser_abs.nit
> parser_abs.patch || true
51 patch parser_nodes.nit
< parser_abs.patch || true
54 rm -f
-- nit.sablecc3 nit.sablecc3.dump parser_abs.patch || true
57 rm -f
-- parser.nit parser_abs.nit parser_abs.patch parser_abs.nit.bak parser_prod.nit parser_tables.nit lexer.nit || true