mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
doc: vfmt and make compile
This commit is contained in:
parent
cb43084e26
commit
78e28a72ed
@ -14,7 +14,7 @@ import v.util
|
|||||||
|
|
||||||
pub struct Doc {
|
pub struct Doc {
|
||||||
pub mut:
|
pub mut:
|
||||||
input_path string = ''
|
input_path string
|
||||||
prefs &pref.Preferences = &pref.Preferences{}
|
prefs &pref.Preferences = &pref.Preferences{}
|
||||||
table &table.Table = &table.Table{}
|
table &table.Table = &table.Table{}
|
||||||
pub_only bool = true
|
pub_only bool = true
|
||||||
@ -34,10 +34,10 @@ pub:
|
|||||||
pub struct DocNode {
|
pub struct DocNode {
|
||||||
pub mut:
|
pub mut:
|
||||||
name string
|
name string
|
||||||
content string = ''
|
content string
|
||||||
comment string
|
comment string
|
||||||
pos DocPos = DocPos{-1, -1}
|
pos DocPos = DocPos{-1, -1}
|
||||||
file_path string = ''
|
file_path string
|
||||||
attrs map[string]string
|
attrs map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,9 @@ pub fn (d Doc) get_name(stmt ast.Stmt) string {
|
|||||||
pub fn new_vdoc_preferences() &pref.Preferences {
|
pub fn new_vdoc_preferences() &pref.Preferences {
|
||||||
// vdoc should be able to parse as much user code as possible
|
// vdoc should be able to parse as much user code as possible
|
||||||
// so its preferences should be permissive:
|
// so its preferences should be permissive:
|
||||||
return &pref.Preferences{ enable_globals: true }
|
return &pref.Preferences{
|
||||||
|
enable_globals: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(input_path string) Doc {
|
pub fn new(input_path string) Doc {
|
||||||
@ -424,13 +426,8 @@ fn (mut d Doc) generate() ?Doc {
|
|||||||
ast.InterfaceDecl { node.attrs['category'] = 'Interfaces' }
|
ast.InterfaceDecl { node.attrs['category'] = 'Interfaces' }
|
||||||
ast.StructDecl { node.attrs['category'] = 'Structs' }
|
ast.StructDecl { node.attrs['category'] = 'Structs' }
|
||||||
ast.TypeDecl { node.attrs['category'] = 'Typedefs' }
|
ast.TypeDecl { node.attrs['category'] = 'Typedefs' }
|
||||||
ast.FnDecl {
|
ast.FnDecl { node.attrs['category'] = if node.attrs['parent'] in ['void', ''] ||
|
||||||
node.attrs['category'] = if node.attrs['parent'] in ['void', ''] || !node.attrs.exists('parent') {
|
!node.attrs.exists('parent') { 'Functions' } else { 'Methods' } }
|
||||||
'Functions'
|
|
||||||
} else {
|
|
||||||
'Methods'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {}
|
else {}
|
||||||
}
|
}
|
||||||
d.contents << node
|
d.contents << node
|
||||||
|
Loading…
Reference in New Issue
Block a user