Browse Source

Fixes and updates.

Mark Sibly 8 years ago
parent
commit
59ac7616c0

+ 8 - 4
src/mx2cc/class.monkey2

@@ -743,16 +743,20 @@ Class ClassScope Extends Scope
 	End
 	
 	Property Name:String() Override
-
+		
 		Local args:=""
 		For Local arg:=Eachin ctype.types
 			args+=","+arg.Name
 		Next
 		If args args="<"+args.Slice( 1 )+">"
+			
+		Local ident:=ctype.cdecl.ident
+		If ident.StartsWith( "@" ) ident=ident.Slice( 1 ).Capitalize()
+			
+		Return outer.Name+"."+ident+args
 		
-		If ctype.cdecl.ident.StartsWith( "@" ) Return ctype.cdecl.ident.Slice( 1 ).Capitalize()+args
-		
-		Return outer.Name+"."+ctype.cdecl.ident+args
+'		If ctype.cdecl.ident.StartsWith( "@" ) Return outer.Name+"."+ctype.cdecl.ident.Slice( 1 ).Capitalize()+args
+'		Return outer.Name+"."+ctype.cdecl.ident+args
 	End
 	
 	Property TypeId:String() Override

+ 0 - 1
src/mx2cc/errors.monkey2

@@ -125,7 +125,6 @@ End
 
 Function SemantError( func:String )
 	Print "~n".Join( GetDebugStack() )
-	DebugStop()
 	Throw New SemantEx( func+" Internal Error" )
 End
 

+ 8 - 0
src/mx2cc/func.monkey2

@@ -629,7 +629,14 @@ Class FuncListType Extends Type
 	End
 	
 	Method ToString:String() Override
+		
+		If funcs.Length>1 Return flist.ident
+
+		Local str:=""
+		If types str="<"+Join( types )+">"
+		Return flist.ident+str+":"+funcs[0].ftype.ToString()
 
+#rem		
 		Local str:=""
 		If types str="<"+Join( types )+">"
 		
@@ -643,6 +650,7 @@ Class FuncListType Extends Type
 		Return flist.ident+str+"["+Join( ftypes )+"]" 
 	
 '		Return flist.ident+str+"(...)"
+#end
 	End
 	
 	Property Name:String() Override

+ 21 - 23
src/mx2cc/mx2cc.monkey2

@@ -5,9 +5,7 @@ Namespace mx2cc
 
 #Import "mx2"
 
-#If __CONFIG__="debug"
-
-'Use newdocs in debug!
+'Use newdocs
 #Import "newdocs/docsnode"
 #Import "newdocs/docsbuffer"
 #Import "newdocs/docsmaker"
@@ -15,18 +13,14 @@ Namespace mx2cc
 
 Using mx2.newdocs
 
-#Else
-
-'Use olddocs in release!
-#Import "docs/docsmaker"
-#Import "docs/jsonbuffer"
-#Import "docs/minimarkdown"
-#Import "docs/markdownbuffer"
-#Import "docs/manpage"
-
-Using mx2.docs
-
-#endif
+'Use olddocs
+'#Import "docs/docsmaker"
+'#Import "docs/jsonbuffer"
+'#Import "docs/minimarkdown"
+'#Import "docs/markdownbuffer"
+'#Import "docs/manpage"
+'
+'Using mx2.docs
 
 #Import "geninfo/geninfo"
 
@@ -38,9 +32,12 @@ Const MX2CC_VERSION_EXT:=""
 
 Global StartDir:String
 
-'Const TestArgs:="mx2cc makedocs monkey std mojo"
- 
-Const TestArgs:="mx2cc makeapp src/mx2cc/test.monkey2"
+Const TestArgs:="mx2cc makemods"
+
+'Const TestArgs:="mx2cc makedocs monkey"' std mojo mojo3d"
+'Const TestArgs:="pyro-framework pyro-gui pyro-scenegraph pyro-tiled"
+'Const TestArgs:="mx2cc makedocs"
+'Const TestArgs:="mx2cc makeapp src/mx2cc/test.monkey2"
 
 'To build with old mx2cc...
 '
