pep8analysis: add copyright info for viz.js
[nit.git] / src / nitx.nit
index 7225571..0e0d345 100644 (file)
@@ -55,9 +55,6 @@ class NitIndex
                model = new Model
                mbuilder = new ModelBuilder(model, toolcontext)
 
-               # Here we load an process std modules
-               #var dir = "NIT_DIR".environ
-               #var mmodules = modelbuilder.parse_and_build(["{dir}/lib/standard/standard.nit"])
                var mmodules = mbuilder.parse([arguments.first])
                if mmodules.is_empty then return
                mbuilder.run_phases
@@ -104,7 +101,7 @@ class NitIndex
 
        fun prompt do
                printn ">> "
-               search(stdin.read_line)
+               search(sys.stdin.read_line)
        end
 
        fun search(entry: String) do
@@ -352,7 +349,7 @@ private class PagerMatchesRenderer
 end
 
 private class Pager
-       var content = new Buffer
+       var content = new FlatBuffer
        var indent = 0
        fun add(text: String) do
                add_indent
@@ -458,7 +455,7 @@ redef class MClass
        # return the generic signature of the class
        #       [E, F]
        private fun signature: String do
-               var res = new Buffer
+               var res = new FlatBuffer
                if arity > 0 then
                        res.append("[")
                        for i in [0..intro.parameter_names.length[ do
@@ -474,7 +471,7 @@ redef class MClass
        # class name is displayed with colors depending on visibility
        #       abstract interface Foo[E]
        private fun prototype: String do
-               var res = new Buffer
+               var res = new FlatBuffer
                res.append("{kind} ")
                if visibility.to_s == "public" then res.append("{name}{signature}".bold.green)
                if visibility.to_s == "private" then res.append("{name}{signature}".bold.red)
@@ -568,7 +565,7 @@ redef class MClassDef
        end
 
        fun to_console: String do
-               var res = new Buffer
+               var res = new FlatBuffer
                if not is_intro then res.append("redef ")
                res.append(mclass.prototype)
                return res.to_s
@@ -692,22 +689,21 @@ end
 
 redef class MMethodDef
        redef fun to_console do
-               var res = new Buffer
+               var res = new FlatBuffer
                if not is_intro then res.append("redef ")
                if not mproperty.is_init then res.append("fun ")
                res.append(mproperty.to_console.bold)
                if msignature != null then res.append(msignature.to_console)
-               # FIXME: modifiers should be accessible via the model
-               #if self isa ADeferredMethPropdef then ret = "{ret} is abstract"
-               #if self isa AInternMethPropdef then ret = "{ret} is intern"
-               #if self isa AExternMethPropdef then ret = "{ret} is extern"
+               if is_abstract then res.append " is abstract"
+               if is_intern then res.append " is intern"
+               if is_extern then res.append " is extern"
                return res.to_s
        end
 end
 
 redef class MVirtualTypeDef
        redef fun to_console do
-               var res = new Buffer
+               var res = new FlatBuffer
                res.append("type ")
                res.append(mproperty.to_console.bold)
                res.append(": {bound.to_console}")
@@ -717,7 +713,7 @@ end
 
 redef class MAttributeDef
        redef fun to_console do
-               var res = new Buffer
+               var res = new FlatBuffer
                res.append("var ")
                res.append(mproperty.to_console.bold)
                res.append(": {static_mtype.to_console}")
@@ -727,7 +723,7 @@ end
 
 redef class MSignature
        redef fun to_console do
-               var res = new Buffer
+               var res = new FlatBuffer
                if not mparameters.is_empty then
                        res.append("(")
                        for i in [0..mparameters.length[ do
@@ -745,7 +741,7 @@ end
 
 redef class MParameter
        fun to_console: String do
-               var res = new Buffer
+               var res = new FlatBuffer
                res.append("{name}: {mtype.to_console}")
                if is_vararg then res.append("...")
                return res.to_s
@@ -762,7 +758,7 @@ end
 
 redef class MGenericType
        redef fun to_console do
-               var res = new Buffer
+               var res = new FlatBuffer
                res.append("{mclass.name}[")
                for i in [0..arguments.length[ do
                        res.append(arguments[i].to_console)
@@ -837,7 +833,7 @@ redef class String
 
        private fun escape: String
        do
-               var b = new Buffer
+               var b = new FlatBuffer
                for c in self.chars do
                        if c == '\n' then
                                b.append("\\n")
@@ -868,7 +864,7 @@ end
 # Create a tool context to handle options and paths
 var toolcontext = new ToolContext
 toolcontext.tooldescription = "Usage: nitx [OPTION]... <file.nit> [query]\nDisplays specific pieces of API information from Nit source files."
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # Here we launch the nit index
 var ni = new NitIndex(toolcontext)