root/trunk/dparser/gram.sed

Revision 268, 2.2 kB (checked in by BCS, 7 months ago)

added a bunch of stuff for processing the D html docs into a usable grammar (it's not all there but it will be at some point, I hope)

Line 
1 # limit range
2 /bnf/,/\/pre/ s/\(.\)/\1/
3 t go
4 d
5 : go
6
7 s/\r//
8
9 # extract ops
10 /opt/ { s/<sub>opt<\/sub>/ @/g }
11
12 # dmp HTML
13 s/<[^>]*>//g
14 s/&lt;/</g
15 s/&gt;/>/g
16 s/&amp;/\&/g
17
18 # normalize WS
19 s/        /\t/g
20 s/    /\t/g
21
22 #adjust stuff
23
24 s/\([()]\)/ \1 /g
25
26 # mark PKW
27
28 s/\bdb\b/PKW_db/g
29 s/\bdd\b/PKW_dd/g
30 s/\bde\b/PKW_de/g
31 s/\bdf\b/PKW_df/g
32 s/\bdi\b/PKW_di/g
33 s/\bdl\b/PKW_dl/g
34 s/\bds\b/PKW_ds/g
35 s/\bdword\b/PKW_dword/g
36 s/\beven\b/PKW_even/g
37 s/\bfar\b/PKW_far/g
38 s/\bnaked\b/PKW_naked/g
39 s/\bnear\b/PKW_near/g
40 s/\boffest\b/PKW_offest/g
41 s/\bptr\b/PKW_ptr/g
42 s/\bseg\b/PKW_seg/g
43 s/\bword\b/PKW_word/g
44 s/\bC\b/PKW_C/g
45 s/\bD\b/PKW_D/g
46 s/\bPascal\b/PKW_Pascal/g
47 s/\bWindows\b/PKW_Windows/g
48 s/\bSystem\b/PKW_System/g
49 s/\bfailure\b/PKW_failure/g
50 s/\bexit\b/PKW_exit/g
51 s/\bsuccess\b/PKW_success/
52 s/\b__LOCAL_SIZE\b/PKW___LOCAL_SIZE/g
53
54 s/^\([^ \t]*\):/\1@@/g
55
56
57 s/>>>=/ op3RShiftAssign /g
58 s/!<>=/ opNotLessGraterEqual /g
59 s/<<=/ opLShiftAssign /g
60 s/>>=/ opRShiftAssign /g
61 s/<>=/ opLessGraterEqual /g
62 s/!<>/ opNotLessGrater /g
63 s/!>=/ opNotGraterEqual /g
64 s/!<=/ opNotLessEqual /g
65 s/>>>/ op3RShift /g
66 s/\.\.\./ opEllipsis /g
67 s/%=/ opModuloAssign /g
68 s/\/=/ opDivideAssign /g
69 s/\*=/ opStarAssign /g
70 s/&=/ opAmpersandAssign /g
71 s/+=/ opPlusAssign /g
72 s/\^=/ opCarrotAssign /g
73 s/|=/ opPipeAssign /g
74 s/-=/ opMinusAssign /g
75 s/||/ opLogicOr /g
76 s/&&/ opLogicAnd /g
77 s/!=/ opNotEqual /g
78 s/==/ opEqual /g
79 s/<=/ opLessEqual /g
80 s/>=/ opGreaterEqual /g
81 s/<>/ opLessGreater /g
82 s/!>/ opNotGrater /g
83 s/!</ opNotLess /g
84 s/<</ opLShift /g
85 s/>>/ opRShift /g
86 s/++/ opPlusPlus /g
87 s/--/ opMinusMinus /g
88 s/\.\./ opDoubleDot /g
89 s/%/ opModulo /g
90 s/&/ opAmpersand /g
91 s/\*/ opStar /g
92 s/+/ opPlus /g
93 s/-/ opMinus /g
94 s/~/ opTilde /g
95 s/,/ opComma /g
96 s/=/ opAssignment /g
97 s/?/ opQuestion /g
98 s/:/ opCollin /g
99 s/|/ opPipe /g
100 s/\^/ opCarrot /g
101 s/</ opLessThan /g
102 s/>/ opGreaterThan /g
103 s/\// opDivision /g
104 s/!/ opBang /g
105 s/\./ opDot /g
106 s/;/ opSemicolon /g
107 s/(/ opLParen /g
108 s/)/ opRParen /g
109 s/\[/ opLBrace /g
110 s/\]/ opRBrace /g
111 s/{/ opLBracket /g
112 s/}/ opRBracket /g
113 s/\$/ opDollar /g
114
115 s/@@/:/g
116 s/ *@/?/g
117
118 # mark KW as sutch
119 s/\([\t ]\)\([a-z]\)/\1KW_\2/g
120 s/KW_op/op/g
121
122 # fix typos
123 s/^const//
124 s/^override//
125 s/^static//
126 s/^auto//
127 s/^scope//
128
129 # s/^\(.*\):/;\n\1:/
130
131 s/^[\t ]*$//
132
133 s/^\t\(.*\)$/\tdummy \/ \1 |/
134
135 #done
136 p
Note: See TracBrowser for help on using the browser.