@@ -269,8 +266,8 @@ Function MakeMods:Bool( args:String[] )
 	Return errs=0
 End
 
-#If __CONFIG__="release"
-
+'olddocs...
+#rem
 Function MakeDocs:Bool( args:String[] )
 
 	Local opts:=New BuildOpts
@@ -339,9 +336,10 @@ Function MakeDocs:Bool( args:String[] )
 	
 	Return True
 End
+#end
 
-#Else
 
+'newdocs...
 Function MakeDocs:Bool( args:String[] )
 
 	Local opts:=New BuildOpts
@@ -399,9 +397,11 @@ Function MakeDocs:Bool( args:String[] )
 	For Local modid:=Eachin EnumModules()
 
 		Local index:=LoadString( "docs/modules/"+modid+"/manual/index.js" )
+		If index and Not index.Trim() Print "module OOPS modid="+modid
 		If index buf.Push( index )
 		
 		index=LoadString( "docs/modules/"+modid+"/module/index.js" )
+		If index and Not index.Trim() Print "manual OOPS modid="+modid
 		If index modsbuf.Push( index )
 	Next
 	
@@ -416,8 +416,6 @@ Function MakeDocs:Bool( args:String[] )
 	Return True
 End
 
-#Endif
-
 Function ParseOpts:String[]( opts:BuildOpts,args:String[] )
 
 	opts.verbose=Int( GetEnv( "MX2_VERBOSE" ) )

+ 2 - 2
src/mx2cc/newdocs/docsbuffer.monkey2

@@ -82,7 +82,7 @@ Class DocsBuffer
 				If src
 '					Print "Importing "+path
 					
-					Local docs:=New DocsNode( "","",_docs,DocsType.Nav )
+					Local docs:=New DocsNode( "","",_docs,DocsType.Nav,True )
 					
 					Local buf:=New DocsBuffer( docs,ExtractDir( path ) )
 					
@@ -146,7 +146,7 @@ Class DocsBuffer
 				If src
 '					Print "Importing "+path
 					
-					Local docs:=New DocsNode( "","",_docs,DocsType.Nav )
+					Local docs:=New DocsNode( "","",_docs,DocsType.Nav,True )
 					
 					Local buf:=New DocsBuffer( docs,ExtractDir( path ) )
 					

+ 189 - 55
src/mx2cc/newdocs/docsmaker.monkey2

@@ -22,6 +22,15 @@ Class DocsMaker
 
 		_convertor=New MarkdownConvertor( ResolveHtmlLink )
 		
+		'assets
+		Local asspath:=module.baseDir+"newdocs/assets"
+		If GetFileType( asspath )=FileType.Directory
+			Local dst:=docsDir+"assets"
+'			DeleteDir( dst,True )
+			CreateDir( dst,True )
+			CopyDir( asspath,dst )
+		Endif
+		
 		'manual
 		Local manpath:=module.baseDir+"newdocs/manual.md"
 		
@@ -44,6 +53,9 @@ Class DocsMaker
 		
 		Local modDocs:=New DocsNode( "module","",root,DocsType.Dir )
 		
+		Local modNav:=MakeModuleDocs( modDocs )
+		
+		#rem		
 		Local modNav:=New DocsNode( _module.name,_module.name,modDocs,DocsType.Nav )
 		
 		Local done:=New Map<NamespaceScope,Bool>
@@ -61,6 +73,7 @@ Class DocsMaker
 			
 			done[scope]=True
 		Next
+		#end
 		
 		CreateHtmlPages( root,docsDir )
 		
@@ -97,22 +110,28 @@ Class DocsMaker
 			first=False
 		Next
 
-		Local tree:=buf.Join( "" )		
+		Local tree:=buf.Join( "" )
+		
+		tree=tree.Replace( "\_","_" )
 		
 		SaveString( tree,dir+"index.js" )
 	End
 		
 	Method CreateJSNavTree( docs:DocsNode,buf:StringStack,indent:String,dir:String )
 		
