*.orig
bin/nit*
doc/stdlib
+doc/nitc
doc/newmodel
*.aux
all: tools doc/stdlib/index.html
-docs: doc/stdlib/index.html doc/newmodel/index.html
+docs: doc/stdlib/index.html doc/nitc/index.html
#cd doc; make
tools:
--custom-menu-items "<li><a href=\"http://nitlanguage.org/\">Nitlanguage.org</a></li>" \
--custom-overview-text "<p>Documentation for the standard library of Nit<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
--custom-footer-text "Nit standard library. Version $$(git describe)." \
- --source "https://github.com/privat/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L"
+ --github-upstream "privat:nit:master" \
+ --github-base-sha1 "$$(git rev-parse HEAD)" \
+ --github-gitdir "." \
+ --source "https://github.com/privat/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \
+ --piwik-tracker "pratchett.info.uqam.ca/piwik/" \
+ --piwik-site-id "2"
-doc/newmodel/index.html: bin/nitdoc
- bin/nitdoc src/nit.nit src/nitmetrics.nit src/nitg.nit src/nitx.nit src/nitunit.nit src/nitlight.nit src/dbgcli.nit src/netdbg.nit -d doc/newmodel \
+doc/nitc/index.html: bin/nitdoc
+ bin/nitdoc src/nit.nit src/nitmetrics.nit src/nitg.nit src/nitx.nit src/nitunit.nit src/nitlight.nit src/dbgcli.nit src/netdbg.nit -d doc/nitc \
--private \
- --custom-title "Nit New Model" \
+ --custom-title "Nit Compilers and Tools" \
--custom-menu-items "<li><a href=\"http://nitlanguage.org/\">Nitlanguage.org</a></li>" \
- --custom-overview-text "<p>Documentation for the Nit tools based on the new metamodel<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
- --custom-footer-text "Nit new metamodel. Version $$(git describe)." \
+ --custom-overview-text "<p>Documentation for the Nit tools<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
+ --custom-footer-text "Nit tools. Version $$(git describe)." \
--github-upstream "privat:nit:master" \
--github-base-sha1 "$$(git rev-parse HEAD)" \
--github-gitdir "." \
- --source "https://github.com/privat/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L"
+ --source "https://github.com/privat/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \
+ --piwik-tracker "pratchett.info.uqam.ca/piwik/" \
+ --piwik-site-id "3"
clean:
rm -rf -- .nit_compile 2> /dev/null || true
--- /dev/null
+{gffffdg}
\ No newline at end of file
--- /dev/null
+{gffffdg
\ No newline at end of file
--- /dev/null
+Grammar x;
+
+Lexer
+ c = Shortest ('{' Any* '}') ;
+
+Parser
+ p = c ;
+
--- /dev/null
+Start
+ p
+ c@(1:1-1:10)='{gffffdg}'
+ Eof@(1:10-1:10)=''
--- /dev/null
+NLexerError@(1:1-1:9)='{gffffdg'
+Nodes[Node]
+ NLexerError@(1:1-1:9)='{gffffdg'
last_state = state
end
var c
+ var next
if pos >= length then
c = '\0'
+ next = null
else
c = text[pos]
+ next = state.trans(c)
end
- var next = state.trans(c)
if next == null then
if pos_start < length then
if last_state == null then
end
end
-redef class Discrete
+redef class Int
# Returns the range from 0 to `self-1`, is used to do:
#
- # for i in 3.times do print "Cool"
- # for i in 100.times do print "{i}/100"
- fun times: Range[OTHER] do return new Range[OTHER](0, self-1)
+ # var s = new Array[String]
+ # for i in 3.times do s.add "cool"
+ # assert s.join(" ") == "cool cool cool"
+ #
+ # s.clear
+ # for i in 10.times do s.add(i.to_s)
+ # assert s.to_s == "0123456789"
+ fun times: Range[Int] do return [0 .. self[
end
endfunction
function! SyntaxCheckers_nit_nitc_GetLocList()
- let makeprg = s:nitc . " --no-color --only-metamodel 2>&1 " . shellescape(expand("%"))
+ let makeprg = s:nitc . " --no-color --only-metamodel "
" custom NIT_DIR
if exists('g:syntastic_nit_dir')
endfor
end
+ " alternative main module
+ if exists('g:nit_main')
+ let makeprg .= " " . g:nit_main
+ else
+ let makeprg .= " " . shellescape(expand("%"))
+ end
+
+ " pipe stderr
+ let makeprg .= " 2>&1 "
+
" possible combinations of error messages
- let ef_start = [ '%f:%l\,%c--%*[0-9]:', '%f:%l\,%c--%*[0-9]\,%*[0-9]:', '%f:%l\,%c:' ]
- let ef_type = [ ' %tarning: ', '' ]
+ let ef_start = [ '%f:%l\,%c--%*[0-9]:',
+ \ '%f:%l\,%c--%*[0-9]\,%*[0-9]:',
+ \ '%f:%l\,%c:' ]
+ let ef_type = [ ' %tarning: ',
+ \ '' ]
" generate errorformat from combinations
let errorformat = ""
value: "quick search..."
})
.addClass("nitdoc-qs-field-notused")
+ .keydown(function(event) {
+ return Nitdoc.QuickSearch.doKeyDownAction(event.keyCode);
+ })
.keyup(function(event) {
- Nitdoc.QuickSearch.doKeyAction(event.keyCode);
+ Nitdoc.QuickSearch.doKeyUpAction(event.keyCode);
})
.focusout(function() {
if($(this).val() == "") {
});
}
- // Respond to key event
- var doKeyAction = function(key) {
+ var doKeyDownAction = function(key) {
switch(key) {
case 38: // Up
selectPrevResult();
- break;
-
+ return false;
case 40: // Down
selectNextResult();
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ var doKeyUpAction = function(key) {
+ switch(key) {
+ case 38: // Up
+ case 40: // Down
break;
case 13: // Enter
if(!query) {
return false;
}
- var results = rankResults(query);
- results.sort(resultsSort);
+ var results = getResults(query);
displayResultsTable(query, results);
break;
}
}
- // Rank raw list entries corresponding to query
- var rankResults = function(query) {
- var results = new Array();
+ // Get results corresponding to search query
+ var getResults = function(query) {
+ var results = {};
+ results.matches = new Array();
for(var entry in rawList) {
- for(var i in rawList[entry]) {
- var result = rawList[entry][i];
- result.entry = entry;
- result.distance = query.dice(entry);
- results[results.length] = result;
+ if(!entry.startsWith(query, true)) {
+ continue;
+ }
+ var cat = new Object();
+ cat.name = entry;
+ cat.entries = rawList[entry];
+ results.matches[results.matches.length] = cat;
+
+ if(entry == query) {
+ cat.rank = 3;
+ } else if(entry.toUpperCase() == query.toUpperCase()) {
+ cat.rank = 2;
+ } else {
+ cat.rank = 1 + query.dice(entry);
}
}
+ results.matches.sort(rankSorter);
+ results.partials = new Array();
+ if(results.matches.length == 0) {
+ for(var entry in rawList) {
+ var cat = new Object();
+ cat.name = entry;
+ cat.entries = rawList[entry];
+ cat.rank = query.dice(entry);
+ if(cat.rank > 0) {
+ results.partials[results.partials.length] = cat;
+ }
+ }
+ results.partials.sort(rankSorter);
+ }
return results;
}
- // Sort an array of results
- var resultsSort = function(a, b){
- if(a.distance < b.distance) {
+ // Sort an array of results by rank
+ var rankSorter = function(a, b){
+ if(a.rank < b.rank) {
return 1;
- } else if(a.distance > b.distance) {
+ } else if(a.rank > b.rank) {
return -1;
}
return 0;
// Build results table
currentIndex = -1;
currentTable = $(document.createElement("table"));
+ currentTable.attr("id", "nitdoc-qs-table");
+ currentTable.css("position", "absolute");
+ currentTable.width(searchField.outerWidth());
- for(var i in results) {
- if(i > 10) {
- break;
+ var maxSize = 10;
+ var count = 0;
+ var resultSet;
+ if(results.matches.length == 0) {
+ resultSet = results.partials
+ } else {
+ resultSet = results.matches
+ }
+ for(var i in resultSet) {
+ var cat = resultSet[i];
+ var result = cat.entries[0];
+
+ addResultRow(count, cat.name, result.txt, result.url, "nitdoc-qs-cat")
+ if(count >= maxSize) {
+ currentTable.find("tbody").children().last().hide();
}
- var result = results[i];
- currentTable.append(
+ count++;
+
+ for(var j = 1; j < cat.entries.length; j++) {
+ var result = cat.entries[j];
+ addResultRow(count, cat.name, result.txt, result.url, "nitdoc-qs-sub")
+ if(count >= maxSize) {
+ currentTable.find("tr.nitdoc-qs-row").last().hide();
+ }
+ count++;
+ }
+ }
+ if(count >= maxSize) {
+ currentTable.prepend(
$(document.createElement("tr"))
- .data("searchDetails", {name: result.entry, url: result.url})
- .data("index", i)
- .append($(document.createElement("td")).html(result.entry))
+ .addClass("nitdoc-qs-overflow-up")
+ .addClass("nitdoc-qs-overflow-inactive")
.append(
$(document.createElement("td"))
- .addClass("nitdoc-qs-info")
- .html(result.txt + " »")
+ .attr("colspan", 2)
+ .html("▲")
)
- .mouseover( function() {
- $(currentTable.find("tr")[currentIndex]).removeClass("nitdoc-qs-active");
- $(this).addClass("nitdoc-qs-active");
- currentIndex = $(this).data("index");
+ .click( function(e) {
+ e.stopPropagation();
+ selectPrevResult();
})
- .mouseout( function() {
- $(this).removeClass("nitdoc-qs-active");
- })
- .click( function() {
- window.location = $(this).data("searchDetails")["url"];
+ );
+ currentTable.append(
+ $(document.createElement("tr"))
+ .addClass("nitdoc-qs-overflow-down")
+ .addClass(count >= maxSize ? "nitdoc-qs-overflow-active" : "nitdoc-qs-overflow-inactive")
+ .append(
+ $(document.createElement("td"))
+ .attr("colspan", 2)
+ .html("▼")
+ )
+ .click( function(e) {
+ e.stopPropagation();
+ console.log("nest");
+ selectNextResult();
})
);
}
+ if(results.matches.length == 0) {
+ currentTable.prepend(
+ $("<tr class='nitdoc-qs-noresult'>")
+ .append(
+ $("<td colspan='2'>")
+ .html("Sorry, there is no match, best results are:")
+ )
+ );
+ }
+
+ // Initialize table
+ $("body").append(currentTable);
+ resizeResultsTable();
+ if(currentTable.find("tr").length > 0) {
+ setIndex(0);
+ }
+ }
+
+ // adds a result row to the current result table
+ var addResultRow = function(index, name, txt, url, cls) {
currentTable.append(
- $("<tr class='nitdoc-qs-overflow'>")
+ $(document.createElement("tr"))
+ .addClass("nitdoc-qs-row")
+ .data("searchDetails", {name: name, url: url})
+ .data("index", index)
+ .append(
+ $(document.createElement("td")).html(name)
+ .addClass(cls)
+ )
.append(
- $("<td colspan='2'>")
- .html("Best results for '" + query + "'")
+ $(document.createElement("td"))
+ .addClass("nitdoc-qs-info")
+ .html(txt + " »")
)
+ .mouseover( function() {
+ setIndex($(this).data("index"));
+ })
+ .mouseout( function() {
+ $(this).removeClass("nitdoc-qs-active");
+ })
+ .click( function() {
+ window.location = $(this).data("searchDetails")["url"];
+ })
);
+ }
- // Initialize table properties
- currentTable.attr("id", "nitdoc-qs-table");
- currentTable.css("position", "absolute");
- currentTable.width(searchField.outerWidth());
- $("body").append(currentTable);
- currentTable.offset({left: searchField.offset().left + (searchField.outerWidth() - currentTable.outerWidth()), top: searchField.offset().top + searchField.outerHeight()});
- // Preselect first entry
- if(currentTable.find("tr").length > 0) {
- currentIndex = 0;
- $(currentTable.find("tr")[currentIndex]).addClass("nitdoc-qs-active");
- searchField.focus();
- }
+ // adapts result table to content
+ var resizeResultsTable = function() {
+ currentTable.offset({
+ left: searchField.offset().left + (searchField.outerWidth() - currentTable.outerWidth()),
+ top: searchField.offset().top + searchField.outerHeight()
+ });
+ }
+
+ // select row at index
+ var setIndex = function(index) {
+ $(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).removeClass("nitdoc-qs-active");
+ currentIndex = index;
+ var currentRow = $(currentTable.find("tr.nitdoc-qs-row")[currentIndex]);
+ currentRow.addClass("nitdoc-qs-active");
+ //searchField.val(currentRow.data("searchDetails").name);
+ }
+
+ var hasPrev = function(index) {
+ return index - 1 >= 0;
+ }
+
+ var hasNext = function(index) {
+ return index + 1 < currentTable.find("tr.nitdoc-qs-row").length;
}
- // Select the previous result on current table
var selectPrevResult = function() {
- // If already on first result, focus search input
- if(currentIndex == 0) {
- searchField.val($(currentTable.find("tr")[currentIndex]).data("searchDetails").name);
- searchField.focus();
- // Else select previous result
- } else if(currentIndex > 0) {
- $(currentTable.find("tr")[currentIndex]).removeClass("nitdoc-qs-active");
- currentIndex--;
- $(currentTable.find("tr")[currentIndex]).addClass("nitdoc-qs-active");
- searchField.val($(currentTable.find("tr")[currentIndex]).data("searchDetails").name);
- searchField.focus();
+ if(hasPrev(currentIndex)) {
+ setIndex(currentIndex - 1);
+ if(!$(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).is(":visible")) {
+ currentTable.find("tr.nitdoc-qs-row:visible").last().hide();
+ currentTable.find("tr.nitdoc-qs-overflow-down").addClass("nitdoc-qs-overflow-active");
+ $(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).show();
+ if(!hasPrev(currentIndex)) {
+ currentTable.find("tr.nitdoc-qs-overflow-up").removeClass("nitdoc-qs-overflow-active");
+ }
+ resizeResultsTable();
+ }
}
}
- // Select the next result on current table
var selectNextResult = function() {
- if(currentIndex < currentTable.find("tr").length - 1) {
- if($(currentTable.find("tr")[currentIndex + 1]).hasClass("nitdoc-qs-overflow")) {
- return;
+ if(hasNext(currentIndex)) {
+ setIndex(currentIndex + 1);
+ if(!$(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).is(":visible")) {
+ currentTable.find("tr.nitdoc-qs-row:visible").first().hide();
+ currentTable.find("tr.nitdoc-qs-overflow-up").addClass("nitdoc-qs-overflow-active");
+ $(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).show();
+ if(!hasNext(currentIndex)) {
+ currentTable.find("tr.nitdoc-qs-overflow-down").removeClass("nitdoc-qs-overflow-active");
+ }
+ resizeResultsTable();
}
- $(currentTable.find("tr")[currentIndex]).removeClass("nitdoc-qs-active");
- currentIndex++;
- $(currentTable.find("tr")[currentIndex]).addClass("nitdoc-qs-active");
- searchField.val($(currentTable.find("tr")[currentIndex]).data("searchDetails").name);
- searchField.focus();
}
}
// Load selected search result page
var goToResult = function() {
if(currentIndex > -1) {
- window.location = $(currentTable.find("tr")[currentIndex]).data("searchDetails").url;
+ window.location = $(currentTable.find("tr.nitdoc-qs-row")[currentIndex]).data("searchDetails").url;
return;
}
// Public interface
var quicksearch = {
enableQuickSearch: enableQuickSearch,
- doKeyAction: doKeyAction,
+ doKeyUpAction: doKeyUpAction,
+ doKeyDownAction: doKeyDownAction,
closeResultsTable: closeResultsTable
};
* Utils
*/
-// Calculate levenshtein distance beetween two strings
-// see: http://en.wikipedia.org/wiki/Levenshtein_distance
-String.prototype.levenshtein = function(other) {
- var matrix = new Array();
-
- for(var i = 0; i <= this.length; i++) {
- matrix[i] = new Array();
- matrix[i][0] = i;
+String.prototype.startsWith = function(prefix, caseSensitive) {
+ if(caseSensitive) {
+ return this.toUpperCase().indexOf(prefix.toUpperCase()) === 0;
}
- for(var j = 0; j <= other.length; j++) {
- matrix[0][j] = j;
- }
- var cost = 0;
- for(var i = 1; i <= this.length; i++) {
- for(var j = 1; j <= other.length; j++) {
- if(this.charAt(i - 1) == other.charAt(j - 1)) {
- cost = 0;
- } else if(this.charAt(i - 1).toLowerCase() == other.charAt(j - 1).toLowerCase()) {
- cost = 0.5;
- } else {
- cost = 1;
- }
- matrix[i][j] = Math.min(
- matrix[i - 1][j] + 1, // deletion
- matrix[i][j - 1] + 1, // insertion
- matrix[i - 1][j - 1] + cost // substitution
- );
- }
- }
- return matrix[this.length][other.length]
+ return this.indexOf(prefix) === 0;
}
// Compare two strings using Sorensen-Dice Coefficient
var bigram1 = this.substr(i, 2);
for(var j = 0; j < length2; j++) {
if(bigram1 == bigrams2[j]) {
- intersection += 2;
- bigrams2[j] = null;
- break;
- } else if (bigram1 && bigrams2[j] && bigram1.toLowerCase() == bigrams2[j].toLowerCase()) {
- intersection += 1;
+ intersection++;
bigrams2[j] = null;
break;
}
border: 1px solid #E0E0E0;\r
border-spacing: 0px;\r
z-index: 1000;\r
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\r
+ -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\r
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\r
}\r
\r
#nitdoc-qs-table .nitdoc-qs-active {\r
background: #EEE;\r
}\r
\r
-#nitdoc-qs-table td {\r
+#nitdoc-qs-table td, th {\r
white-space: nowrap;\r
overflow: hidden;\r
line-height: 22px;\r
width: 25%;\r
}\r
\r
+#nitdoc-qs-table td.nitdoc-qs-sub {\r
+ color: #6C6C6C;\r
+ padding-left: 12px;\r
+}\r
+\r
#nitdoc-qs-table td.nitdoc-qs-info {\r
color: #0D8921;\r
font-size: small;\r
text-align: right;\r
}\r
\r
-#nitdoc-qs-table tr.nitdoc-qs-overflow td {\r
+#nitdoc-qs-table tr.nitdoc-qs-noresult td {\r
+ color: #6C6C6C;\r
+ font-size: small;\r
+ line-height: 15px;\r
+}\r
+\r
+#nitdoc-qs-table tr.nitdoc-qs-overflow-up td,\r
+#nitdoc-qs-table tr.nitdoc-qs-overflow-down td {\r
text-align: center;\r
- background-color: #E0E0E0;\r
+ font-size: x-small;\r
+ line-height: 10px;\r
+ color: #FFF;\r
+ -webkit-touch-callout: none;\r
+ -webkit-user-select: none;\r
+ -khtml-user-select: none;\r
+ -moz-user-select: none;\r
+ -ms-user-select: none;\r
+ user-select: none;\r
}\r
\r
+#nitdoc-qs-table tr.nitdoc-qs-overflow-active td {\r
+ color: #0D8921;\r
+ cursor: pointer;\r
+}\r
+\r
+#nitdoc-qs-table tr.nitdoc-qs-overflow-active td:hover {\r
+ background-color: #E0E0E0;\r
+}\r
padding: 5px;\r
background: #f1f1f1;\r
font-size: 1em;\r
+ -webkit-touch-callout: none;\r
+ -webkit-user-select: none;\r
+ -khtml-user-select: none;\r
+ -moz-user-select: none;\r
+ -ms-user-select: none;\r
+ user-select: none;\r
}\r
\r
.sidebar nav h4 {\r
# Used to print parts of the source betwen tokens of the AST
private var pos = 0
+ # The line position in the source file.
+ private var line_pos = 0
+
+ # The first line to generate, null if start at the first line
+ var first_line: nullable Int writable = null
+
+ # The last line to generate, null if finish at the last line
+ var last_line: nullable Int writable = null
+
init
do
html.add_class("nitcode")
# Add text between `last_token` and `node`
var pstart = node.location.pstart
- if pos < pstart then
+ var line_start = node.location.line_start
+ var line_end = node.location.line_end
+ if pos < pstart and (first_line == null or first_line <= line_start) and (last_line == null or last_line >= line_end) then
var text = node.location.file.string.substring(pos, pstart-pos)
token_head.append(text)
#node.debug("WRT: {token_head.classes} << '{text.escape_to_c}' ")
# Use `empty_tag` to create the tag ; then fill it and add it to the html
redef fun accept_highlight_visitor(v)
do
+ var fl = v.first_line
+ if fl != null and fl > location.line_start then return
+
+ var ll = v.last_line
+ if ll != null and ll < location.line_end then return
+
var n = make_tag(v)
if n.attrs.is_empty and n.classes.is_empty then
for c in n.children do
#!/bin/bash
-rm nitg nitg.bin hello_world.bin 2>/dev/null
+rm nitg nitg_? hello_world 2>/dev/null
set -x
set -e
-time ../bin/nitg nitg.nit -v -o nitg
+time ../c_src/nitg nitg.nit -v -o nitg
time ./nitg nitg.nit -v "$@" -o nitg_2
time ./nitg_2 nitg.nit -v "$@" -o nitg_3
time ./nitg_3 nitg.nit -v "$@" -o nitg_4
private var opt_github_base_sha1: OptionString = new OptionString("The sha1 of the base commit used to create pull request", "--github-base-sha1")
private var opt_github_gitdir: OptionString = new OptionString("The git working directory used to resolve path name (ex: /home/me/myproject/)", "--github-gitdir")
+ private var opt_piwik_tracker: OptionString = new OptionString("The URL of the Piwik tracker (ex: nitlanguage.org/piwik/)", "--piwik-tracker")
+ private var opt_piwik_site_id: OptionString = new OptionString("The site ID in Piwik tracker", "--piwik-site-id")
+
init do
toolcontext.option_context.add_option(opt_dir)
toolcontext.option_context.add_option(opt_source)
toolcontext.option_context.add_option(opt_github_upstream)
toolcontext.option_context.add_option(opt_github_base_sha1)
toolcontext.option_context.add_option(opt_github_gitdir)
+ toolcontext.option_context.add_option(opt_piwik_tracker)
+ toolcontext.option_context.add_option(opt_piwik_site_id)
toolcontext.process_options
self.arguments = toolcontext.option_context.rest
if ctx.opt_custom_footer_text.value != null then footed = "footed"
append("<div class='page {footed}'>")
content
+
+ # piwik tracking
+ var tracker_url = ctx.opt_piwik_tracker.value
+ var site_id = ctx.opt_piwik_site_id.value
+ if tracker_url != null and site_id != null then
+ append("<!-- Piwik -->")
+ append("<script type=\"text/javascript\">")
+ append(" var _paq = _paq || [];")
+ append(" _paq.push([\"trackPageView\"]);")
+ append(" _paq.push([\"enableLinkTracking\"]);")
+ append(" (function() \{")
+ append(" var u=((\"https:\" == document.location.protocol) ? \"https\" : \"http\") + \"://{tracker_url}\";")
+ append(" _paq.push([\"setTrackerUrl\", u+\"piwik.php\"]);")
+ append(" _paq.push([\"setSiteId\", \"{site_id}\"]);")
+ append(" var d=document, g=d.createElement(\"script\"), s=d.getElementsByTagName(\"script\")[0]; g.type=\"text/javascript\";")
+ append(" g.defer=true; g.async=true; g.src=u+\"piwik.js\"; s.parentNode.insertBefore(g,s);")
+ append(" \})();")
+ append(" </script>")
+ append("<!-- End Piwik Code -->")
+ end
append("</div>")
footer
append("</body>")
var toolcontext = new ToolContext
var opt_fragment = new OptionBool("Omit document header and footer", "-f", "--fragment")
+var opt_first_line = new OptionInt("Start the source file at this line (default: 1)", 0, "--first-line")
+var opt_last_line = new OptionInt("End the source file at this line (default: to the end)", 0, "--last-line")
var opt_dir = new OptionString("Output html files in a specific directory (required if more than one module)", "-d", "--dir")
var opt_full = new OptionBool("Process also imported modules", "--full")
var opt_ast = new OptionBool("Generate specific HTML elements for each Node of the AST", "--ast")
-toolcontext.option_context.add_option(opt_fragment, opt_dir, opt_full)
+toolcontext.option_context.add_option(opt_fragment, opt_first_line, opt_last_line, opt_dir, opt_full)
var model = new Model
var modelbuilder = new ModelBuilder(model, toolcontext)
if dir != null then toolcontext.info("write {dir}/{mm.name}.html", 1)
var v = new HighlightVisitor
+
+ if opt_first_line.value != 0 then v.first_line = opt_first_line.value
+ if opt_last_line.value != 0 then v.last_line = opt_last_line.value
if opt_ast.value then v.with_ast = true
var page = null
if not opt_fragment.value then
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2006-2008 Jean Privat <jean@pryen.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import kernel
+
class A[E]
var e: E
init do end
# See the License for the specific language governing permissions and
# limitations under the License.
+import string
+
class Test end
class MyArray[E] end
var test3 = new MyArray[Int]
var test4 = new Toto
-print "".class_name
-print 1.class_name
+"".class_name.output
+'\n'.output
+1.class_name.output
+'\n'.output
-print test1.class_name
-print test2.class_name
-print test3.class_name
-print test4.class_name
+test1.class_name.output
+'\n'.output
+test2.class_name.output
+'\n'.output
+test3.class_name.output
+'\n'.output
+test4.class_name.output
+'\n'.output
-Runtime error: Reciever is null (base_attr_gen.nit:8)
+Runtime error: Reciever is null (base_attr_gen.nit:26)
-Runtime error: Uninitialized attribute @e (alt/base_attr_gen_alt1.nit:7)
+Runtime error: Uninitialized attribute @e (alt/base_attr_gen_alt1.nit:25)
--github-upstream The branch where edited commits will be pulled into (ex: user:repo:branch)
--github-base-sha1 The sha1 of the base commit used to create pull request
--github-gitdir The git working directory used to resolve path name (ex: /home/me/myproject/)
+ --piwik-tracker The URL of the Piwik tracker (ex: nitlanguage.org/piwik/)
+ --piwik-site-id The site ID in Piwik tracker
-Runtime error: Cast failed (alt/base_attr_gen_alt1.nit:8)
+Runtime error: Cast failed (alt/base_attr_gen_alt1.nit:26)
--only-parse Only proceed to parse step of loaders
--only-metamodel Stop after meta-model processing
-f, --fragment Omit document header and footer
+ --first-line Start the source file at this line (default: 1)
+ --last-line End the source file at this line (default: to the end)
-d, --dir Output html files in a specific directory (required if more than one module)
--full Process also imported modules