nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
highlight: only highlight the given node, not the whole AST
[nit.git]
/
src
/
highlight.nit
diff --git
a/src/highlight.nit
b/src/highlight.nit
index
323434f
..
7bce52d
100644
(file)
--- a/
src/highlight.nit
+++ b/
src/highlight.nit
@@
-53,8
+53,22
@@
class HighlightVisitor
fun enter_visit(n: ANode)
do
n.parentize_tokens
fun enter_visit(n: ANode)
do
n.parentize_tokens
- var s = n.location.file
- htmlize(s.first_token.as(not null), s.last_token.as(not null))
+
+ var f
+ var l
+
+ if n isa Token then
+ f = n
+ l = n
+ else
+ assert n isa Prod
+ f = n.first_token
+ if f == null then return
+ l = n.last_token
+ if l == null then return
+ end
+
+ htmlize(f, l)
end
private fun full_tag(anode: ANode, hv: HighlightVisitor): nullable HTMLTag
end
private fun full_tag(anode: ANode, hv: HighlightVisitor): nullable HTMLTag
@@
-352,7
+366,7
@@
redef class MModule
# The module HTML page
fun href: String
do
# The module HTML page
fun href: String
do
- return name + ".html"
+ return c_name + ".html"
end
redef fun linkto do return linkto_text(name)
end
redef fun linkto do return linkto_text(name)