-		buf.Add( indent+"{text:'"+docs.Label+"'" )
+		buf.Add( "~n"+indent+"{text:'"+docs.Label+"'" )
 		
 		Select docs.Type
 			
-		Case DocsType.Decl,DocsType.Hash
+		Case DocsType.Decl,DocsType.Hash,DocsType.Nav
 			
-			Local url:=dir+docs.FilePathUrl
-		
-			buf.Add( ",data:{page:'"+url+"'}")
+			If docs.Ident
+				
+				Local url:=dir+docs.FilePathUrl
+				
+				buf.Add( ",data:{page:'"+url+"'}")
+				
+			Endif
 			
 		End
 		
@@ -120,20 +139,20 @@ Class DocsMaker
 		
 		If children
 		
-			buf.Add( ",children:[~n" )
+			buf.Add( ",children:[" )
 
 			local first:=True			
 			For Local child:=Eachin children
-				If Not first buf.Add( ",~n" )
+				If Not first buf.Add( "," )
 				CreateJSNavTree( child,buf,indent+"  ",dir )
 				first=False
 			Next
 			
-			buf.Add( indent+"]~n" )
+			buf.Add( "]" )
 		
 		Endif
 
-		buf.Add( indent+"}" )
+		buf.Add( "}" )
 		
 	End
 	
@@ -141,21 +160,25 @@ Class DocsMaker
 		
 		Select docs.Type
 			
-		Case DocsType.Decl
+		Case DocsType.Decl,DocsType.Nav
 			
-			_converting=docs
+			If docs.Ident
 			
-			Local html:=_convertor.ConvertToHtml( docs.Markdown )
-			
-			_converting=Null
-			
-			If _pageTemplate html=_pageTemplate.Replace( "${CONTENT}",html )
-	
-			Local url:=dir+docs.FilePathUrl
-			
-'			Print "Creating decl: "+docs.DeclPath
-			
-			SaveString( html,url )
+				_converting=docs
+				
+				Local html:=_convertor.ConvertToHtml( docs.Markdown )
+				
+				_converting=Null
+				
+				If _pageTemplate html=_pageTemplate.Replace( "${CONTENT}",html )
+		
+				Local url:=dir+docs.FilePathUrl
+				
+	'			Print "Creating decl: "+docs.DeclPath
+				
+				SaveString( html,url )
+				
+			Endif
 			
 		Case DocsType.Dir
 			
@@ -174,7 +197,7 @@ Class DocsMaker
 	End
 	
 	Method ResolveHtmlLink:String( link:String,name:String )
-
+		
 		If Not name name=link
 		
 		Local i:=link.Find( "://" )				'http://, https://
@@ -189,17 +212,22 @@ Class DocsMaker
 		
 		i=link.Find( ":" )				'absolute link?
 		If i<>-1
-			Local modname:=link.Slice( 0,i )
+			Local modname:=link.Slice( 0,i ),url:=""
 			
-			Local slug:=link.Slice( i+1 ).Replace( ".","-" )
+			If i<link.Length-1
 			
-			Local url:="../../"+modname+"/module/"+slug
+				Local slug:=link.Slice( i+1 ).Replace( ".","-" )
 			
-			Local i:=url.Find( "#" )
-			If i<>-1
-				url=url.Slice( 0,i )+".html"+url.Slice( i )
+				url="../../"+modname+"/module/"+slug
+				
+				Local i:=url.Find( "#" )
+				If i<>-1
+					url=url.Slice( 0,i )+".html"+url.Slice( i )
+				Else
+					url+=".html"
+				Endif
 			Else
-				url+=".html"
+				url="../../"+modname+"/module/"+modname+"-module.html"
 			Endif
 			
 			Local anchor:="<a href='"+url+"'>"+name+"</a>"
@@ -237,9 +265,13 @@ Class DocsMaker
 		Local ptype:=Cast<PrimType>( type )
 		If ptype 
 			Local ctype:=ptype.ctype
