diff options
Diffstat (limited to 'compiler')
39 files changed, 69 insertions, 70 deletions
diff --git a/compiler/canonicalizer.nim b/compiler/canonicalizer.nim index 14448f0e8..02010961d 100644 --- a/compiler/canonicalizer.nim +++ b/compiler/canonicalizer.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 6c7d40d1c..129093191 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/cgen.nim b/compiler/cgen.nim index c645b81aa..f3fa6a63e 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -924,18 +924,18 @@ proc addIntTypes(result: var PRope) {.inline.} = proc getCopyright(cfile: string): PRope = if optCompileOnly in gGlobalOptions: result = ropeff("/* Generated by Nim Compiler v$1 */$N" & - "/* (c) 2014 Andreas Rumpf */$N" & + "/* (c) 2015 Andreas Rumpf */$N" & "/* The generated code is subject to the original license. */$N", "; Generated by Nim Compiler v$1$N" & "; (c) 2012 Andreas Rumpf$N", [toRope(VersionAsString)]) else: result = ropeff("/* Generated by Nim Compiler v$1 */$N" & - "/* (c) 2014 Andreas Rumpf */$N" & + "/* (c) 2015 Andreas Rumpf */$N" & "/* The generated code is subject to the original license. */$N" & "/* Compiled for: $2, $3, $4 */$N" & "/* Command for C compiler:$n $5 */$N", "; Generated by Nim Compiler v$1$N" & - "; (c) 2014 Andreas Rumpf$N" & + "; (c) 2015 Andreas Rumpf$N" & "; Compiled for: $2, $3, $4$N" & "; Command for LLVM compiler:$N $5$N", [toRope(VersionAsString), toRope(platform.OS[targetOS].name), diff --git a/compiler/commands.nim b/compiler/commands.nim index a5b0b40d7..9fa221de0 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 0472a8731..9a7a87771 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 35acf1379..3f4f39c27 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -23,6 +23,7 @@ type id: int # for generating IDs toc, section: TSections indexValFilename: string + analytics: string # Google Analytics javascript, "" if doesn't exist seenSymbols: StringTableRef # avoids duplicate symbol generation for HTML. PDoc* = ref TDocumentor ## Alias to type less. @@ -61,6 +62,23 @@ proc newDocumentor*(filename: string, config: StringTableRef): PDoc = initRstGenerator(result[], (if gCmd != cmdRst2tex: outHtml else: outLatex), options.gConfigVars, filename, {roSupportRawDirective}, docgenFindFile, compilerMsgHandler) + + if config.hasKey("doc.googleAnalytics"): + result.analytics = """ +<script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', '$1', 'auto'); + ga('send', 'pageview'); + +</script> + """ % [config["doc.googleAnalytics"]] + else: + result.analytics = "" + result.seenSymbols = newStringTable(modeCaseInsensitive) result.id = 100 @@ -562,10 +580,10 @@ proc genOutFile(d: PDoc): PRope = # XXX what is this hack doing here? 'optCompileOnly' means raw output!? code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", "tableofcontents", "moduledesc", "date", "time", - "content", "author", "version"], + "content", "author", "version", "analytics"], [title.toRope, toc, d.modDesc, toRope(getDateStr()), toRope(getClockStr()), content, d.meta[metaAuthor].toRope, - d.meta[metaVersion].toRope]) + d.meta[metaVersion].toRope, d.analytics.toRope]) else: code = content result = code @@ -630,7 +648,8 @@ proc commandBuildIndex*() = let code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", "tableofcontents", "moduledesc", "date", "time", - "content", "author", "version"], + "content", "author", "version", "analytics"], ["Index".toRope, nil, nil, toRope(getDateStr()), - toRope(getClockStr()), content, nil, nil]) + toRope(getClockStr()), content, nil, nil, nil]) + # no analytics because context is not available writeRope(code, getOutFile("theindex", HtmlExt)) diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index d6b3a1aa5..b98679ac6 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/guards.nim b/compiler/guards.nim index cd0aaf296..fbdd16cb3 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index a3423b1d5..c48bf8c91 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -1676,7 +1676,7 @@ proc newModule(module: PSym): BModule = proc genHeader(): PRope = result = ropef("/* Generated by the Nim Compiler v$1 */$n" & - "/* (c) 2014 Andreas Rumpf */$n$n" & + "/* (c) 2015 Andreas Rumpf */$n$n" & "var framePtr = null;$n" & "var excHandler = null;$n" & "var lastJSError = null;$n", diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 194396ddd..b079ecdd6 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/lexer.nim b/compiler/lexer.nim index a6b85d7f3..29fa128d7 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/lowerings.nim b/compiler/lowerings.nim index ef43c4d09..a6527c2b4 100644 --- a/compiler/lowerings.nim +++ b/compiler/lowerings.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/main.nim b/compiler/main.nim index 82e55058c..05209fa80 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -19,12 +19,6 @@ import from magicsys import systemModule, resetSysTypes -const - hasLLVM_Backend = false - -when hasLLVM_Backend: - import llvmgen - proc rodPass = if optSymbolFiles in gGlobalOptions: registerPass(rodwritePass) @@ -111,14 +105,6 @@ proc commandCompileToC = ccgutils.resetCaches() GC_fullCollect() -when hasLLVM_Backend: - proc commandCompileToLLVM = - semanticPasses() - registerPass(llvmgen.llvmgenPass()) - rodPass() - #registerPass(cleanupPass()) - compileProject() - proc commandCompileToJS = #incl(gGlobalOptions, optSafeCode) setTarget(osJS, cpuJS) @@ -290,12 +276,6 @@ proc mainCommand* = of "js", "compiletojs": gCmd = cmdCompileToJS commandCompileToJS() - of "compiletollvm": - gCmd = cmdCompileToLLVM - when hasLLVM_Backend: - CommandCompileToLLVM() - else: - rawMessage(errInvalidCommandX, command) of "doc": wantMainModule() gCmd = cmdDoc diff --git a/compiler/modules.nim b/compiler/modules.nim index 05b795473..3dedc4d18 100644 --- a/compiler/modules.nim +++ b/compiler/modules.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/nimfix/nimfix.nim b/compiler/nimfix/nimfix.nim index 918f58e3d..8caa23ee3 100644 --- a/compiler/nimfix/nimfix.nim +++ b/compiler/nimfix/nimfix.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/nimfix/pretty.nim b/compiler/nimfix/pretty.nim index acac574af..d2d5b5e83 100644 --- a/compiler/nimfix/pretty.nim +++ b/compiler/nimfix/pretty.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/nimfix/prettybase.nim b/compiler/nimfix/prettybase.nim index 225b78479..5130d1863 100644 --- a/compiler/nimfix/prettybase.nim +++ b/compiler/nimfix/prettybase.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/nversion.nim b/compiler/nversion.nim index 8dc4b90b2..4dea62876 100644 --- a/compiler/nversion.nim +++ b/compiler/nversion.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/parser.nim b/compiler/parser.nim index fab3c453b..ff06287e3 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 8e639f083..1b04d5296 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 2bbe8ac80..204bfbf94 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -46,12 +46,13 @@ proc getNextTok*(r: var TSrcGen, kind: var TTokType, literal: var string) # determines how long the subtree will likely be, the second # phase appends to a buffer that will be the output. -proc isKeyword*(s: string): bool = - var i = getIdent(s) +proc isKeyword*(i: PIdent): bool = if (i.id >= ord(tokKeywordLow) - ord(tkSymbol)) and - (i.id <= ord(tokKeywordHigh) - ord(tkSymbol)): + (i.id <= ord(tokKeywordHigh) - ord(tkSymbol)): result = true +proc isKeyword*(s: string): bool = isKeyword(getIdent(s)) + proc renderDefinitionName*(s: PSym, noQuotes = false): string = ## Returns the definition name of the symbol. ## @@ -59,7 +60,7 @@ proc renderDefinitionName*(s: PSym, noQuotes = false): string = ## happen if the name happens to be a keyword or the first character is not ## part of the SymStartChars set. let x = s.name.s - if noQuotes or (x[0] in SymStartChars and not renderer.isKeyword(x)): + if noQuotes or (x[0] in SymStartChars and not renderer.isKeyword(s.name)): result = x else: result = '`' & x & '`' diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index 483d36bf3..0b68bc897 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 68921a15a..5e61c4a0b 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -964,7 +964,6 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = var ty = n.sons[0].typ var f: PSym = nil result = nil - if isTypeExpr(n.sons[0]) or (ty.kind == tyTypeDesc and ty.base.kind != tyNone): if ty.kind == tyTypeDesc: ty = ty.base ty = ty.skipTypes(tyDotOpTransparent) @@ -1053,7 +1052,7 @@ proc dotTransformation(c: PContext, n: PNode): PNode = proc semFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = # this is difficult, because the '.' is used in many different contexts - # in Nimrod. We first allow types in the semantic checking. + # in Nim. We first allow types in the semantic checking. result = builtinFieldAccess(c, n, flags) if result == nil: result = dotTransformation(c, n) diff --git a/compiler/semfields.nim b/compiler/semfields.nim index a6ade64d5..f02c542ed 100644 --- a/compiler/semfields.nim +++ b/compiler/semfields.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 220abcad7..1988c512e 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 1ab4f5989..d69fdb04a 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semmacrosanity.nim b/compiler/semmacrosanity.nim index c685d602d..2ef7a54e7 100644 --- a/compiler/semmacrosanity.nim +++ b/compiler/semmacrosanity.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index d6c420955..d5d6bbbd3 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semparallel.nim b/compiler/semparallel.nim index bd3152b54..a914832de 100644 --- a/compiler/semparallel.nim +++ b/compiler/semparallel.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 4300aee20..dcebf86ac 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 38b0536db..81e4f2463 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index e069064c2..d8efdbb23 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/transf.nim b/compiler/transf.nim index 3409acb74..f511ed69f 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/typesrenderer.nim b/compiler/typesrenderer.nim index 432a26666..995fe7f50 100644 --- a/compiler/typesrenderer.nim +++ b/compiler/typesrenderer.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/vm.nim b/compiler/vm.nim index 4072ed765..912cf3331 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 8444af7ba..c233724fa 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/vmhooks.nim b/compiler/vmhooks.nim index cce87d433..6ec5f6044 100644 --- a/compiler/vmhooks.nim +++ b/compiler/vmhooks.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/vmops.nim b/compiler/vmops.nim index ef2bfabb2..502ad8ecc 100644 --- a/compiler/vmops.nim +++ b/compiler/vmops.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 1148bdeaf..ae036bc0c 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2014 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. |