1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Program used to test the Nit highlighter
21 class TestHighlightVisitor
23 redef fun hrefto
(e
) do
28 redef fun do_work
(mainmodule
, mmodules
, mb
)
30 var v
= new TestHighlightVisitor
32 <meta charset="utf-8">
33 <style type="text/css">
40 for mm
in mmodules
do for cd
in mm
.mclassdefs
do for pd
in cd
.mpropdefs
do
41 var n
= mb
.mpropdef2node
(pd
)
42 if not n
isa APropdef then continue
43 var hl
= new TestHighlightVisitor
45 print
"<h1 id=\"{pd.c_name}\
">{pd.full_name}</h1>"
47 hl
.html
.write_to
(stdout
)
52 var thlv
= new THLVisitor
54 var n
= mb
.mmodule2node
(mm
)
59 print
"</body></html>"
64 var seen
= new HashSet[String]
68 if not seen
.has
(cn
) then
71 var hl
= new TestHighlightVisitor
73 print
"<h2>AST node: {cn} at {n.location}</h2>"
75 hl
.html
.write_to
(stdout
)