-			If Not name name=ctype.Name
-			Local cname:=DeclIdent( ctype.cdecl )
-			return "[[monkey:monkey.types."+cname+"|"+name+"]]"
+			Local path:=ctype.Name
+			If Not name name=DeclLabel( ctype.cdecl )
+			Return "[[monkey:"+path+"|"+name+"]]"
+			
+'			If Not name name=ctype.Name
+'			Local cname:=DeclDocsIdent( ctype.cdecl )
+'			return "[[monkey:monkey.types."+cname+"|"+name+"]]"
 		Endif
 	
 		Local atype:=Cast<ArrayType>( type )
@@ -274,9 +306,13 @@ Class DocsMaker
 				
 			If ctype.instanceOf ctype=ctype.instanceOf
 			
+			'Print "Typeinfo name="+ctype.Name
+			
 			Local module:=ctype.transFile.module
 			
 			Local path:=type.Name
+'			If path="Typeinfo" path="monkey.types.TypeInfo"	'need to fix @typeinfo keyword!
+			
 			Local i:=path.Find( "<" )
 			If i<>-1 path=path.Slice( 0,i )
 				
@@ -310,12 +346,21 @@ Class DocsMaker
 				If ident="Cstring" ident="CString"
 			Endif
 		Else
-			If ident="new" ident="New"
+			If ident="new" ident="New" Else If ident="to" ident="To"
 		Endif
 
 '		Local ident:=decl.ident.Replace( "@","" )
 		
 		If Not IsIdent( ident[0] ) ident="Op"+OpSym( ident ).Slice( 1 ).Capitalize()
+			
+		Return ident
+	End
+	
+	Method DeclDocsIdent:String( decl:Decl )
+		
+		Local ident:=DeclIdent( decl )
+		
+		If decl.IsExtension ident+="EXT"
 	
 		Return ident
 	End
@@ -362,13 +407,14 @@ Class DocsMaker
 '		label=label.Replace( "<","\<" )
 '		label=label.Replace( ">","\>" )
 		
+'		If Cast<ClassDecl>( decl ) And decl.IsExtension label+=" Extension"
 		
 		Return label
 	End
 	
 	Method DeclLink:String( decl:Decl )
 	
-		Return "[["+DeclIdent( decl )+"|"+DeclLabel( decl )+"]]"
+		Return "[["+DeclDocsIdent( decl )+"|"+DeclLabel( decl )+"]]"
 	End
 	
 	Method DeclDesc:String( decl:Decl )
@@ -401,10 +447,11 @@ Class DocsMaker
 	
 	Method EmitHeader( buf:DocsBuffer,decl:Decl,parent:DocsNode )
 		
-		buf.Emit( "_"+_module.name+":"+parent.DeclLink+"."+DeclLabel( decl )+"_" )
+		buf.Emit( "_[["+_module.name+":|"+_module.name+"]]:"+parent.DeclLink+"."+DeclLabel( decl )+"_" )
+		
 	End
 	
-	Method DocsVisible:Bool( decl:Decl,access:int )
+	Method DocsVisible:Bool( decl:Decl,access:Int )
 	
 		If Not (decl.flags & access) return False
 	
@@ -444,6 +491,36 @@ Class DocsMaker
 '		Endif
 		
 		Local first:=True,docs:DocsNode
+		
+		If kind="extension"
+			
+			Local nmscope:=Cast<NamespaceScope>( scope )
+			
+			For Local ctype:=Eachin nmscope.classexts
+				
+				If ctype.transFile.module<>_module Continue
+				
+				Local decl:=ctype.cdecl
+				If Not DocsVisible( decl,DECL_PUBLIC ) Continue
+				
+				If first
+					first=False
+					buf.EmitBr()
+					buf.Emit( "| Extensions | |" )
+					buf.Emit( "|:---|:---|" )
+					docs=New DocsNode( "","Extensions",parent,DocsType.Nav )
+'					docs=New DocsNode( "Extensions","",parent,DocsType.Nav )
+				Endif
+				
+				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
+				
+				MakeClassDocs( ctype,docs )
+				
+			Next
+			
+			Return docs
+			
+		Endif
 
 		For Local node:=Eachin scope.nodes
 		
