Skip to content

Commit 9d6746d

Browse files
committed
parser: move the generated parser out of the way in a dedicated module parser_sablecc
Signed-off-by: Jean Privat <[email protected]>
1 parent 29a038a commit 9d6746d

File tree

5 files changed

+35937
-35919
lines changed

5 files changed

+35937
-35919
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/src/parser/parser.nit -diff
1+
/src/parser/parser_sablecc.nit -diff
22
/src/parser/parser_prod.nit -diff
33
/src/parser/lexer.nit -diff
44
/src/parser/tables_nit.c -diff

src/parser/Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@
1616

1717
SABLECC3ALTGEN ?= sablecc3
1818

19-
all: parser.nit
19+
all: parser_sablecc.nit
2020

2121
# Preprocess the extended sablecc gramar
2222
.nit.sablecc3: nit.sablecc3xx
2323
./prescc.pl $< > $@
2424

2525
# Note that parser_nodes is no more automatically synced with the grammar
26-
parser.nit: .nit.sablecc3 xss/*.xss
26+
parser_sablecc.nit: .nit.sablecc3 xss/*.xss
2727
@${SABLECC3ALTGEN -license} >/dev/null 2>/dev/null || ( echo "***\n*** sablecc3 altgen version is needed.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***" ; exit 1 )
2828
@${SABLECC3ALTGEN} | grep altgen >/dev/null 2>/dev/null || ( echo "***\n*** $$SABLECC3ALTGEN is not the sablecc3 altgen version.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***"; exit 1 )
2929
${SABLECC3ALTGEN} -c .nit.sablecc3.dump -t xss/main.xss -p usermodule parser_nodes .nit.sablecc3
30-
mv -f -- parser.nit .parser-nofact.nit
31-
./fact_parser.pl .parser-nofact.nit > parser.nit
32-
perl -np -i.orig -e 's/([ (\[])P([A-Z])/\1A\2/g;' -e 's/"{"/"\\{"/g;' parser.nit parser_abs.nit parser_prod.nit lexer.nit
30+
mv -f -- parser_sablecc.nit .parser-nofact.nit
31+
./fact_parser.pl .parser-nofact.nit > parser_sablecc.nit
32+
perl -np -i.orig -e 's/([ (\[])P([A-Z])/\1A\2/g;' -e 's/"{"/"\\{"/g;' parser_sablecc.nit parser_abs.nit parser_prod.nit lexer.nit
3333

3434
clean:
3535
rm -f -- .nit.sablecc3 .nit.sablecc3.dump .parser-nofact.nit || true
3636

3737
maintainer-clean: clean
3838
@echo "This command is intended for maintainers to use;"
3939
@echo "it deletes files that may require special tools to rebuild."
40-
rm -f -- parser.nit parser_abs.nit parser_prod.nit lexer.nit || true
40+
rm -f -- parser_sablecc.nit parser_abs.nit parser_prod.nit lexer.nit || true
4141

4242
java: .nit.sablecc3
4343
rm -r org/nitlanguage/gen/analysis/ org/nitlanguage/gen/lexer/ org/nitlanguage/gen/node/ org/nitlanguage/gen/parser/

0 commit comments

Comments
 (0)