Merge branch 'project_new'
authorJean Privat <jean@pryen.org>
Fri, 7 Feb 2014 16:50:49 +0000 (11:50 -0500)
committerJean Privat <jean@pryen.org>
Fri, 7 Feb 2014 16:50:49 +0000 (11:50 -0500)
lib/privileges.nit
lib/standard/collection/abstract_collection.nit
lib/standard/collection/array.nit
misc/README
misc/syntaxhighlighter/shBrushNit.js [new file with mode: 0644]
tests/nitdoc.args
tests/nitmetrics.args
tests/nitunit.args
tests/tests.sh

index 05f8fc7..20a2179 100644 (file)
@@ -22,10 +22,16 @@ module privileges
 
 import opts
 
+# Class to manage user groups
 class UserGroup
+
+       # User name
        var user: String
+
+       # Group name
        var group: nullable String
 
+       # Drop privileges of a user and set his privileges back to default (program privileges)
        fun drop_privileges
        do
                var passwd = new Passwd.from_name(user)
index ab04618..b178386 100644 (file)
@@ -113,7 +113,7 @@ interface Collection[E]
                return nb
        end
 
-       # Return one the item of the collection
+       # Return the first item of the collection
        #
        #    assert [1,2,3].first                == 1
        fun first: E
@@ -151,6 +151,7 @@ interface Iterator[E]
 end
 
 # A collection that contains only one item.
+# Used to pass arguments by reference
 class Container[E]
        super Collection[E]
 
@@ -222,7 +223,7 @@ end
 
 # Abstract sets.
 #
-# Set contains contains only one element with the same value (according to ==).
+# Set is a collection without ducplicates (according to ==)
 #      var s: Set[String] = new ArraySet[String]
 #      var a = "Hello"
 #      var b = "Hel" + "lo"
index 5de71cd..073471e 100644 (file)
@@ -80,7 +80,7 @@ abstract class AbstractArrayRead[E]
                return -1
        end
 
-       # The index of the last occurrence of an element starting from pos.
+       # The index of the first occurrence of an element starting from pos, by decremanting the index
        # Return -1 if not found.
        fun last_index_of_from(item: E, pos: Int): Int
        do
index 5166943..6f19e2c 100644 (file)
@@ -1,6 +1,16 @@
 # gtksourceview (gedit and other GTK editors)
 To install in your home, just link (or copy) the language definition file in ~/.local/share/gtksourceview-2.0/language-specs
 
+# syntaxhighlighter
+
+Nit brush for the Alex Gorbatchev's JS syntaxhighlighter.
+
+To install the JS syntaxhighlighter, please refer to http://alexgorbatchev.com/SyntaxHighlighter/
+
+Then can add the brush to your html page:
+
+       <script type="text/javascript" src="shBrushNit.js"></script>
+
 # vim
 
 vim is a powerful text editor.
diff --git a/misc/syntaxhighlighter/shBrushNit.js b/misc/syntaxhighlighter/shBrushNit.js
new file mode 100644 (file)
index 0000000..e9d1f78
--- /dev/null
@@ -0,0 +1,52 @@
+/* This file is part of NIT ( http://www.nitlanguage.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.
+ *
+ * Nit Brush for SyntaxHighlighter
+ * see http://alexgorbatchev.com/SyntaxHighlighter
+ */
+
+;(function()
+{
+       // CommonJS
+       typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
+
+       function Brush()
+       {
+               var keywords =  'abort abstract and as assert break class continue do else end enum extern false for fun' +
+                                               'if import in init interface intrude is isa isset label loop module new null nullable not' +
+                                               'once or protected private redef return self super then type true universal var' +
+                                               'when while writable';
+               var builtins =  'exit sys args get_time getc getcwd gets print printn';
+
+               this.regexList = [
+                       { regex: SyntaxHighlighter.regexLib.singleLinePerlComments,     css: 'comments' },      // one line comments
+                       { regex: SyntaxHighlighter.regexLib.doubleQuotedString,         css: 'string' },        // double quoted strings
+                       { regex: SyntaxHighlighter.regexLib.singleQuotedString,         css: 'string' },        // single quoted strings
+                       { regex: /\b[A-Z0-9_]+\b/g,                                                                     css: 'constants' },     // types
+                       { regex: /[A-Z][A-Za-z0-9_]*/g,                                                         css: 'color2' },        // classes
+                       { regex: new RegExp(this.getKeywords(keywords), 'gm'),          css: 'keyword' },       // keywords
+                       { regex: new RegExp(this.getKeywords(builtins), 'gm'),          css: 'color3' }         // builtins
+               ];
+               this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+       };
+
+       Brush.prototype = new SyntaxHighlighter.Highlighter();
+       Brush.aliases   = ['nit'];
+
+       SyntaxHighlighter.brushes.Nit = Brush;
+
+       // CommonJS
+       typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
+})();
+
index f984808..7b96e23 100644 (file)
@@ -1 +1 @@
-module_1.nit -d out/nitdoc_args1.write
+module_1.nit -d $WRITE
index f118275..3555fdb 100644 (file)
@@ -1 +1 @@
---all base_simple3.nit -d out/nitmetrics_args1.write
+--all base_simple3.nit -d $WRITE
index 2f1b55a..7572830 100644 (file)
@@ -1 +1 @@
-test_nitunit.nit --no-color -o out/nitunit_args1.write
+test_nitunit.nit --no-color -o $WRITE
index 3e2b119..8de440f 100755 (executable)
@@ -456,7 +456,7 @@ END
                                        test -z "$tap" && echo -n "==> $name "
                                        echo "./$ff.bin $args" > "./$fff.bin"
                                        chmod +x "./$fff.bin"
-                                       sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $inputs > $fff.res 2>$fff.err"
+                                       WRITE="$fff.write" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $inputs > $fff.res 2>$fff.err"
                                        if [ "x$verbose" = "xtrue" ]; then
                                                cat "$fff.res"
                                                cat >&2 "$fff.err"