about summary refs log tree commit diff stats
path: root/LICENSE
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-17 08:37:37 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-17 08:37:37 +0200
commite7438365417ba4bb0cff56b44b029c797be18fe5 (patch)
tree0639539c8ca3941100ecadcf8217961c49ea7269 /LICENSE
parent0c3544d42fba23b99a07cf18f35ae25a3121765f (diff)
downloaddwm-e7438365417ba4bb0cff56b44b029c797be18fe5.tar.gz
slight change to dwm.1
Diffstat (limited to 'LICENSE')
0 files changed, 0 insertions, 0 deletions
e> 2018-10-09 19:24:02 +0200 Make the registered passes local to the ModuleGraph (#9259)' href='/ahoang/Nim/commit/compiler/docgen2.nim?h=devel&id=b97a7dbf3d1874b7dbf6b541ac57b27f8fbcd367'>b97a7dbf3 ^
9e6fb3f69 ^
d68181246 ^
b97a7dbf3 ^
01ab5948a ^

25e3e6db8 ^
01ab5948a ^

7ec7731f8 ^

25e3e6db8 ^
0d68ef9f1 ^
9eb909baf ^
01ab5948a ^
869a5aa90 ^
112b11c15 ^
0d68ef9f1 ^
9eb909baf ^
3d4084208 ^

2f43fdb83 ^
73c6efdf6 ^
01ab5948a ^
46efaf294 ^
9eb909baf ^
112b11c15 ^
9eb909baf ^
46efaf294 ^
9eb909baf ^
86556ebfd ^
813828f69 ^
d68181246 ^
01ab5948a ^

0d68ef9f1 ^
769b56276 ^
01ab5948a ^
813828f69 ^


0d68ef9f1 ^
db95fad6f ^
813828f69 ^
db95fad6f ^
01ab5948a ^


25e3e6db8 ^
86556ebfd ^
49d1822c8 ^
01ab5948a ^



226595515 ^
db95fad6f ^

97970d9dc ^


226595515 ^
db95fad6f ^

091c1b307 ^
97970d9dc ^

db95fad6f ^
813828f69 ^
01ab5948a ^
d68181246 ^
73c6efdf6 ^
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

 
                            








                                                                      
      
                                                          
 
                                                  
 
    
                               

                
                     

                 

                                                                                                          
                                                                                          
 
                                             
                 
                                                    
                       
                      
        

                          
                   
             
 
                                                                  
            
                                              
 
                                                                      
            
                                      
 
                                                    

                 
                      
                            
 


                                                        
                      
                                 
 
                                             


                   
                         
                                                                                         
                                             



                 
                                                                                 

                     


                                                                                    
                                                                                     

                     
                                                                                  

                                                                         
                                                                               
                                                    
 
                                       
         
#
#
#           The Nim Compiler
#        (c) Copyright 2012 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

# This module implements a new documentation generator that runs after
# semantic checking.

import
  options, ast, msgs, passes, docgen, lineinfos, pathutils

from modulegraphs import ModuleGraph, PPassContext

type
  TGen = object of PPassContext
    doc: PDoc
    module: PSym
    config: ConfigRef
  PGen = ref TGen

proc shouldProcess(g: PGen): bool =
  (optWholeProject in g.doc.conf.globalOptions and g.module.getnimblePkgId == g.doc.conf.mainPackageId) or
      sfMainModule in g.module.flags or g.config.projectMainIdx == g.module.info.fileIndex

template closeImpl(body: untyped) {.dirty.} =
  var g = PGen(p)
  let useWarning = sfMainModule notin g.module.flags
  let groupedToc = true
  if shouldProcess(g):
    body
    try:
      generateIndex(g.doc)
    except IOError:
      discard

proc close(graph: ModuleGraph; p: PPassContext, n: PNode): PNode =
  closeImpl:
    writeOutput(g.doc, useWarning, groupedToc)

proc closeJson(graph: ModuleGraph; p: PPassContext, n: PNode): PNode =
  closeImpl:
    writeOutputJson(g.doc, useWarning)

proc processNode(c: PPassContext, n: PNode): PNode =
  result = n
  var g = PGen(c)
  if shouldProcess(g):
    generateDoc(g.doc, n, n)

proc processNodeJson(c: PPassContext, n: PNode): PNode =
  result = n
  var g = PGen(c)
  if shouldProcess(g):
    generateJson(g.doc, n, false)

template myOpenImpl(ext: untyped) {.dirty.} =
  var g: PGen
  new(g)
  g.module = module
  g.config = graph.config
  var d = newDocumentor(AbsoluteFile toFullPath(graph.config, FileIndex module.position),
      graph.cache, graph.config, ext, module)
  d.hasToc = true
  g.doc = d
  result = g

proc myOpen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
  myOpenImpl(HtmlExt)

proc myOpenTex(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
  myOpenImpl(TexExt)

proc myOpenJson(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
  myOpenImpl(JsonExt)

const docgen2Pass* = makePass(open = myOpen, process = processNode, close = close)
const docgen2TexPass* = makePass(open = myOpenTex, process = processNode,
                                 close = close)
const docgen2JsonPass* = makePass(open = myOpenJson, process = processNodeJson,
                                  close = closeJson)

proc finishDoc2Pass*(project: string) =
  discard