Merge: More no warning
authorJean Privat <jean@pryen.org>
Tue, 23 Dec 2014 02:39:40 +0000 (21:39 -0500)
committerJean Privat <jean@pryen.org>
Tue, 23 Dec 2014 02:39:40 +0000 (21:39 -0500)
* process no_wargning before analysing classes
* test_suites are automatically no_warning("missing-doc")
* add no_warning in generated files

Pull-Request: #1058
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

12 files changed:
contrib/nitcc/src/autom.nit
contrib/nitcc/src/grammar.nit
contrib/nitcc/src/nitcc.nit
contrib/pep8analysis/src/parser/lexer.nit
contrib/pep8analysis/src/parser/parser.nit
contrib/pep8analysis/src/parser/parser_nodes.nit
contrib/pep8analysis/src/parser/parser_prod.nit
lib/json/json_lexer.nit
lib/json/json_parser.nit
src/ffi/extern_classes.nit
src/frontend/frontend.nit
src/frontend/no_warning.nit

index 5ece999..1367e0d 100644 (file)
@@ -655,7 +655,8 @@ private class DFAGenerator
                        i += 1
                end
 
-               add "# Lexer generated by nitcc for the grammar {name}"
+               add "# Lexer generated by nitcc for the grammar {name}\n"
+               add "module {name}_lexer is no_warning \"missing-doc\"\n"
                add("import nitcc_runtime\n")
 
                var p = parser
index eea312f..b9ac2f8 100644 (file)
@@ -640,6 +640,7 @@ private class Generator
                var gram = autom.grammar
 
                add "# Parser generated by nitcc for the grammar {name}"
+               add "module {name}_parser is no_warning(\"missing-doc\",\"old-init\")"
                add "import nitcc_runtime"
 
                add "class Parser_{name}"
index 562f5cb..0cc9d2a 100644 (file)
@@ -144,9 +144,14 @@ lr.gen_to_nit("{name}_parser.nit", name)
 
 f = new OFStream.open("{name}_test_parser.nit")
 f.write """# Generated by nitcc for the language {{{name}}}
+
+# Standalone parser tester for the language {{{name}}}
+module {{{name}}}_test_parser
 import nitcc_runtime
 import {{{name}}}_lexer
 import {{{name}}}_parser
+
+# Class to test the parser for the language {{{name}}}
 class TestParser_{{{name}}}
        super TestParser
        redef fun name do return \"{{{name}}}\"
index f5b910a..96f5430 100644 (file)
@@ -1,6 +1,6 @@
 # Lexer and its tokens.
 # This file was generated by SableCC (http://www.sablecc.org/).
-module lexer
+module lexer is no_warning("missing-doc", "old-init")
 
 intrude import parser_nodes
 private import tables
index 2be9a9a..3fd9171 100644 (file)
@@ -1,6 +1,6 @@
 # Parser.
 # This file was generated by SableCC (http://www.sablecc.org/).
-module parser
+module parser is no_warning("missing-doc", "old-init")
 
 intrude import parser_prod
 import tables
index 97530a4..6aac4bc 100644 (file)
@@ -1,6 +1,6 @@
 # Raw AST node hierarchy.
 # This file was generated by SableCC (http://www.sablecc.org/).
-module parser_nodes
+module parser_nodes is no_warning("missing-doc", "old-init")
 
 import location
 
index f7fb2f7..533cdb0 100644 (file)
@@ -1,6 +1,6 @@
 # Production AST nodes full definition.
 # This file was generated by SableCC (http://www.sablecc.org/).
-module parser_prod
+module parser_prod is no_warning("missing-doc")
 
 import lexer
 intrude import parser_nodes
index 3273525..162e529 100644 (file)
@@ -1,4 +1,6 @@
-# Lexer generated by nitcc for the grammar jsonimport nitcc_runtime
+# Lexer generated by nitcc for the grammar json
+module json_lexer is no_warning "missing-doc"
+import nitcc_runtime
 import json_parser
 class Lexer_json
        super Lexer
index f95a3cb..581551f 100644 (file)
@@ -1,4 +1,5 @@
 # Parser generated by nitcc for the grammar json
+module json_parser is no_warning("missing-doc","old-init")
 import nitcc_runtime
 class Parser_json
        super Parser
index 05d8fd5..bc4f0c4 100644 (file)
@@ -20,7 +20,7 @@ module extern_classes
 import ffi_base
 
 redef class ToolContext
-       var extern_classes_typing_phase_ast: Phase = new ExternClassesTypingPhaseAst(self, [ffi_language_assignation_phase])
+       var extern_classes_typing_phase_ast: Phase = new ExternClassesTypingPhaseAst(self, [ffi_language_assignation_phase, modelize_class_phase])
 
        var extern_classes_typing_phase_model: Phase = new ExternClassesTypingPhaseModel(self,
                [extern_classes_typing_phase_ast, modelize_class_phase, modelize_property_phase])
index 7ba0e90..5b04e01 100644 (file)
@@ -33,6 +33,8 @@ redef class ToolContext
        # SEE `dummy`
        private fun do_dummy: Bool
        do
+               # Force no warning before analysing classes
+               phases.add_edge(modelize_class_phase, no_warning_phase)
                # Force easy warnings after modelbuilder
                phases.add_edge(simple_misc_analysis_phase, modelize_property_phase)
                # Force easy warnings before intraproc-errors
index c862075..3c31b65 100644 (file)
@@ -38,13 +38,20 @@ private class NoWarningPhase
 
                var modelbuilder = toolcontext.modelbuilder
 
-               # Get all the new annotations
+               var source = nmodule.location.file
+
+               # Disable `missing-doc` for `test_suite`
+               if source != null and not nmoduledecl.get_annotations("test_suite").is_empty then
+                       toolcontext.warning_blacklist[source].add("missing-doc")
+               end
+
+
+               # Get all the `no_warning` annotations
                var name = "no_warning"
                var annots = nmoduledecl.get_annotations(name)
 
                if annots.is_empty then return
 
-               var source = nmodule.location.file
                if source == null then
                        modelbuilder.warning(annots.first, "file-less-module", "Warning: annotation `{name}` does not currently work on file-less modules.")
                        return