@@ -460,7 +537,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -485,7 +563,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 				
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -508,7 +587,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 				
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -532,7 +612,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -556,7 +637,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -581,7 +663,8 @@ Class DocsMaker
 					buf.EmitBr()
 					buf.Emit( "| "+tag+kinds+" | |" )
 					buf.Emit( "|:---|:---|" )
-					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
+					docs=New DocsNode( "",tag+kinds,parent,DocsType.Nav )
+'					docs=New DocsNode( tag+kinds,"",parent,DocsType.Nav )
 				Endif
 
 				buf.Emit( "| "+DeclLink( decl )+" | "+DeclDesc( decl )+" |" )
@@ -595,6 +678,55 @@ Class DocsMaker
 		
 		Return docs
 	End
+
+	Method MakeModuleDocs:DocsNode( parent:DocsNode )
+		
+'		Local docs:=New DocsNode( _module.name,_module.name,parent,DocsType.Decl )
+		Local docs:=New DocsNode( _module.name+"-module",_module.name,parent,DocsType.Nav )
+'		Local docs:=New DocsNode( "",_module.name,parent,DocsType.Nav )'Decl )
+		
+		Local buf:=New DocsBuffer( docs,_module.baseDir+"newdocs/" )
+		
+		buf.Emit( "_"+_module.name+"_" )
+		
+		Local mpath:=_module.baseDir+"newdocs/module.md"
+		
+		If GetFileType( mpath )=FileType.File
+			
+			Local src:=LoadString( mpath )
+
+			buf.Emit( src )
+		Endif
+		
+		buf.Emit( "##### Module "+_module.name )
+		
+		Local done:=New Map<NamespaceScope,Bool>,first:=True
+		
+		For Local fscope:=Eachin _module.fileScopes
+			
+			Local scope:=Cast<NamespaceScope>( fscope.outer )
+			If Not scope Continue
+			
+			If done[scope] Continue
+			done[scope]=True
+			
+			If Not MakeNamespaceDocs( scope,docs ) Continue
+			
+			If first
+				first=False
+				buf.EmitBr()
+				buf.Emit( "| Namespaces" )
+				buf.Emit( "|:---" )
+			Endif
+
+			buf.Emit( "| [["+scope.ntype.Name+"|"+scope.ntype.Name+"]]" )
+
+		Next
+		
+		docs.Markdown=buf.Flush()
+		
+		Return docs
+	End
 	
 	Method MakeNamespaceDocs:DocsNode( scope:NamespaceScope,parent:DocsNode )
 	
@@ -605,7 +737,7 @@ Class DocsMaker
 		Local docs:=New DocsNode( scope.Name,"",parent,DocsType.Decl )
 		
 		'EmitHeader
-		buf.Emit( "_"+_module.name+":"+scope.Name+"_" )
+		buf.Emit( "_[["+_module.name+":|"+_module.name+"]]:"+scope.Name+"_" )
 		
 		buf.Emit( "##### Namespace "+scope.Name )
 
@@ -617,6 +749,7 @@ Class DocsMaker
 		MakeMemberDocs( scope,"function",DECL_PUBLIC,docs,buf )
 		MakeMemberDocs( scope,"global",DECL_PUBLIC,docs,buf )
 		MakeMemberDocs( scope,"const",DECL_PUBLIC,docs,buf )
+		MakeMemberDocs( scope,"extension",DECL_PUBLIC,docs,buf )
 		
 		If Not docs.NumChildren 
 			docs.Remove()
@@ -634,11 +767,11 @@ Class DocsMaker
 		
 		Local buf:=New DocsBuffer
 		
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 
 		EmitHeader( buf,decl,parent )
 		
-		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclIdent( decl ) )
+		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclLabel( decl ) )
 		
 		buf.Emit( decl.docs )
 				
@@ -654,7 +787,7 @@ Class DocsMaker
 		
 		Local buf:=New DocsBuffer
 		
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 		
 		EmitHeader( buf,decl,parent )
 		
@@ -735,13 +868,13 @@ Class DocsMaker
 	
 		Local decl:=etype.edecl
 
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 		
 		Local buf:=New DocsBuffer
 		
 		EmitHeader( buf,decl,parent )
 
