This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathMakefile
55 lines (47 loc) · 1.87 KB
/
Makefile
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
51
52
53
54
55
SHELL = bash
grammars/php.cson: src/php-functions.coffee src/php-constants.coffee
coffee src/php.coffee
tmp/php_manual_en.tar.gz:
curl -L http://de2.php.net/get/php_manual_en.tar.gz/from/this/mirror -o $@
tmp/php_chunked_xhtml/index.html: tmp/php_manual_en.tar.gz
cd tmp && tar xzf ../$<
src/php-functions.coffee: tmp/php_chunked_xhtml/index.html Makefile
echo "# do not make changes here, it is generated from php manual" > $@
echo "{makeWords} = require 'atom-syntax-tools'" >> $@
echo >> $@
echo "module.exports =" >> $@
CURRENT="" ; \
cat tmp/php-chunked-xhtml/function.* | perl -n -e 'if (m{div class="up"><a href="(ref|cubrid.*?|.*?)\.([\w\-]+)\.}) { $$module = $$2 }; m{h1 class="refname">([^<]*)} && print "$$module $$1\n"' \
| grep -v "::" | sort | while read MODULE FUNCTION ; do \
if [[ "$$MODULE" != "$$CURRENT" ]] ; then \
if [[ -n "$$CURRENT" ]] ; then \
echo " \"\"\"" >> $@ ;\
echo >> $@ ;\
fi ; \
echo " '$$MODULE': makeWords \"\"\"" >> $@ ;\
CURRENT=$$MODULE ;\
fi ;\
echo " $$FUNCTION" >> $@ ;\
done
echo " \"\"\"" >> $@
src/php-constants.coffee: tmp/php_chunked_xhtml/index.html Makefile
echo "# do not make changes here, it is generated from php manual" > $@
echo "{makeWords} = require 'atom-syntax-tools'" >> $@
echo >> $@
echo "module.exports =" >> $@
CURRENT="" ; \
grep "^[ ]*<strong><code>" tmp/php-chunked-xhtml/*constants* | perl -n -e 'm{^.*/(.*?)\.constants.*<code>([^<]*?)</code>} && print "$$1 $$2\n"' | sort | while read MODULE FUNCTION ; do \
if [[ "$$MODULE" != "$$CURRENT" ]] ; then \
if [[ -n "$$CURRENT" ]] ; then \
echo " \"\"\"" >> $@ ;\
echo >> $@ ;\
fi ; \
echo " '$$MODULE': makeWords \"\"\"" >> $@ ;\
CURRENT=$$MODULE ;\
fi ;\
echo " $$FUNCTION" >> $@ ;\
done
echo " \"\"\"" >> $@
#src/php-builtin-classes.coffee: Makefile
#load json:
#http://php.net/manual/en/search-index.json