-		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclIdent( decl ) )
+		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclLabel( decl ) )
 		
 		buf.Emit( decl.docs )
 	
@@ -752,7 +885,8 @@ Class DocsMaker
 			local val:=Cast<LiteralValue>( node.Value )
 			If Not val Continue
 			
-			Local edocs:=New DocsNode( node.Key,node.Key,docs,DocsType.Decl )
+'			Local edocs:=New DocsNode( node.Key,node.Key,docs,DocsType.Decl,True )
+			Local edocs:=New DocsNode( "",node.Key,docs,DocsType.Nav,True )
 
 		Next
 		
@@ -763,13 +897,13 @@ Class DocsMaker
 	
 		Local decl:=plist.pdecl
 
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 		
 		Local buf:=New DocsBuffer
 		
 		EmitHeader( buf,decl,parent )
 		
-		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclIdent( decl )+":"+TypeName( plist.type ) )
+		buf.Emit( "##### "+decl.kind.Capitalize()+" "+DeclLabel( decl )+":"+TypeName( plist.type ) )
 		
 		buf.Emit( decl.docs )
 	
@@ -782,7 +916,7 @@ Class DocsMaker
 	
 		Local decl:=flist.funcs[0].fdecl
 	
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 	
 		Local buf:=New DocsBuffer
 		
@@ -836,7 +970,7 @@ Class DocsMaker
 	
 		Local decl:=vvar.vdecl
 	
-		Local docs:=New DocsNode( DeclIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
+		Local docs:=New DocsNode( DeclDocsIdent( decl ),DeclLabel( decl ),parent,DocsType.Decl )
 		
 		Local buf:=New DocsBuffer
 		

+ 41 - 29
src/mx2cc/newdocs/docsnode.monkey2

@@ -11,12 +11,13 @@ End
 
 Class DocsNode
 	
-	Method New( ident:String,label:String,parent:DocsNode,type:DocsType )
+	Method New( ident:String,label:String,parent:DocsNode,type:DocsType,clean:Bool=False )
 
 		_ident=ident
 		_label=label ? label Else ident
 		_parent=parent
 		_type=type
+		_clean=clean
 
 		If _parent _parent._children.Add( Self )
 	End
@@ -38,6 +39,15 @@ Class DocsNode
 		Return _parent
 	End
 	
+	Property ParentDecl:DocsNode()
+		
+		If Not _parent Return Null
+		
+		If _parent._type<>DocsType.Decl Return _parent.ParentDecl
+		
+		Return _parent
+	End
+	
 	Property Children:DocsNode[]()
 	
 		Return _children.ToArray()
@@ -62,20 +72,6 @@ Class DocsNode
 		_markdown=markdown
 	End
 	
-	#rem
-	Property Path:String()
-		
-		If _type=DocsType.Dir Return ""
-		
-		If _type=DocsType.Nav Return _parent ? _parent.Path Else ""
-		
-		Local path:=_parent ? _parent.Path Else ""
-		
-		Return path ? path+(_hash ? "#" Else ".")+_ident Else _ident
-	End
-	#end
-	
-	'eg: module/
 	Property FilePath:String()
 		
 		Local path:=_parent ? _parent.FilePath Else ""
@@ -87,7 +83,7 @@ Class DocsNode
 			
 		Case DocsType.Decl,DocsType.Hash
 			
-			If path And Not path.EndsWith( "/" ) path+=_type=DocsType.Decl ? "-" else "#"
+			If path And Not path.EndsWith( "/" ) path+=_type=DocsType.Hash ? "#" Else "-"
 			
 			Return path+_ident.Replace( ".","-" )
 			
@@ -96,7 +92,7 @@ Class DocsNode
 			If path And Not path.EndsWith( "/" ) path+="/"
 				
 			Return path+_ident+"/"
-		
+			
 		Case DocsType.Nav
 			
 			Return path
@@ -107,7 +103,9 @@ Class DocsNode
 	End
 	
 	Property FilePathUrl:String()
-	
+		
+		If _type=DocsType.Nav Return _parent ? _parent.FilePath+_ident+".html" Else _ident+".html"
+		
 		Local url:=FilePath
 			
 		Local i:=url.Find( "#" )
@@ -161,32 +159,45 @@ Class DocsNode
 		Return ""
 	End
 	
-	Method Find:DocsNode( path:String,done:Map<DocsNode,Bool> =null )
+	Method Find:DocsNode( path:String )
+		
+		Local done:=New Map<DocsNode,Bool>
+		
+		Return Find( path,done )
+	End
+	
+	Method Find:DocsNode( path:String,done:Map<DocsNode,Bool> )
+		
+		If done[Self] Return Null
+		done[Self]=True
+		
+		Local found:DocsNode,declPath:=""
 	
  		For Local child:=Eachin _children
  		
- 			If done And done[child] Continue
- 		
  			Local docs:=child.Find( path,done )
+ 			If Not docs Continue
  			
- 			If docs Return docs
+ 			Local path:=docs.DeclPath
+ 			If Not found Or path.Length<declPath.Length
+	 			declPath=path
+	 			found=docs
+	 		Endif
+
  		Next
  		
+ 		If found Return found
+ 		
  		Select _type
  		
  		Case DocsType.Decl,DocsType.Hash
 		
 			Local declPath:=DeclPath
 			
-			If declPath=path Or declPath.EndsWith( "."+path ) 
-				Return Self
-			Endif
+			If declPath=path Or declPath.EndsWith( "."+path ) Return Self
 		
 		End
 		
-		If Not done done=New Map<DocsNode,Bool>
-		done[self]=True
-		
 		If _parent Return _parent.Find( path,done )
 		
 		Return Null
@@ -211,7 +222,7 @@ Class DocsNode
 			child.Clean()
 		Next
 		
-		If Not _ident
+		If _clean
 			Remove()
 		Endif
 	End
@@ -229,6 +240,7 @@ Class DocsNode
 	Field _label:String
 	Field _parent:DocsNode
 	Field _type:DocsType
+	Field _clean:Bool
 	
 	Field _children:=New Stack<DocsNode>
 	Field _markdown:String

+ 3 - 1
src/mx2cc/parser.monkey2

@@ -1452,7 +1452,9 @@ Class Parser
 
 	'THROWS!
 	Method ParsePrimaryExpr:Expr()
-	
+		
+		CParseEol()
+		
 		Local srcpos:=SrcPos
 	
 		Select Toke

+ 9 - 33
src/mx2cc/test.monkey2

@@ -1,38 +1,14 @@
-Class Type
-	Method M()
-		Print "HEY!"
-	End
-End
-
-Class Comp
-	
-	Const type:=New Type
-End
 
-Class Entity
-	
-	Property P<T>:Int()
-		
-		Local t:=T.type
-		
-		t.M()
-		
-		Return 0
-		
-	Setter( t:Int )
-		
-		T.type.M()
-		
-	End
-	
-End
-	
 Function Main()
 	
-	Local e:=New Entity
-	
-	e.P<Comp> =10
-	
-	Print e.P<Comp>
+	Local x:=10,y:=20,z:=30
 	
+	If x=10 And
+		y=20 And
+		z=30
+		Print "Yes!"
+	Endif
+
 End
+
+	

+ 0 - 1
src/mx2cc/translator_cpp.monkey2

@@ -2083,7 +2083,6 @@ Class Translator_CPP Extends Translator
 		Local memberVarValue:=Cast<MemberVarValue>( value )
 		If memberVarValue Return TransRef( memberVarValue )
 		
-		DebugStop()
 		Throw New TransEx( "Translator_CPP.TransRef() Unrecognized ref value type:"+value.ToString() )
 	End
 	

+ 2 - 0
src/mx2cc/type.monkey2

@@ -258,7 +258,9 @@ Class PrimType Extends Type
 	Method DistanceToType:Int( type:Type ) Override
 	
 		If type.Equals( Self ) Return 0
+		
 		If type.Equals( BoolType ) Return MAX_DISTANCE
+		
 		If type.Equals( VariantType ) Return MAX_DISTANCE
 		
 		Select type