Merge: lib/string: some cleaning, doc and unit tests
authorJean Privat <jean@pryen.org>
Fri, 4 Apr 2014 20:26:42 +0000 (16:26 -0400)
committerJean Privat <jean@pryen.org>
Fri, 4 Apr 2014 20:26:42 +0000 (16:26 -0400)
An important point is the generalization of services from
StringCharView to Sequences, and the privatization of StringCharView.

Closes #144
Closes #140
Pull-Request: #383
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

187 files changed:
contrib/pep8analysis/.gitignore [new file with mode: 0644]
contrib/pep8analysis/Makefile [new file with mode: 0644]
contrib/pep8analysis/README.md [new file with mode: 0644]
contrib/pep8analysis/src/ast/ast.nit [new file with mode: 0644]
contrib/pep8analysis/src/ast/ast_base.nit [new file with mode: 0644]
contrib/pep8analysis/src/ast/pretty_instructions.nit [new file with mode: 0644]
contrib/pep8analysis/src/ast/rich_instructions.nit [new file with mode: 0644]
contrib/pep8analysis/src/ast/suffixed_instructions.nit [new file with mode: 0644]
contrib/pep8analysis/src/backbone.nit [new file with mode: 0644]
contrib/pep8analysis/src/cfg/cfg.nit [new file with mode: 0644]
contrib/pep8analysis/src/cfg/cfg_base.nit [new file with mode: 0644]
contrib/pep8analysis/src/cfg/dot_printer.nit [new file with mode: 0644]
contrib/pep8analysis/src/cfg/sanity.nit [new file with mode: 0644]
contrib/pep8analysis/src/flow_analysis/flow_analysis.nit [new file with mode: 0644]
contrib/pep8analysis/src/flow_analysis/framework.nit [new file with mode: 0644]
contrib/pep8analysis/src/flow_analysis/range_analysis.nit [new file with mode: 0644]
contrib/pep8analysis/src/flow_analysis/reaching_defs.nit [new file with mode: 0644]
contrib/pep8analysis/src/flow_analysis/types.nit [new file with mode: 0644]
contrib/pep8analysis/src/location.nit [new file with mode: 0644]
contrib/pep8analysis/src/model/directives.nit [new file with mode: 0644]
contrib/pep8analysis/src/model/model.nit [new file with mode: 0644]
contrib/pep8analysis/src/model/operands.nit [new file with mode: 0644]
contrib/pep8analysis/src/model/vars.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/Makefile [new file with mode: 0644]
contrib/pep8analysis/src/parser/README [new file with mode: 0644]
contrib/pep8analysis/src/parser/fact_parser.pl [new file with mode: 0755]
contrib/pep8analysis/src/parser/lexer.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/parser.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/parser_abs.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/parser_nodes.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/parser_prod.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/pep8.sablecc [new file with mode: 0644]
contrib/pep8analysis/src/parser/pep8.sablecc3 [new file with mode: 0644]
contrib/pep8analysis/src/parser/pep8_lexer.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/pep8_parser.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/pep8_test_parser.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/prescc.pl [new file with mode: 0755]
contrib/pep8analysis/src/parser/prescc.sh [new file with mode: 0755]
contrib/pep8analysis/src/parser/tables.nit [new file with mode: 0644]
contrib/pep8analysis/src/parser/tables_nit.c [new file with mode: 0644]
contrib/pep8analysis/src/parser/tables_nit.h [moved from tests/test_ni_inits.nit.h with 55% similarity]
contrib/pep8analysis/src/parser/xss/lexer.xss [new file with mode: 0644]
contrib/pep8analysis/src/parser/xss/main.xss [new file with mode: 0644]
contrib/pep8analysis/src/parser/xss/parser.xss [new file with mode: 0644]
contrib/pep8analysis/src/parser/xss/prods.xss [new file with mode: 0644]
contrib/pep8analysis/src/parser/xss/tokens.xss [new file with mode: 0644]
contrib/pep8analysis/src/pep8analysis.nit [new file with mode: 0644]
contrib/pep8analysis/tests/micro/directive-in-code.pep [new file with mode: 0644]
contrib/pep8analysis/tests/micro/range.pep [new file with mode: 0644]
contrib/pep8analysis/tests/micro/to-graph.pep [new file with mode: 0644]
contrib/pep8analysis/tests/micro/types.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/02-fibo.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/04-abc.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/04-leplusgrand.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-0et100.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-1a100.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-aei.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-otan.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-simul_3n.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-simul_n.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-simul_x.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/05-sommeVec.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-calc-non-pur.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-compte1.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-majuscules.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-menu.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-print-non-pur.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-processVec.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-puissance2.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-sommes1.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-sommes2.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-sommes3.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/06-x100.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/07-matrice.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/07-stri.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/07-stris.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/07-tri.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/07-tri2.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-abus.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-div-stack.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-div-vars.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-div.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-fib.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-incr.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-liretab-stack.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-liretab.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-pile.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-tab.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-triforce.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/08-varlocales.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/09-liste.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/09-produit.pep [new file with mode: 0644]
contrib/pep8analysis/tests/privat/fib.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/addition_stro.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/boucle.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/chari_charo.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/division.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/hello.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/if_else.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/if_elseif_else.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/lecture_chaine.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/matrice.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/max_tableau.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/multiplication.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/reverse_tableau.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/somme_tableau.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/soustraction.pep [new file with mode: 0644]
contrib/pep8analysis/tests/terrasa/tri_bulles.pep [new file with mode: 0644]
examples/opengles2_hello_triangle.nit
lib/egl.nit
lib/standard/collection/abstract_collection.nit
lib/standard/collection/array.nit
lib/standard/collection/hash_collection.nit
lib/standard/exec_nit.h
src/abstract_compiler.nit
src/c_tools.nit
src/common_ffi/c.nit
src/common_ffi/c_compiler_options.nit
src/common_ffi/common_ffi.nit
src/common_ffi/cpp.nit
src/common_ffi/ffi_base.nit
src/common_ffi/pkgconfig.nit
src/compiler_ffi.nit
src/global_compiler.nit
src/nitg.nit
src/separate_compiler.nit
src/separate_options.nit [deleted file]
tests/Makefile
tests/base_ni.nit.c [deleted file]
tests/base_ni.nit.h [deleted file]
tests/nitg-e.skip
tests/nitg-s.skip
tests/niti.skip
tests/pep8analysis.args [new file with mode: 0644]
tests/sav/pep8analysis.res [new file with mode: 0644]
tests/sav/pep8analysis_args1.res [new file with mode: 0644]
tests/sav/pep8analysis_args2.res [new file with mode: 0644]
tests/sav/pep8analysis_args3.res [new file with mode: 0644]
tests/sav/pep8analysis_args4.res [new file with mode: 0644]
tests/test_ni_accessor.nit.c [deleted file]
tests/test_ni_accessor.nit.h [deleted file]
tests/test_ni_cast_extra.nit.c [deleted file]
tests/test_ni_cast_extra.nit.h [deleted file]
tests/test_ni_cast_simple.nit.c [deleted file]
tests/test_ni_cast_simple.nit.h [deleted file]
tests/test_ni_casts.nit.c [deleted file]
tests/test_ni_casts.nit.h [deleted file]
tests/test_ni_fibonacci.nit.c [deleted file]
tests/test_ni_fibonacci.nit.h [deleted file]
tests/test_ni_global_not_called_but_referred.nit.c [deleted file]
tests/test_ni_global_not_called_but_referred.nit.h [deleted file]
tests/test_ni_global_only_from_native.nit.c [deleted file]
tests/test_ni_global_only_from_native.nit.h [deleted file]
tests/test_ni_import_init.nit.c [deleted file]
tests/test_ni_import_init.nit.h [deleted file]
tests/test_ni_import_meth.nit.c [deleted file]
tests/test_ni_import_meth.nit.h [deleted file]
tests/test_ni_inits.nit.c [deleted file]
tests/test_ni_local_ref.nit.c [deleted file]
tests/test_ni_local_ref.nit.h [deleted file]
tests/test_ni_new.nit.c [deleted file]
tests/test_ni_new.nit.h [deleted file]
tests/test_ni_null.nit.c [deleted file]
tests/test_ni_null.nit.h [deleted file]
tests/test_ni_operators.nit.c [deleted file]
tests/test_ni_operators.nit.h [deleted file]
tests/test_ni_optimized.nit.c [deleted file]
tests/test_ni_optimized.nit.h [deleted file]
tests/test_ni_out.nit.c [deleted file]
tests/test_ni_out.nit.h [deleted file]
tests/test_ni_pointer.nit.c [deleted file]
tests/test_ni_pointer.nit.h [deleted file]
tests/test_ni_primitives.nit.c [deleted file]
tests/test_ni_primitives.nit.h [deleted file]
tests/test_ni_special_all_native.nit.c [deleted file]
tests/test_ni_special_all_native.nit.h [deleted file]
tests/test_ni_special_from_native.nit.c [deleted file]
tests/test_ni_special_from_native.nit.h [deleted file]
tests/test_ni_special_pointer.nit.c [deleted file]
tests/test_ni_special_pointer.nit.h [deleted file]
tests/test_ni_special_to_native.nit.c [deleted file]
tests/test_ni_special_to_native.nit.h [deleted file]
tests/test_ni_strings.nit.c [deleted file]
tests/test_ni_strings.nit.h [deleted file]
tests/test_ni_super.nit.c [deleted file]
tests/test_ni_super.nit.h [deleted file]
tests/testfull.sh

diff --git a/contrib/pep8analysis/.gitignore b/contrib/pep8analysis/.gitignore
new file mode 100644 (file)
index 0000000..1010231
--- /dev/null
@@ -0,0 +1,10 @@
+.nit_compile/
+
+doc/
+bin/
+out/
+
+src/parser/*.orig
+src/parser/*.dump
+
+tests/students/
diff --git a/contrib/pep8analysis/Makefile b/contrib/pep8analysis/Makefile
new file mode 100644 (file)
index 0000000..15809f8
--- /dev/null
@@ -0,0 +1,11 @@
+bin/pep8analysis:
+       mkdir -p bin
+       ../../bin/nitg --global -o bin/pep8analysis src/pep8analysis.nit
+
+doc/index.html:
+       ../../bin/nitdoc src/pep8analysis.nit
+
+tests: bin/pep8analysis
+       bin/pep8analysis --cfg-long tests/privat/*.pep tests/micro/*.pep tests/terrasa/*.pep
+
+.PHONY: bin/pep8analysis tests doc/index.html
diff --git a/contrib/pep8analysis/README.md b/contrib/pep8analysis/README.md
new file mode 100644 (file)
index 0000000..216b878
--- /dev/null
@@ -0,0 +1,37 @@
+# Pep/8 Analysis
+
+This project provides tools to statically analyze Pep/8 programs in order to detect bugs or bad programming practices.
+
+For more information about the Pep/8 assembly language visit http://code.google.com/p/pep8-1/.
+
+# Installation
+
+Make sure you have a Nit compiler installed (http://nitlanguage.org) and the environment variable NIT\_DIR correctly set to the Nit installation directory.
+
+Clone the source from http://github.com/xymus/pep8analysis.git and compile with `make`.
+
+# Usage
+
+For basic results, execute on the Pep/8 program prog.pep with `bin/pep8analyzer prog.pep`.
+
+Call `bin/pep8analyer --help` for a description of the available (and up to date) options.
+
+The tools provides its results in two ways, the final report and an annotated CFG (usually created in the out directory).
+
+# Analyses
+
+## Dead code and possible execution of data
+
+The tools analyses statically the program according to possbile branches and function calls to find wrongfully placed instructions and directives. It reports dead code blocks and possibly executed data blocks.
+
+## Range analysis
+
+The range analysis reports the value of registers and memory on the annotated CFG.
+
+## Reaching definitions
+
+The reaching definitions analysis tracks what lines may have assigned values to register and memory. Its results are on the anotated CFG. They can be used to better understand a program.
+
+## Types analysis
+
+The types analysis detects wrongful use of types or of uninitialized data. It reports possible errors in the final report.
diff --git a/contrib/pep8analysis/src/ast/ast.nit b/contrib/pep8analysis/src/ast/ast.nit
new file mode 100644 (file)
index 0000000..2626881
--- /dev/null
@@ -0,0 +1,4 @@
+import rich_instructions
+import suffixed_instructions
+import pretty_instructions
+
diff --git a/contrib/pep8analysis/src/ast/ast_base.nit b/contrib/pep8analysis/src/ast/ast_base.nit
new file mode 100644 (file)
index 0000000..7054d29
--- /dev/null
@@ -0,0 +1,24 @@
+import backbone
+import parser
+
+redef class AnalysisManager
+       fun build_ast( filename : String ) : nullable AListing
+       do
+               var file = new IFStream.open( filename )
+
+               var source = new SourceFile(filename, file)
+               var lexer = new Lexer(source)
+               var parser = new Parser(lexer)
+               var node_tree = parser.parse
+
+               var ast = node_tree.n_base
+               if ast == null then
+                       var err = node_tree.n_eof
+                       assert err isa AError
+                       print "error at {err.location}: {err.message}"
+                       return null
+               end
+
+               return ast
+       end
+end
diff --git a/contrib/pep8analysis/src/ast/pretty_instructions.nit b/contrib/pep8analysis/src/ast/pretty_instructions.nit
new file mode 100644 (file)
index 0000000..7616b7e
--- /dev/null
@@ -0,0 +1,87 @@
+module pretty_instructions
+
+import ast_base
+import rich_instructions
+
+redef class AnalysisManager
+       var opt_ast = new OptionBool("Print the AST","--ast")
+
+       redef init
+       do
+               super
+               opts.add_option(opt_ast)
+       end
+
+       redef fun build_ast(filename)
+       do
+               var ast = super
+
+               return ast
+       end
+end
+
+class ASTPrinter
+       super Visitor
+
+       var str writable = ""
+
+       init do end
+       redef fun visit(n) do n.accept_ast_printer(self)
+end
+
+redef class ANode
+       fun accept_ast_printer(v: ASTPrinter) do visit_all(v)
+end
+
+redef class Token
+       redef fun to_s do return text
+       redef fun accept_ast_printer(v: ASTPrinter) do v.str += self.to_s # + " "
+end
+
+redef class TId
+       redef fun accept_ast_printer(v: ASTPrinter)
+       do
+               var len = self.to_s.length
+               if len < 6 and len > 1 then
+                       v.str += self.to_s + " "*(6-len)
+               else
+                       v.str += self.to_s
+               end
+       end
+end
+
+redef class ANonEmptyLine
+       redef fun accept_ast_printer(v: ASTPrinter)
+       do
+               if n_label_decl == null then v.str += once " "*10
+               visit_all(v)
+       end
+end
+
+redef class AInstruction
+       redef fun accept_ast_printer(v: ASTPrinter)
+       do
+               var pre_size = v.str.length
+               visit_all(v)
+               var post_size = v.str.length
+               var diff_size = post_size - pre_size
+               if diff_size < 20 then v.str += " "*(20-diff_size)
+       end
+end
+
+redef class ALabelDecl
+       redef fun accept_ast_printer(v: ASTPrinter)
+       do
+               var text = n_id.text + ":"
+               v.str += text + " "*(10-text.length)
+       end
+end
+
+redef class ALine
+       fun text: String
+       do
+               var p = new ASTPrinter
+               p.enter_visit( self )
+               return p.str
+       end
+end
diff --git a/contrib/pep8analysis/src/ast/rich_instructions.nit b/contrib/pep8analysis/src/ast/rich_instructions.nit
new file mode 100644 (file)
index 0000000..6989980
--- /dev/null
@@ -0,0 +1,388 @@
+# Pep/8 instructions are not reserved as keywords. It is common
+# that the identifier of an instruction will be used for a label.
+# For this reason, we cannot create precise instruction nodes with
+# the parser.
+#
+# This module manually creates the expected subclass with an additionnal
+# OOP hiearchy.
+
+module rich_instructions
+
+import backbone
+intrude import parser
+import ast_base
+
+redef class AnalysisManager
+       redef fun build_ast(filename)
+       do
+               var ast = super
+               if ast != null then
+               #fun enrich_ast( ast : AListing ) do
+                       for line in ast.n_lines do
+                               if line isa AInstructionLine then
+                                       line.enrich
+                               end
+                       end
+               end
+               return ast
+       end
+end
+
+redef class AInstructionLine
+       # TODO move to AnalysisManager as private?
+       private fun enrich
+       do
+               var instr = n_instruction
+               var new_instr : AInstruction
+
+               var id = instr.n_id.text.to_upper
+               if instr isa ABinaryInstruction then
+                       if id == "BR" then
+                               new_instr = new ABrInstruction.from(instr)
+                       else if id == "BRLE" then
+                               new_instr = new ABrleInstruction.from(instr)
+                       else if id == "BRLT" then
+                               new_instr = new ABrltInstruction.from(instr)
+                       else if id == "BREQ" then
+                               new_instr = new ABreqInstruction.from(instr)
+                       else if id == "BRNE" then
+                               new_instr = new ABrneInstruction.from(instr)
+                       else if id == "BRGE" then
+                               new_instr = new ABrgeInstruction.from(instr)
+                       else if id == "BRGT" then
+                               new_instr = new ABrgtInstruction.from(instr)
+                       else if id == "BRV" then
+                               new_instr = new ABrvInstruction.from(instr)
+                       else if id == "BRC" then
+                               new_instr = new ABrcInstruction.from(instr)
+                       else if id == "CALL" then
+                               new_instr = new ACallInstruction.from(instr)
+                       else if id == "NOP" then
+                               new_instr = new ABinaryNopInstruction.from(instr)
+                       else if id == "DECI" then
+                               new_instr = new ADeciInstruction.from(instr)
+                       else if id == "DECO" then
+                               new_instr = new ADecoInstruction.from(instr)
+                       else if id == "STRO" then
+                               new_instr = new AStroInstruction.from(instr)
+                       else if id == "CHARI" then
+                               new_instr = new AChariInstruction.from(instr)
+                       else if id == "CHARO" then
+                               new_instr = new ACharoInstruction.from(instr)
+                       else if id == "ADDSP" then
+                               new_instr = new AAddspInstruction.from(instr)
+                       else if id == "SUBSP" then
+                               new_instr = new ASubspInstruction.from(instr)
+                       else if id.has_prefix("ADD") then
+                               new_instr = new AAddInstruction.from(instr)
+                       else if id.has_prefix("SUB") then
+                               new_instr = new ASubInstruction.from(instr)
+                       else if id.has_prefix("AND") then
+                               new_instr = new AAndInstruction.from(instr)
+                       else if id.has_prefix("OR") then
+                               new_instr = new AOrInstruction.from(instr)
+                       else if id.has_prefix("CP") then
+                               new_instr = new ACpInstruction.from(instr)
+                       else if id.has_prefix("LDBYTE") then
+                               new_instr = new ALdbyteInstruction.from(instr)
+                       else if id.has_prefix("LD") then
+                               new_instr = new ALdInstruction.from(instr)
+                       else if id.has_prefix("STBYTE") then
+                               new_instr = new AStbyteInstruction.from(instr)
+                       else if id.has_prefix("ST") then
+                               new_instr = new AStInstruction.from(instr)
+                       else
+                               # error
+                               print "error {instr.location}: invalid instruction {id} with data access"
+                               abort
+                       end
+               else if instr isa AUnaryInstruction then
+                       if id == "STOP" then
+                               new_instr = new AStopInstruction.from(instr)
+                       else if id == "RETTR" then
+                               new_instr = new ARettrInstruction.from(instr)
+                       else if id == "MOVSPA" then
+                               new_instr = new AMovspaInstruction.from(instr)
+                       else if id == "MOVFLGA" then
+                               new_instr = new AMovflgaInstruction.from(instr)
+                       else if id.has_prefix("NOT") then
+                               new_instr = new ANotInstruction.from(instr)
+                       else if id.has_prefix("NEG") then
+                               new_instr = new ANegInstruction.from(instr)
+                       else if id.has_prefix("ASL") then
+                               new_instr = new AAslInstruction.from(instr)
+                       else if id.has_prefix("ASR") then
+                               new_instr = new AAsrInstruction.from(instr)
+                       else if id.has_prefix("ROL") then
+                               new_instr = new ARolInstruction.from(instr)
+                       else if id.has_prefix("ROR") then
+                               new_instr = new ARorInstruction.from(instr)
+                       else if id.has_prefix("NOP") then
+                               new_instr = new AUnaryNopInstruction.from(instr)
+                       else if id.has_prefix("RET") then
+                               new_instr = new ARetInstruction.from(instr)
+                       else
+                               # error
+                               print "error {instr.location}: invalid instruction {id} without data access"
+                               abort
+                       end
+               else abort
+
+               # TODO check, one of those 2 might not be necessary
+               replace_child( instr, new_instr )
+               #n_instruction = new_instr
+       end
+end
+
+#
+# Support classes
+#
+abstract class ARichBinaryInstruction
+       super ABinaryInstruction
+
+       init from( src: ABinaryInstruction ) do
+               _n_operand = src.n_operand
+               _n_id = src.n_id
+               parent = src.parent
+
+               init(src.location)
+       end
+end
+
+abstract class ARichUnaryInstruction
+       super AUnaryInstruction
+
+       init from( src: AUnaryInstruction ) do
+               _n_id = src.n_id
+               parent = src.parent
+
+               init(src.location)
+       end
+end
+
+#
+# Categories
+#
+abstract class ABranchInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+
+class ABrInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrleInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrltInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABreqInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrneInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrgeInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrgtInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrvInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ABrcInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+class ACallInstruction
+       super ABranchInstruction
+       init from( src ) do super
+end
+
+
+abstract class ANopInstruction
+       super AInstruction
+end
+class ABinaryNopInstruction
+       super ANopInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+class AUnaryNopInstruction
+       super ANopInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+
+abstract class AOutputInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+abstract class AInputInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+# TODO add category for ADecInstruction?
+class ADeciInstruction
+       super AInputInstruction
+       init from( src ) do super
+end
+class ADecoInstruction
+       super AOutputInstruction
+       init from( src ) do super
+end
+
+class AStroInstruction
+       super AOutputInstruction
+       init from( src ) do super
+end
+
+class AChariInstruction
+       super AInputInstruction
+       init from( src ) do super
+end
+class ACharoInstruction
+       super AOutputInstruction
+       init from( src ) do super
+end
+
+
+abstract class AStackInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+class AAddspInstruction
+       super AStackInstruction
+       init from( src ) do super
+end
+class ASubspInstruction
+       super AStackInstruction
+       init from( src ) do super
+end
+
+# Misc
+class AStopInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+class ARettrInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+abstract class AMovInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+class AMovspaInstruction
+       super AMovInstruction
+       init from( src ) do super
+end
+class AMovflgaInstruction
+       super AMovInstruction
+       init from( src ) do super
+end
+
+
+class ANotInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+class ANegInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+abstract class AShiftInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+class AAslInstruction
+       super AShiftInstruction
+       init from( src ) do super
+end
+class AAsrInstruction
+       super AShiftInstruction
+       init from( src ) do super
+end
+class ARolInstruction
+       super AShiftInstruction
+       init from( src ) do super
+end
+class ARorInstruction
+       super AShiftInstruction
+       init from( src ) do super
+end
+
+class ARetInstruction
+       super ARichUnaryInstruction
+       init from( src ) do super
+end
+
+
+# TODO find a better name
+abstract class AArithmeticInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+class AAddInstruction
+       super AArithmeticInstruction
+       init from( src ) do super
+end
+class ASubInstruction
+       super AArithmeticInstruction
+       init from( src ) do super
+end
+class AAndInstruction
+       super AArithmeticInstruction
+       init from( src ) do super
+end
+class AOrInstruction
+       super AArithmeticInstruction
+       init from( src ) do super
+end
+
+class ACpInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+
+
+abstract class ALoadInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+class ALdInstruction
+       super ALoadInstruction
+       init from( src ) do super
+end
+class ALdbyteInstruction
+       super ALoadInstruction
+       init from( src ) do super
+end
+
+abstract class AStoreInstruction
+       super ARichBinaryInstruction
+       init from( src ) do super
+end
+class AStInstruction
+       super AStoreInstruction
+       init from( src ) do super
+end
+class AStbyteInstruction
+       super AStoreInstruction
+       init from( src ) do super
+end
diff --git a/contrib/pep8analysis/src/ast/suffixed_instructions.nit b/contrib/pep8analysis/src/ast/suffixed_instructions.nit
new file mode 100644 (file)
index 0000000..6466430
--- /dev/null
@@ -0,0 +1,65 @@
+# Pep/8 instructions are not reserved as keywords. It is common
+# that the identifier of an instruction will be used for a label.
+# For this reason, we cannot create precise instruction nodes with
+# the parser.
+#
+# This module manually creates the expected subclass with an additionnal
+# OOP hiearchy.
+
+module suffixed_instructions
+
+import rich_instructions
+
+#
+# Support classes
+#
+abstract class ARegisterSuffixed
+       super AInstruction
+
+       fun register : Char do return n_id.text.to_upper.last
+end
+
+abstract class ADigitSuffixed
+       super AInstruction
+
+       fun digit : Int do return n_id.text.last.to_i
+       fun digit_max : Int is abstract
+end
+
+
+#
+# Other classification
+#
+redef class AUnaryNopInstruction
+       super ADigitSuffixed
+       redef fun digit_max do return 1.lshift(2)-1
+end
+
+redef class ANotInstruction
+       super ARegisterSuffixed
+end
+
+redef class ANegInstruction
+       super ARegisterSuffixed
+end
+
+redef class AShiftInstruction
+       super ARegisterSuffixed
+end
+
+redef class ARetInstruction
+       super ADigitSuffixed
+       redef fun digit_max do return 1.lshift(3)-1
+end
+
+redef abstract class AArithmeticInstruction
+       super ARegisterSuffixed
+end
+
+redef abstract class ALoadInstruction
+       super ARegisterSuffixed
+end
+
+redef abstract class AStoreInstruction
+       super ARegisterSuffixed
+end
diff --git a/contrib/pep8analysis/src/backbone.nit b/contrib/pep8analysis/src/backbone.nit
new file mode 100644 (file)
index 0000000..369c0a7
--- /dev/null
@@ -0,0 +1,104 @@
+import opts
+
+import parser
+
+class AnalysisManager
+       super Noter
+       var opts = new OptionContext
+
+       init do end
+end
+
+abstract class Noter
+       var notes = new Array[Note]
+
+       var failed = false
+
+       fun print_notes
+       do
+               if not notes.is_empty then
+                       print "# Notes:"
+                       for n in notes do print n
+               end
+       end
+
+       fun fatal_error(n: ANode, msg: String)
+       do
+               notes.add( new Fatal(n.location, msg) )
+               failed = true
+       end
+
+       fun reset
+       do
+               failed = false
+       end
+end
+
+abstract class Note
+       var line: Location
+       var to: nullable Location = null
+       var msg: String
+
+       init (line: Location, msg: String)
+       do
+               self.line = line
+               self.msg = msg
+       end
+       init range(from, to: Location, msg: String)
+       do
+               self.line = from
+               self.to = to
+               self.msg = msg
+       end
+
+       fun prefix: String is abstract
+       redef fun to_s do
+               var s = ""
+               var to = to
+               if to != null then
+                       s += " from {line} to {to}"
+                       s = "{line.to_file_s}:{line.to_line_s}--{to.to_line_s}; "
+               else
+                       s = "{line.to_file_s}:{line.to_line_s}; "
+               end
+               return "{prefix}{s}{msg}"
+       end
+end
+
+class Warn
+       super Note
+       init (line: Location, msg: String) do super
+       init range(from, to: Location, msg: String) do super
+       redef fun prefix do return "Warning: "
+end
+
+class Error
+       super Note
+       init (line: Location, msg: String) do super
+       init range(from, to: Location, msg: String) do super
+       redef fun prefix do return "Error:   "
+end
+
+class Fatal
+       super Note
+       init (line: Location, msg: String) do super
+       init range(from, to: Location, msg: String) do super
+       redef fun prefix do return "Fatal:   "
+end
+
+redef class Object
+       protected fun manager: AnalysisManager is abstract
+end
+
+redef class Location
+       # "line 5"
+       fun to_line_s: String
+       do
+               return line_start.to_s
+       end
+
+       fun to_file_s: String
+       do
+               return file.filename
+       end
+end
diff --git a/contrib/pep8analysis/src/cfg/cfg.nit b/contrib/pep8analysis/src/cfg/cfg.nit
new file mode 100644 (file)
index 0000000..0acf2de
--- /dev/null
@@ -0,0 +1,46 @@
+import cfg_base
+import dot_printer
+import sanity
+
+redef class AnalysisManager
+       var opt_cfg = new OptionBool("Print the CFG to \"cfg.dot\" (for debugging purposes)", "--cfg")
+       var opt_cfg_long = new OptionBool("Print the long format CFG", "--cfg-long")
+
+       var opt_cfg_inline = new OptionBool("Inline function calls in the CFG", "--inline")
+       #var opt_cfg_not_inline = new OptionBool("Do not inline function calls in the CFG", "--no-inline")
+
+       var cfg: nullable CFG = null
+
+       redef init
+       do
+               super
+
+               opts.add_option(opt_cfg)
+               opts.add_option(opt_cfg_long)
+               #opts.add_option(opt_cfg_not_inline)
+               opts.add_option(opt_cfg_inline)
+       end
+
+       redef fun build_cfg(model)
+       do
+               var cfg = super
+               self.cfg = cfg
+
+               if cfg.has_function_calls then
+                       #if not opt_cfg_not_inline.value then
+                       if opt_cfg_inline.value then
+                               cfg.inline_functions
+                       else
+                               cfg.watchdog = 0
+                               var to_link = new List[BasicBlock]
+                               if not cfg.link_ret_to_calls(cfg.start, to_link, new List[BasicBlock], 0) then
+                                       manager.fatal_error(model.lines.first, "failed to organize function calls")
+                               end
+                       end
+               end
+
+               verify_cfg_sanity(cfg)
+
+               return cfg
+       end
+end
diff --git a/contrib/pep8analysis/src/cfg/cfg_base.nit b/contrib/pep8analysis/src/cfg/cfg_base.nit
new file mode 100644 (file)
index 0000000..6e22cf2
--- /dev/null
@@ -0,0 +1,442 @@
+import pipeline
+
+import model
+
+redef class AnalysisManager
+       fun build_cfg( model: Model ) : CFG
+       do
+               var cfg = new CFG( model )
+               return cfg
+       end
+end
+
+redef class ABranchInstruction
+       fun is_indirect: Bool
+       do
+               var op = n_operand
+               return op isa AAnyOperand and (once ["x","d"]).has(op.addressing_mode)
+       end
+end
+
+class CFG
+       var start : BasicBlock
+       var finish : BasicBlock
+       var addr_to_blocks = new HashMap[Int,BasicBlock]
+       var blocks = new Array[BasicBlock]
+
+       var has_function_calls = false
+
+       init (model: Model)
+       do
+               assert not model.lines.is_empty
+
+               var starts = [0]
+               var ends = [model.lines.last.address]
+
+               # check for indirect branches
+               #var indirect_jump_sites = new Array[Int]
+               var has_indirect_jump_sites = false
+
+               # detect basic block limits
+               for line in model.lines do
+                       if line isa AInstructionLine then
+                               var instr = line.n_instruction
+                               if instr isa ABranchInstruction then
+                                       if instr.is_indirect then
+                                               #indirect_jump_sites.add(line.address)
+                                               has_indirect_jump_sites = true
+                                               manager.notes.add(new Warn(instr.location, "use of indirect jumps, the CFG may be wrong"))
+                                       else
+                                               var op = instr.n_operand
+                                               var dest = op.n_value.to_i
+                                               starts.add(dest)
+                                       end
+                                       ends.add(line.address)
+                                       if not instr isa ABrInstruction then
+                                               # next line is possible start
+                                               starts.add(line.address+4)
+                                       end
+                               else if instr isa AStopInstruction or
+                                        instr isa ARetInstruction then
+                                       ends.add(line.address)
+                               end
+                       end
+               end
+
+               var addresses_in_memory = new Array[Int]
+               #if not indirect_jumps.is_empty then
+               if has_indirect_jump_sites then
+                       # find possible jump destinations
+
+                       for line in model.lines do
+                               if line isa ADirectiveLine then
+                                       var dir = line.n_directive
+                                       if dir isa AAddrssDirective then
+                                               var dest = dir.n_value.to_i
+                                               starts.add(dest)
+                                               addresses_in_memory.add(dest)
+                                       end
+                               end
+                       end
+
+                       # link indirect jumps to possible destinations
+                       #for src in addresses_in_memory do
+                       #end
+               end
+
+               # sort breakpoints in order
+               starts = starts.iterator.uniq.sort.to_a
+               ends = ends.iterator.uniq.sort.to_a
+
+               # create basic blocks
+               var current_block: nullable BasicBlock = null
+               var next_start_i = 0
+               var next_end_i = 0
+               for line in model.lines do
+                       var addr = line.address
+                       while next_start_i < starts.length and
+                         starts[next_start_i] < addr do next_start_i += 1
+                       if next_start_i < starts.length and
+                         starts[next_start_i] == addr then
+                               # is a dest, and not already started
+                               current_block = new BasicBlock
+                               blocks.add(current_block)
+                       end
+
+                       if current_block == null then
+                               current_block = new BasicBlock
+                               blocks.add(current_block)
+                       end
+
+                       current_block.lines.add(line)
+
+                       while next_end_i < ends.length and
+                         ends[next_end_i] < addr do next_end_i += 1
+                       if next_end_i < ends.length and
+                         ends[next_end_i] == addr then
+                               # stops here, unless already at the end
+                               current_block = null
+                       end
+               end
+
+               # adds created blocks to instance attribute
+               for b in blocks do
+                       # save them in the class attribute
+                       addr_to_blocks[b.lines.first.address] = b
+               end
+
+               # start node
+               start = new BasicBlock.start
+               blocks.add(start)
+               if blocks.length > 0 and blocks.first != start then
+                       start.successors.add(blocks.first)
+                       blocks.first.predecessors.add(start)
+               end
+               addr_to_blocks[-2] = start
+
+               # end node
+               finish = new BasicBlock.finish
+               blocks.add(finish)
+               addr_to_blocks[-1] = finish
+
+               # set successors and predecessors
+               for b in blocks do if not b.lines.is_empty then
+                       var line = b.lines.last
+
+                       if line isa AInstructionLine then
+                               var instr = line.n_instruction
+                               if instr isa ABranchInstruction then
+                                       var op = instr.n_operand
+                                       if instr.is_indirect then
+                                               for dest in addresses_in_memory do
+                                                       var db = addr_to_blocks[dest]
+                                                       b.successors.add(db)
+                                                       db.predecessors.add(b)
+                                               end
+                                       else
+                                               var dest = op.n_value.to_i
+                                               var db = addr_to_blocks[dest]
+                                               b.successors.add(db)
+                                               db.predecessors.add(b)
+                                       end
+                               end
+
+                               if not instr isa ABrInstruction and
+                                 not instr isa AStopInstruction and
+                                 not instr isa ACallInstruction and
+                                 not instr isa ARetInstruction then
+                                       # next line is possible start
+                                       var dest = line.address+4
+                                       if addr_to_blocks.has_key(dest) then
+                                               var db = addr_to_blocks[dest]
+                                               b.successors.add(db)
+                                               db.predecessors.add(b)
+                                       else
+                                               manager.notes.add(new Error(line.location, "invalid line following instruction"))
+                                       end
+                               end
+
+                               if instr isa ACallInstruction then
+                                       has_function_calls = true
+                                       var next_addr = line.address+4
+                                       if not addr_to_blocks.has_key(next_addr) then
+                                               print "error, no instruction following call {b.name}"
+                                       else
+                                               b.after_call = addr_to_blocks[next_addr]
+                                       end
+                               end
+
+                               if b.successors.is_empty and
+                                 not instr isa ARetInstruction then
+                                       b.successors.add(finish)
+                                       finish.predecessors.add(b)
+                               end
+                       end
+               end
+
+               # Verify use of function calls
+               # To be by the book, each path from the start to the end should have
+               # the same number of calls and rets. There should never be more rets
+               # than calls.
+
+               # TODO check for instructions not in a path from start to end
+
+               # TODO check if branching on variable
+
+               # TODO check there is there is a consistant use of the stack between
+               # calls and rets.
+       end
+
+       # duplicate function calls
+       # at each call site, the tree representing the
+       fun inline_functions
+       do
+               inline_functions_recursive(start, new List[BasicBlock]) #0)
+
+               # retain only blocks reachble from start
+               var reachables = new HashSet[BasicBlock]
+               var todo = new Array[BasicBlock]
+               todo.add(start)
+               while not todo.is_empty do
+                       var n = todo.pop
+                       if not reachables.has(n) then
+                               reachables.add(n)
+                               for s in n.successors do if not reachables.has(s) then
+                                       todo.add(s)
+                               end
+                       end
+               end
+               self.blocks = reachables.to_a
+       end
+
+       private fun inline_functions_recursive(b: BasicBlock, seq: List[BasicBlock]) #depth: Int)
+       do
+               # Protection against cycles
+               #if depth > 1000 then return
+               var sl = seq.length
+               var loop_length = 3
+               if sl > loop_length then
+                       for i in [0..sl-loop_length[ do
+                               var same = true
+                               for j in [0..loop_length[ do if seq[i+j]!=seq[sl-3+j] then
+                                       same = false
+                                       break
+                               end
+
+                               if same then
+                                       print "recursive since {seq[i].name}"
+                                       return
+                               end
+                       end
+               end
+               #if seq.has(b) then return
+
+               if not b.lines.is_empty then
+                       var line = b.lines.last
+                       if line isa AInstructionLine then
+                               var instr = line.n_instruction
+                               if instr isa ACallInstruction then
+                                       # replace called by a dup
+                                       assert b.successors.length == 1
+                                       var called = b.successors.first
+                                       var rets = new HashSet[BasicBlock]
+                                       var n = called.duplicate_tree(
+                                               new HashMap[BasicBlock,BasicBlock], rets, 0, blocks)
+                                       b.successors[0] = n
+                                       n.predecessors.add(b)
+
+                                       if b.after_call == null then
+                                               print "Already inlined"
+                                               return
+                                       else
+                                               # TODO bring back assert
+                                               if n.predecessors.length > 1 then
+                                                       print "many pred"
+                                                       print "n {n.name}"
+                                                       print "preds {n.predecessors.join(" ")}"
+                                               end
+                                               assert n.predecessors.length == 1 else print n.predecessors.length
+                                               assert b.successors.length == 1
+                                               # TODO add information about duplicated block that are not dead
+
+                                               # link!
+                                               var next = b.after_call.as(not null)
+                                               # Another protection against cycles
+                                               for ret in rets do
+                                                       ret.successors.add(next)
+                                                       next.predecessors.add(ret)
+                                               end
+                                               #print "linking {b.name} to {next.name} ret len {rets.length}"
+
+                                               b.after_call = null
+                                       end
+                               end
+                       end
+               end
+
+               var si = 0
+               while si < b.successors.length do
+                       var s = b.successors[si]
+                       seq.add(s)
+                       inline_functions_recursive(s, seq)
+                       seq.pop
+                       si+=1
+               end
+       end
+
+       var watchdog writable = 0
+       fun link_ret_to_calls(b: BasicBlock, to_link_ori: List[BasicBlock], seq: List[BasicBlock], depth: Int): Bool
+       do
+               watchdog += 1
+               if watchdog == 100000 then
+                       print "Error: Umanagable cycle detected"
+                       return false
+               end
+
+               var sl = seq.length
+               var loop_length = 4
+               if sl > loop_length then
+                       for i in [0..sl-loop_length[ do
+                               var same = true
+                               for j in [0..loop_length[ do if seq[i+j]!=seq[sl-loop_length+j] then
+                                       same = false
+                                       break
+                               end
+
+                               if same then
+                                       #print "recursive since {seq[i].name}"
+                                       return true
+                               end
+                       end
+               end
+
+               # copy to_list
+               var to_link = new List[BasicBlock]
+               to_link.add_all(to_link_ori)
+
+               if not b.lines.is_empty then
+                       var line = b.lines.last
+                       if line isa AInstructionLine then
+                               var instr = line.n_instruction
+                               if instr isa ACallInstruction then
+                                       to_link.push(b)
+
+                               else if instr isa ARetInstruction then
+                                               if to_link.is_empty then
+                                                       manager.notes.add( new Error(instr.location,"no CALL can be linked to return") )
+                                                       return false
+                                               else
+                                                       var caller = to_link.pop
+                                                       # link!
+                                                       var next = caller.after_call.as(not null)
+
+                                                       # Another protection against cycles
+                                                       if b.successors.has(next) then return true
+
+                                                       b.successors.add(next)
+                                                       next.predecessors.add(b)
+                                               end
+                               end
+                       end
+               end
+
+               var si = 0
+               while si < b.successors.length do
+                       var s = b.successors[si]
+                       seq.add(s)
+                       if not link_ret_to_calls(s, to_link,seq,depth+1) then return false
+                       seq.pop
+                       si+=1
+               end
+
+               return true # OK
+       end
+end
+
+class BasicBlock
+       var name : String
+       var lines = new Array[ANonEmptyLine]
+       var successors = new Array[BasicBlock]
+       var predecessors = new Array[BasicBlock]
+       var after_call : nullable BasicBlock = null
+
+       init
+       do
+               var count = (once new Counter).next
+               name = "b{count}"
+       end
+       init named(name: String) do self.name = name
+       init start do name = "start"
+       init finish
+       do
+               name = "end"
+       end
+
+       fun duplicate_tree(dups: HashMap[BasicBlock,BasicBlock],
+                                          rets: Set[BasicBlock], calls: Int,
+                                          blocks: Array[BasicBlock]) : BasicBlock
+       do
+               if dups.has_key(self) then return dups[self]
+
+               var n = new BasicBlock.from(self)
+               dups[self] = n
+               blocks.add(n)
+               n.successors = new Array[BasicBlock]
+               n.predecessors = new Array[BasicBlock]
+
+               if after_call != null then
+                       var nac = after_call.duplicate_tree(dups, rets, calls, blocks)
+                       n.after_call = nac
+                       calls += 1 # for within that call
+               end
+
+               for s in successors do
+                       var ns = s.duplicate_tree(dups, rets, calls, blocks)
+                       n.successors.add(ns)
+                       ns.predecessors.add(n)
+               end
+
+               if calls == 0 and successors.is_empty then rets.add(n)
+
+               return n
+       end
+
+       init from(o: BasicBlock)
+       do
+               var count = (once new Counter).next
+               name = "c{count}_from_{o.name}"
+               lines = o.lines
+               successors = o.successors
+               predecessors = o.predecessors
+               after_call = o.after_call
+       end
+end
+
+private class Counter
+       var count: Int = -1
+       fun next : Int
+       do
+               count += 1
+               return count
+       end
+end
diff --git a/contrib/pep8analysis/src/cfg/dot_printer.nit b/contrib/pep8analysis/src/cfg/dot_printer.nit
new file mode 100644 (file)
index 0000000..b4fe76e
--- /dev/null
@@ -0,0 +1,51 @@
+import cfg_base
+
+redef class CFG
+       fun print_dot( f: OFStream, long: Bool )
+       do
+               f.write("digraph \{\n")
+               f.write("charset=latin1\n")
+               f.write("node [shape=box,style=rounded,fontname=courier]\n")
+               for block in blocks do block.print_dot_nodes(f, long)
+               for block in blocks do block.print_dot_edges(f, long)
+               f.write("\}")
+       end
+end
+
+redef class BasicBlock
+       fun print_dot_nodes( f: OFStream, long: Bool )
+       do
+               var lbl
+               if long then
+                       lbl = "\"{name}:\\n{dot_node_text}\""
+               else
+                       lbl = name
+               end
+               f.write( "{name} [label={lbl}]\n" )
+       end
+
+       fun dot_node_text : String
+       do
+               var code_lines = new Array[String]
+               for line in lines do code_lines.add(line.text)
+               var code = code_lines.join("")
+
+               code = code.replace("\n","\\l").replace("\"","\\\"").replace("\\n","|n").replace("/","\\/").replace("\r","")
+               # the last one is a hack
+               return "{dot_node_header}{code}{dot_node_footer}"
+       end
+
+       fun dot_node_header: String do return ""
+       fun dot_node_footer: String do return ""
+
+       fun print_dot_edges( f: OFStream, long: Bool )
+       do
+               for s in successors do
+                       f.write( "{name} -> {s.name}\n" )
+               end
+               var n = after_call
+               if n != null then
+                               f.write( "{name} -> {n.name} [style=\"dashed\"]\n" )
+               end
+       end
+end
diff --git a/contrib/pep8analysis/src/cfg/sanity.nit b/contrib/pep8analysis/src/cfg/sanity.nit
new file mode 100644 (file)
index 0000000..9188ba0
--- /dev/null
@@ -0,0 +1,88 @@
+module sanity
+
+import cfg_base
+
+redef class BasicBlock
+       private var cfg_sanity_verified = false
+
+       # reports data in code
+       private fun verify_cfg_sanity_code(v: Noter, data_in_code: Array[ALine])
+       do
+               for line in lines do if line isa ADirectiveLine then
+                       data_in_code.add(line)
+               end
+
+               cfg_sanity_verified = true
+       end
+
+       # reports code in data
+       private fun verify_cfg_sanity_data(v: Noter, dead_lines: Array[ALine])
+       do
+               for line in lines do if line isa AInstructionLine then
+                       dead_lines.add(line)
+               end
+
+               cfg_sanity_verified = true
+       end
+end
+
+redef class AnalysisManager
+       fun verify_cfg_sanity(cfg: CFG)
+       do
+               # verify executable code
+               var executed_data = new Array[ALine]
+               verify_cfg_sanity_recursively_code( cfg.start, executed_data )
+
+               # verify data or dead code
+               var dead_code = new Array[ALine]
+               for b in cfg.blocks do if not b.cfg_sanity_verified then
+                       b.verify_cfg_sanity_data(self, dead_code)
+               end
+
+               group( dead_code, "unreachable instructions", false )
+               group( executed_data, "data in program flow", true )
+       end
+
+       fun verify_cfg_sanity_recursively_code(b: BasicBlock, executed_data: Array[ALine])
+       do
+               if b.cfg_sanity_verified then return # is code
+
+               b.verify_cfg_sanity_code(self,executed_data)
+               for s in b.successors do verify_cfg_sanity_recursively_code( s, executed_data )
+       end
+
+       private fun group(lines: Array[ALine], msg: String, error: Bool)
+       do
+               lines = lines.iterator.sort.to_a
+               var len = lines.length
+               var first: nullable ALine = null
+               for i in [0..len[ do
+                       var line = lines[i]
+                       if first == null then
+                               first = line
+                       end
+                       if i == len-1 or line.address + line.size != lines[i+1].address then
+                               if error then
+                                       if first == line then
+                                               manager.notes.add(new Error(first.location, msg))
+                                       else
+                                               manager.notes.add(new Error.range(first.location, line.location, msg))
+                                       end
+                               else
+                                       if first == line then
+                                               manager.notes.add(new Error(first.location, msg))
+                                       else
+                                               manager.notes.add(new Warn.range(first.location, line.location, msg))
+                                       end
+                               end
+                               first = null
+                       end
+               end
+       end
+end
+
+redef class ALine
+       super Comparable
+       redef type OTHER: ALine
+       redef fun <=>(o) do return address <=> o.address
+end
diff --git a/contrib/pep8analysis/src/flow_analysis/flow_analysis.nit b/contrib/pep8analysis/src/flow_analysis/flow_analysis.nit
new file mode 100644 (file)
index 0000000..b884e1d
--- /dev/null
@@ -0,0 +1,5 @@
+import framework
+
+import range_analysis
+import reaching_defs
+import types
diff --git a/contrib/pep8analysis/src/flow_analysis/framework.nit b/contrib/pep8analysis/src/flow_analysis/framework.nit
new file mode 100644 (file)
index 0000000..a2e9e65
--- /dev/null
@@ -0,0 +1,151 @@
+import cfg
+
+class FlowAnalysis[S]
+       super Visitor
+
+       var current_in:  nullable S writable
+       var current_out: nullable S writable
+
+       fun in_set(bb: BasicBlock): nullable S is abstract
+       fun out_set(bb: BasicBlock): nullable S is abstract
+       fun in_set=(bb: BasicBlock, s: S) is abstract
+       fun out_set=(bb: BasicBlock, s: S) is abstract
+
+       init
+       do
+               current_in = default_in_set
+               current_out = default_in_set
+       end
+
+       redef fun visit( node ) do node.visit_all(self)
+
+       # If false, it is a backwards analysis
+       fun is_forward: Bool is abstract
+
+       # ex: do return in1.union( in2 )
+       # ex: do return in1.intersection( in2 )
+       fun merge( in1, in2: nullable S): nullable S is abstract
+
+       fun default_in_set: nullable S do return null
+       fun empty_set: S is abstract
+
+       fun analyze(cfg: CFG)
+       do
+               # set defaults
+               var current_in: nullable S
+               var current_out: nullable S
+
+               # set current input as default start case
+               var todo = new List[BasicBlock]
+               todo.add_all(cfg.blocks)
+
+               # iterate until fixed point reached
+               while not todo.is_empty do
+
+                       var block = todo.shift
+
+                       if block == cfg.start then
+                               continue
+                       else if block.predecessors.is_empty then
+                               # get default in (the most safe one)
+                               current_in = default_in_set
+                       else
+                               current_in = out_set(block.predecessors.first)
+                               for l in [1..block.predecessors.length[ do
+                                       var b = block.predecessors[l]
+                                       current_in = merge(current_in, out_set(b))
+                               end
+                       end
+
+                       if current_in != null then
+                               in_set(block) = current_in.as(not null)
+                       else
+                               continue
+                       end
+
+                       if block == cfg.finish then continue
+
+                       var old_out = out_set(block)
+                       for line in block.lines do
+                               self.current_in = current_in.as(not null)
+                               self.current_out = empty_set
+                               pre_line_visit(line)
+                               enter_visit(line)
+                               post_line_visit(line)
+                               current_out = self.current_out
+                               current_in = self.current_out.as(not null)
+                               #self.current_in = current_in
+                       end
+
+                       current_out = self.current_out
+                       if old_out != current_out then
+                               out_set(block) = current_out.as(not null)
+                               if is_forward then
+                                       for b in block.successors do todo.add(b)
+                               else
+                                       for b in block.predecessors do todo.add(b)
+                               end
+                       end
+               end
+       end
+
+       fun pre_line_visit(l: ALine) do end
+       fun post_line_visit(l: ALine) do end
+end
+
+class FineFlowAnalysis[V]
+       super FlowAnalysis[V]
+
+       redef fun in_set(bb)
+       do
+               if bb.lines.is_empty then return backup_in(bb)
+               return line_in( bb.lines.first )
+       end
+
+       redef fun in_set=(bb, v)
+       do
+               if bb.lines.is_empty then
+                       backup_in(bb) = v
+               else line_in( bb.lines.first ) = v
+       end
+
+       redef fun out_set(bb)
+       do
+               if bb.lines.is_empty then return backup_out(bb)
+               return line_out( bb.lines.last )
+       end
+
+       redef fun out_set=(bb, v)
+       do
+               if bb.lines.is_empty then
+                       backup_out(bb) = v
+               else line_out( bb.lines.last ) = v
+       end
+
+       fun backup_in(l: BasicBlock): nullable V is abstract
+       fun backup_out(l: BasicBlock): nullable V is abstract
+       fun backup_in=(l: BasicBlock, v: nullable V) is abstract
+       fun backup_out=(l: BasicBlock, v: nullable V) is abstract
+
+       fun line_in(l: ALine): nullable V is abstract
+       fun line_out(l: ALine): nullable V is abstract
+       fun line_in=(l: ALine, v: nullable V) is abstract
+       fun line_out=(l: ALine, v: nullable V) is abstract
+
+       redef fun pre_line_visit(line) do line_in(line) = current_in
+       redef fun post_line_visit(line) do line_out(line) = current_out
+end
+
+class StaticAnalysis[S]
+       super Visitor
+
+       var set: S
+       init (set: S) do self.set = set
+
+       redef fun visit( node ) do node.visit_all(self)
+       fun analyze(ast: AListing): S
+       do
+               enter_visit(ast)
+               return set
+       end
+end
diff --git a/contrib/pep8analysis/src/flow_analysis/range_analysis.nit b/contrib/pep8analysis/src/flow_analysis/range_analysis.nit
new file mode 100644 (file)
index 0000000..d330062
--- /dev/null
@@ -0,0 +1,352 @@
+module range_analysis
+
+import framework
+
+# for linex, and should be used in the future
+import reaching_defs
+
+redef class AnalysisManager
+       fun do_range_analysis(ast: AListing, cfg: CFG)
+       do
+               var range_init_analysis = new InitRangeAnalysis(ast)
+               range_init_analysis.analyze(ast)
+
+               cfg.start.backup_ranges_out = range_init_analysis.set
+
+               var range_analysis = new RangeAnalysis
+               range_analysis.analyze(cfg)
+       end
+end
+
+class RangeAnalysis
+       super FineFlowAnalysis[RangeMap]
+
+       var current_range: nullable ValRange = null
+       var current_var: nullable Var = null
+
+       redef fun empty_set do return new RangeMap
+       redef fun is_forward do return true
+
+       init do super
+
+       redef fun visit(node)
+       do
+               node.accept_range_analysis(self,
+                       current_in, current_out.as(not null))
+       end
+
+       # union
+       redef fun merge(a, b)
+       do
+               if a == null and b == null then return null
+               if a == null then return b.copy
+               if b == null then return a.copy
+
+               var n = new RangeMap
+               for k, v in a do
+                       if b.has_key(k) then
+                               # merge ranges
+                               var u = b[k]
+                               n[k] = new ValRange(v.min.min(u.min), v.max.max(u.max))
+                       end
+               end
+
+               return n
+       end
+
+       redef fun line_in(line) do return line.ranges_in
+       redef fun line_out(line) do return line.ranges_out
+       redef fun line_in=(line, s) do line.ranges_in = s
+       redef fun line_out=(line, s) do line.ranges_out = s
+
+       redef fun backup_in(bb) do return bb.backup_ranges_in
+       redef fun backup_out(bb) do return bb.backup_ranges_out
+       redef fun backup_in=(bb, s) do bb.backup_ranges_in = s
+       redef fun backup_out=(bb, s) do bb.backup_ranges_out = s
+end
+
+class InitRangeAnalysis
+       super StaticAnalysis[RangeMap]
+
+       var current_line: ALine
+
+       init(prog: AListing)
+       do
+               super( new RangeMap )
+               current_line = prog.n_lines.first
+       end
+       redef fun visit(node)
+       do
+               if node isa ALine then current_line = node
+               node.accept_init_range_analysis(self, set)
+       end
+end
+
+redef class ALine
+       var ranges_in: nullable RangeMap = null
+       var ranges_out: nullable RangeMap = null
+end
+
+redef class BasicBlock
+       var backup_ranges_in: nullable RangeMap = null
+       var backup_ranges_out: nullable RangeMap = null
+
+       redef fun dot_node_header
+       do
+               if backup_ranges_in != null then
+                       return "{super}-- ranges in = {backup_ranges_in.as(not null)}\\l"
+               else if not lines.is_empty and lines.first.ranges_in != null then
+                       return "{super}-- ranges in = {lines.first.ranges_in.as(not null)}\\l"
+               else return super
+       end
+       redef fun dot_node_footer
+       do
+               if backup_ranges_out != null then
+                       return "{super}-- ranges out = {backup_ranges_out.as(not null)}\\l"
+               else if not lines.is_empty and lines.last.ranges_out != null then
+                       return "{super}-- ranges out = {lines.last.ranges_out.as(not null)}\\l"
+               else return super
+       end
+end
+
+class ValRange
+       var min: Int
+       var max: Int
+       init(min, max: Int)
+       do
+               self.min = min
+               self.max = max
+       end
+       init from(o: ValRange)
+       do
+               self.min = o.min
+               self.max = o.max
+       end
+       init at(v: Int)
+       do
+               self.min = v
+               self.max = v
+       end
+
+       redef fun to_s do
+               if min == max then return min.to_s
+               return "[{min}..{max}]"
+       end
+
+       redef fun ==(o) do return o != null and o isa ValRange and
+               min == o.min and max == o.max
+
+       fun ponctual: Bool do return min == max
+end
+class RangeMap
+       super HashMap[Var, ValRange]
+       redef fun ==(o)
+       do
+               if o == null or not o isa RangeMap then return false
+               if o.length != length then return false
+
+               for k, v in self do if not o.has_key(k) or o[k] != v then return false
+
+               return true
+       end
+
+       fun copy: RangeMap
+       do
+               var c = new RangeMap
+               c.recover_with(self)
+               return c
+       end
+
+       redef fun to_s do return "\{{join(", ", ":")}\}"
+end
+
+redef class ANode
+       fun accept_range_analysis(v: RangeAnalysis,
+               ins: nullable RangeMap, outs: RangeMap) do visit_all(v)
+       fun accept_init_range_analysis(v: InitRangeAnalysis,
+               set: RangeMap) do visit_all(v)
+end
+
+redef class AInstruction
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               visit_all(v)
+               if ins != null then outs.recover_with(ins)
+       end
+end
+
+redef class ALoadInstruction
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+               var variable = def_var
+               #var add = new RangeMap[Var, ValRange](variable,
+
+               # kill every set for variable
+               # (is automatic by HashMap)
+
+               if variable != null then
+                       # gen (&kill)
+                       var cr = v.current_range
+                       if cr != null then
+                               outs[variable] = cr
+                       else
+                               outs.keys.remove(variable)
+                       end
+               end
+               v.current_range = null
+       end
+end
+
+redef class AStoreInstruction
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+               var src = src_var # reg
+               var def = def_var # mem
+
+               if def != null then
+                       if src != null and ins != null and ins.has_key(src) then # we know the source and dest
+                               var cr = ins[src]
+                               outs[def] = cr
+                       else
+                               outs.keys.remove(def)
+                       end
+               end
+       end
+end
+
+redef class AInputInstruction
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+
+               var def = def_var # mem
+
+               if def != null and outs.has_key(def) then
+                       outs.keys.remove(def)
+               end
+
+       end
+end
+
+redef class AArithmeticInstruction
+       fun do_arithmetic(rv, rm: ValRange): nullable ValRange do return null
+
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               v.current_range = null
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+
+               var reg = reg_var
+
+               var cr = v.current_range
+
+               if cr != null and ins.has_key(reg) then
+               # and ins.has_key(mem) then
+                       var r = do_arithmetic(ins[reg], cr)
+
+                       if r != null then
+                               # this prevents infinite loops
+                               # we assume that the max for a student program in 999
+                               if r.max > 999 then r.max = 999
+                               if r.min < -999 then r.min = -999
+
+                               outs[reg] = r
+                       else
+                               outs.keys.remove(reg)
+                       end
+               else
+                       outs.keys.remove(reg)
+               end
+       end
+end
+
+redef class AAddInstruction
+       redef fun do_arithmetic(rv, rm) do return new ValRange(rv.min+rm.min, rv.max+rm.max)
+end
+
+redef class ASubInstruction
+       redef fun do_arithmetic(rv, rm) do return new ValRange(rv.min-rm.max, rv.max-rm.min)
+end
+
+redef class ANegInstruction
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               v.current_range = null
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+
+               var reg = reg_var
+               if ins.has_key(reg) then
+                       var rm = ins[reg]
+                       outs[reg] = new ValRange(-rm.max, -rm.min)
+               end
+       end
+end
+
+redef class AAnyOperand
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               if addressing_mode == "i" then # immediate
+                       v.current_var = null
+                       v.current_range = new ValRange(n_value.to_i, n_value.to_i)
+                       return
+               else if addressing_mode == "d" then # direct
+                       var ci = v.current_in
+                       var address = n_value.to_i
+                       var variable = new MemVar(address)
+                       v.current_var = variable
+                       if ci != null and ci.has_key(variable) then
+                               var value = ci[variable]
+                               v.current_range = new ValRange(value.min, value.max)
+                               return
+                       end
+               end
+
+               v.current_range = null
+       end
+end
+
+redef class AMovInstruction
+       # Almost impossible to guess so, topped
+       redef fun accept_range_analysis(v, ins, outs)
+       do
+               v.current_range = null
+               visit_all(v)
+
+               if ins != null then outs.recover_with(ins)
+
+               var reg = new RegisterVar('A')
+               if outs.has_key(reg) then
+                       outs.keys.remove(reg)
+               end
+       end
+end
+
+redef class AWordDirective
+       redef fun accept_init_range_analysis(v, set)
+       do
+               var variable = new MemVar(v.current_line.address)
+               var value = new ValRange.at(n_value.to_i)
+               set[variable] = value
+       end
+end
+
+redef class AByteDirective
+       redef fun accept_init_range_analysis(v, set)
+       do
+               var variable = new MemVar(v.current_line.address)
+               var value = new ValRange.at(n_value.to_i)
+               set[variable] = value
+       end
+end
diff --git a/contrib/pep8analysis/src/flow_analysis/reaching_defs.nit b/contrib/pep8analysis/src/flow_analysis/reaching_defs.nit
new file mode 100644 (file)
index 0000000..187c4fd
--- /dev/null
@@ -0,0 +1,166 @@
+module reaching_defs
+
+import framework
+
+redef class AnalysisManager
+       fun do_reaching_defs_analysis(cfg: CFG)
+       do
+               cfg.start.backup_reaching_defs_out = new ReachingDefsMap
+               var reaching_defs_analysis = new ReachingDefsAnalysis
+               reaching_defs_analysis.analyze(cfg)
+       end
+end
+
+class ReachingDefsAnalysis
+       super FineFlowAnalysis[ReachingDefsMap]
+
+       init do end
+       redef fun is_forward do return true
+
+       redef fun visit( node )
+       do
+               node.accept_reaching_defs_analysis( self, current_in, current_out.as(not null) )
+       end
+       redef fun merge(a,b)
+       do
+               if a == null then return b
+               if b == null then return a
+               return a.union(b)
+       end
+
+       redef fun backup_in(bb) do return bb.backup_reaching_defs_in
+       redef fun backup_out(bb) do return bb.backup_reaching_defs_out
+       redef fun backup_in=(bb, v) do bb.backup_reaching_defs_in = v
+       redef fun backup_out=(bb, v) do bb.backup_reaching_defs_out = v
+
+       redef fun line_in(line) do return line.reaching_defs_in
+       redef fun line_out(line) do return line.reaching_defs_out
+       redef fun line_in=(line, v) do line.reaching_defs_in = v
+       redef fun line_out=(line, v) do line.reaching_defs_out = v
+
+       redef fun default_in_set do return new ReachingDefsMap
+       redef fun empty_set do return new ReachingDefsMap
+end
+
+redef class ANode
+       fun accept_reaching_defs_analysis(v: ReachingDefsAnalysis, ins: nullable ReachingDefsMap, outs: ReachingDefsMap) do visit_all(v)
+end
+
+redef class AInstruction
+       redef fun accept_reaching_defs_analysis(v, ins, outs)
+       do
+               if ins != null then outs.recover_with(ins)
+       end
+end
+
+redef class ALoadInstruction
+       redef fun accept_reaching_defs_analysis(v, ins, outs)
+       do
+               if ins != null then outs.recover_with(ins)
+
+               var variable = def_var
+               if variable != null then
+                       # kill & gen
+                       var set = new HashSet[ALine]
+                       set.add(parent.as(ALine))
+                       outs[variable] = set
+               else
+                       # TODO top
+               end
+       end
+end
+
+redef class AStoreInstruction
+       redef fun accept_reaching_defs_analysis(v, ins, outs)
+       do
+               if ins != null then outs.recover_with(ins)
+
+               var variable = def_var
+               if variable != null then
+                       # kill & gen
+                       var set = new HashSet[ALine]
+                       set.add(parent.as(ALine))
+                       outs[variable] = set
+               else
+                       # TODO top
+               end
+       end
+end
+
+class ReachingDefsMap
+       super HashMap[Var,Set[ALine]]
+
+       fun union(o: ReachingDefsMap): ReachingDefsMap
+       do
+               var n = new ReachingDefsMap
+               for k, v in self do
+                       n[k] = new HashSet[ALine]
+                       n[k].add_all(v)
+               end
+               for k, v in o do
+                       if not n.has_key(k) then n[k] = new HashSet[ALine]
+                       n[k].add_all(v)
+               end
+               return n
+       end
+
+       fun intersection(o: ReachingDefsMap): ReachingDefsMap
+       do
+               var n = new ReachingDefsMap
+               for k, v in self do if n.has_key(k) then n[k].add_all(v)
+               for k, v in o    do if n.has_key(k) then n[k].add_all(v)
+               return n
+       end
+
+       redef fun to_s do return join(";", ":")
+
+       redef fun ==(o)
+       do
+               if o != null and o isa ReachingDefsMap then
+                       if length != o.length then return false
+                       for k,v in self do
+                               if not o.has_key(k) then return false
+                               var ok = o[k]
+                               if v.length != ok.length then return false
+                               for l in v do if not ok.has(l) then return false
+                       end
+                       return true
+               else
+                       return false
+               end
+       end
+end
+
+redef class ALine
+       var reaching_defs_in: nullable ReachingDefsMap = null
+       var reaching_defs_out: nullable ReachingDefsMap = null
+end
+
+redef class BasicBlock
+       var backup_reaching_defs_in: nullable ReachingDefsMap = null
+       var backup_reaching_defs_out: nullable ReachingDefsMap = null
+
+       redef fun dot_node_header
+       do
+               if lines.is_empty then
+                       if backup_reaching_defs_in != null then
+                               return "{super}-- r defs in = \{{backup_reaching_defs_in.to_s}\}\\l"
+                       end
+               else if lines.first.reaching_defs_in != null then return  "{super}-- r defs in = \{{lines.first.reaching_defs_in.to_s}\}\\l"
+               return super
+       end
+       redef fun dot_node_footer
+       do
+               if lines.is_empty then
+                       if backup_reaching_defs_out != null then
+                               return "{super}-- r defs out = \{{backup_reaching_defs_out.to_s}\}\\l"
+                       end
+               else if lines.first.reaching_defs_out != null then return  "{super}-- r defs out = \{{lines.last.reaching_defs_out.to_s}\}\\l"
+               return super
+       end
+end
+
+# This is bad.
+redef class HashSet[E]
+       redef fun to_s do return join(",")
+end
diff --git a/contrib/pep8analysis/src/flow_analysis/types.nit b/contrib/pep8analysis/src/flow_analysis/types.nit
new file mode 100644 (file)
index 0000000..96fd1ca
--- /dev/null
@@ -0,0 +1,662 @@
+import pipeline
+import opts
+
+import framework
+import range_analysis
+
+redef class AnalysisManager
+       var opt_report_unknown_types = new OptionBool("Report unknown types", "--report-types-top")
+       fun report_unknown_types: Bool do return opt_report_unknown_types.value
+
+       redef init
+       do
+               super
+               opts.add_option(opt_report_unknown_types)
+       end
+
+       fun do_types_analysis(ast: AListing, cfg: CFG)
+       do
+               # find types at program init
+               var tia = new TypesInitAnalysis(ast)
+               tia.analyze(ast)
+
+               # evaluate types with program flow
+               cfg.start.backup_types_out = tia.set
+               var ta = new TypesAnalysis
+               ta.analyze(cfg)
+
+               # check for errors
+               var tc = new TypesChecker(ast)
+               tc.analyze(ast)
+       end
+end
+
+# Types 1st step, find state at program load
+# one pass over the AST
+class TypesInitAnalysis
+       super StaticAnalysis[TypesMap]
+
+       var current_line: ALine
+
+       init(prog: AListing)
+       do
+               super( new TypesMap )
+               current_line = prog.n_lines.first
+       end
+       redef fun visit(node)
+       do
+               if node isa ALine then current_line = node
+               node.accept_types_init_analysis(self, set)
+       end
+end
+
+# Types 2nd step, evaluate types evolution
+# one pass over the AST
+class TypesAnalysis
+       super FineFlowAnalysis[TypesMap]
+
+       redef fun empty_set do return new TypesMap
+       redef fun is_forward do return true
+
+       init do super
+
+       redef fun visit(node) do node.accept_types_analysis(self, current_in, current_out.as(not null))
+
+       redef fun merge(a, b)
+       do
+               if a == null then
+                       if b == null then return null
+                       return b.copy
+               end
+               if b == null then return a.copy
+               return a.intersection(b)
+       end
+
+       redef fun backup_in(bb) do return bb.backup_types_in
+       redef fun backup_out(bb) do return bb.backup_types_out
+       redef fun backup_in=(bb, v) do bb.backup_types_in = v
+       redef fun backup_out=(bb, v) do bb.backup_types_out = v
+
+       redef fun line_in(line) do return line.types_in
+       redef fun line_out(line) do return line.types_out
+       redef fun line_in=(line, v) do line.types_in = v
+       redef fun line_out=(line, v) do line.types_out = v
+end
+
+# Types 3rd step, verification
+# one pass over the AST
+class TypesChecker
+       super StaticAnalysis[TypesMap]
+
+       var current_line: ALine
+
+       init(prog: AListing)
+       do
+               super( new TypesMap )
+               current_line = prog.n_lines.first
+       end
+       redef fun visit(node)
+       do
+               if node isa ALine then current_line = node
+               node.accept_types_checker(self)
+       end
+end
+
+class TypesMap
+       type T: Char
+
+       # bits
+       #  'u' unset
+       #  's' set
+       var bs = new HashMap[Char,T]
+
+       # The type can be:
+       #  'u' for uninitialized
+       #  '0' zeroed
+       #  'b' byte
+       #  'w' word begin
+       #  'W' word end
+       #  'c' executable code
+       #  'l' ascii
+       #  'a' address begin
+       #  'A' address end
+
+       # registers
+       var rs = new HashMap[Char,Array[T]]
+
+       # stack
+       var stack = new Array[T]
+
+       # mem
+       var mem = new HashMap[Int, T]
+
+       init
+       do
+               rs['A'] = new Array[T].with_items('u', 'u')
+               rs['X'] = new Array[T].with_items('u', 'u')
+               bs['N'] = 'u'
+               bs['Z'] = 'u'
+               bs['V'] = 'u'
+               bs['C'] = 'u'
+       end
+
+       fun memory(a: Int): T
+       do
+               if mem.has_key(a) then return mem[a]
+               return 'u'
+       end
+       fun memory=(a: Int, v: T) do mem[a] = v
+
+       fun copy_to(o: TypesMap)
+       do
+               for k,v in rs do for b in [0..1] do o.rs[k][b] = rs[k][b]
+               for k,v in bs do o.bs[k] = v
+               for f in stack do o.stack.add(f)
+               for k, v in mem do o.mem[k] = v
+       end
+       fun copy: TypesMap
+       do
+               var tm = new TypesMap
+               copy_to(tm)
+               return tm
+       end
+
+       fun intersection(o: TypesMap): TypesMap
+       do
+               var tm = new TypesMap
+               for k,v in rs do for b in [0..1] do
+                       var v1 = o.rs[k][b]
+                       var v2 = rs[k][b]
+                       if v1 == v2 then
+                               tm.rs[k][b] = v1
+                       else tm.rs[k][b] = merge(v1, v2)
+               end
+
+               for k,v in bs do o.bs[k] = v
+               for f in stack do o.stack.add(f)
+
+               for k, v in mem do if o.mem.has_key(k) then
+                       if v == o.mem[k] then
+                               tm.mem[k] = v
+                       else tm.mem[k] = merge(v, o.mem[k])
+               else tm.mem[k] = 't'
+               for k, v in o.mem do if not tm.mem.has_key(k) then
+                       tm.mem[k] = 't'
+               end
+               return tm
+       end
+
+       fun merge(a, b: Char): Char
+       do
+               var c = [a,b]
+               if c.has('w') and c.has('0') then return 'w'
+               if c.has('W') and c.has('0') then return 'W'
+               return 't'
+       end
+
+       fun label_at(index: Int): nullable String
+       do
+               var ltl = manager.model.address_to_line
+               if ltl.has_key(index) then
+                       var line = ltl[index]
+                       return line.lbl
+               end
+               return null
+       end
+
+       redef fun to_s
+       do
+               var s = "regs:\{{rs.join(",",":")}\}, "
+               #s = "{s}bits:\{{bs.join(",",":")}\}, "
+               #s = "{s}stack:\{{stack.join(",")}\}, "
+
+               var blocks = new Array[String]
+               var block_begin: nullable Int = null
+               var block_end = 0
+               var block_type = ' '
+               for a in mem.keys.iterator.sort do
+                       var t = mem[a]
+                       if block_begin != null and (block_type != t or block_end != a-1) then
+                               var lbl = label_at(block_begin)
+                               if lbl != null then
+                                       lbl = "{lbl}@"
+                               else lbl = ""
+
+                               if block_begin == block_end then
+                                       blocks.add("{lbl}{block_begin}:{block_type}")
+                               else blocks.add("{lbl}[{block_begin}..{block_end}]:{block_type}")
+                               block_begin = null
+                       end
+
+                       if block_begin == null then block_begin = a
+
+                       block_type = t
+                       block_end = a
+               end
+               if block_begin != null then
+                       var lbl = label_at(block_begin)
+                       if lbl != null then
+                               lbl = "{lbl}@"
+                       else lbl = ""
+
+                       if block_begin == block_end then
+                               blocks.add("{lbl}{block_begin}:{block_type}")
+                       else blocks.add("{lbl}[{block_begin}..{block_end}]:{block_type}")
+               end
+               s = "{s}mem:\{{blocks.join(",")}\}"
+
+               return s
+       end
+
+       redef fun ==(o)
+       do
+               if o == null or not o isa TypesMap then return false
+               for r,v in rs do for i in [0..2[ do if o.rs[r][i] != v[i] then return false
+
+               if stack.length != o.stack.length then return false
+               for s in [0..stack.length[ do if o.stack[s] != stack[s] then return false
+
+               if mem.length != o.mem.length then return false
+               for k,v in mem do if not o.mem.has_key(k) or o.mem[k] != v then return false
+
+               return true
+       end
+end
+
+redef class ALine
+       var types_in: nullable TypesMap = null
+       var types_out: nullable TypesMap = null
+end
+
+redef class BasicBlock
+       var backup_types_in: nullable TypesMap = null
+       var backup_types_out: nullable TypesMap = null
+
+       redef fun dot_node_header
+       do
+               if lines.is_empty then
+                       if backup_types_in != null then
+                               return "{super}-- types = \{{backup_types_in.to_s}\}\\l"
+                       end
+               else if lines.first.types_in != null then return  "{super}-- types = \{{lines.first.types_in.to_s}\}\\l"
+               return super
+       end
+       redef fun dot_node_footer
+       do
+               if lines.is_empty then
+                       if backup_types_out != null then
+                               return "{super}-- types = \{{backup_types_out.to_s}\}\\l"
+                       end
+               else if lines.first.types_out != null then return  "{super}-- types = \{{lines.last.types_out.to_s}\}\\l"
+               return super
+       end
+end
+
+redef class ANode
+       fun accept_types_analysis(v: TypesAnalysis, ins: nullable TypesMap, outs: TypesMap) do visit_all(v)
+       fun accept_types_init_analysis(v: TypesInitAnalysis, set: TypesMap) do visit_all(v)
+       fun accept_types_checker(v: TypesChecker) do visit_all(v)
+end
+
+redef class AAnyOperand
+       redef fun to_var
+       do
+               var line = parent.parent.as(ALine)
+               var ranges = line.ranges_in
+               if ranges != null then
+                       if addressing_mode == "n" then
+                               var addr_pos = new MemVar(n_value.to_i)
+                               if ranges.has_key(addr_pos) and ranges[addr_pos].ponctual then
+                                       var addr_var = ranges[addr_pos].min
+                                       return new MemVar(addr_var)
+                               end
+                       else if addressing_mode == "x" then
+                               var addr_pos: Var = new RegisterVar('X')
+                               if ranges.has_key(addr_pos) and ranges[addr_pos].ponctual then
+                                       var reg_val = ranges[addr_pos].min
+                                       return new MemVar(n_value.to_i+reg_val)
+                               end
+                       end
+               end
+               return super
+       end
+end
+
+redef class AInstruction
+       # does not change the set
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               ins.copy_to(outs)
+       end
+
+       # set the memory for the line as being code
+       redef fun accept_types_init_analysis(v, set)
+       do
+               for i in [0..4[ do set.memory(v.current_line.address+i) = 'c'
+       end
+
+       fun verify_word(content: Array[Char], mem_str: String)
+       do
+               #if content.count('u') == 2 then
+                       # uninitialized data
+                       #manager.notes.add(new Error(location, "use of uninitialized values in {mem_str}, got {long_content_name(content)}"))
+               if content[0] == 'W' or content[1] == 'w' then
+                       manager.notes.add(new Warn(location, "use of deorganized word in {mem_str}, got {long_content_name(content)}"))
+               #else if (content[0] == 'w' and content[1] != 'W') or (content[1] == 'W' and content[0] != 'w') then
+               else if (content[0] == 'w') != (content[1] == 'W') then
+                       manager.notes.add(new Warn(location, "use of partial word in {mem_str}, got {long_content_name(content)}"))
+               #else if content.count('u') == 1 then # partially unitialized, a bad sign
+                       #manager.notes.add(new Warn(location, "use of partially uninitialized values in {mem_str}, got {long_content_name(content)}"))
+               else if content.count('t') == 2 then # uninitialized data
+                       if manager.report_unknown_types then
+                               manager.notes.add(new Warn(location, "use of values from unknown source in {mem_str}, got {long_content_name(content)}"))
+                       end
+               else if content[0] == '0' and content[1] == 'b' then # byte only OK!
+               else if content[0] == '0' and content[1] == 'l' then # ASCII only OK?
+               else if content[0] == '0' and content[1] == '0' then # all zero OK!
+               else if content[0] == 'a' and content[1] == 'A' then # address OK!
+               else if content[0] != 'w' and content[1] != 'W' then
+                       manager.notes.add(new Warn(location, "expected word in {mem_str}, got {long_content_name(content)}"))
+               end
+       end
+
+       #  'u' for uninitialized
+       #  '0' zeroed
+       #  'b' byte
+       #  'w' word begin
+       #  'W' word end
+       #  'c' executable code
+       #  'l' ascii
+       #  'a' address begin
+       #  'A' address end
+       fun long_data_name(d: Char): String
+       do
+               if d == 'u' then return "uninitialized"
+               if d == '0' then return "zero"
+               if d == 'b' then return "byte"
+               if d == 'w' then return "1st byte of word"
+               if d == 'W' then return "2nd byte of word"
+               if d == 'c' then return "code"
+               if d == 'l' then return "ASCII"
+               if d == 'a' then return "1st byte of address"
+               if d == 'A' then return "2nd byte of address"
+               if d == 't' then return "top"
+               print "Unknown data type '{d}'"
+               abort
+       end
+
+       fun long_content_name(c: Array[Char]): String
+       do
+               if (c[0]=='w' or c[0]=='0') and c[1]=='W' then return "word"
+               if c[0]=='a' and c[1]=='A' then return "address"
+               if c[0]==c[1] then return "2x {long_data_name(c[0])}"
+               return "{long_data_name(c[0])} then {long_data_name(c[1])}"
+       end
+end
+
+
+## Section: directives
+
+redef class AByteDirective
+       redef fun accept_types_init_analysis(v, set)
+       do
+               set.memory(v.current_line.address) = 'b'
+       end
+end
+
+redef class AWordDirective
+       redef fun accept_types_init_analysis(v, set)
+       do
+               set.memory(v.current_line.address) = 'w'
+               set.memory(v.current_line.address+1) = 'W'
+       end
+end
+
+redef class AAsciiDirective
+       redef fun accept_types_init_analysis(v, set)
+       do
+               # TODO AOperand::data
+               for i in [0..data.length[ do
+                       set.memory(v.current_line.address+i) = 'l'
+               end
+       end
+end
+
+redef class AAddrssDirective
+       redef fun accept_types_init_analysis(v, set)
+       do
+               set.memory(v.current_line.address  ) = 'a'
+               set.memory(v.current_line.address+1) = 'A'
+       end
+end
+
+## Section: other instructions
+
+redef class ALdInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+
+               var op = n_operand
+               if op isa AAnyOperand and op.addressing_mode == "i" then
+                       if op.n_value.to_i == 0 then
+                               outs.rs[register][0] = '0'
+                               outs.rs[register][1] = '0'
+                       else
+                               outs.rs[register][0] = 'w'
+                               outs.rs[register][1] = 'W'
+                       end
+                       return
+               end
+
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = [ins.memory(mem.index), ins.memory(mem.index+1)]
+                       outs.rs[register][0] = content[0]
+                       outs.rs[register][1] = content[1]
+                       #outs.rs[register][0] = 'w'
+                       #outs.rs[register][1] = 'W'
+               end
+       end
+end
+
+redef class ALdbyteInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               # outs.rs[register][1] = 'b'
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = ins.memory(mem.index)
+                       #verify_word(content, "m{mem.index}")
+                       outs.rs[register][1] = content
+               end
+       end
+end
+
+redef class AStInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               #outs.mem[n_operand.n_value.to_i  ] = 'w'
+               #outs.mem[n_operand.n_value.to_i+1] = 'W'
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = ins.rs[register]
+                       outs.mem[n_operand.n_value.to_i  ] = content[0]
+                       outs.mem[n_operand.n_value.to_i+1] = content[1]
+               end
+       end
+
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               var mem = mem_var
+               if mem isa MemVar and ins != null then
+                       var content = ins.rs[register]
+                       if ins.memory(n_operand.n_value.to_i) == 'c' or
+                               ins.memory(n_operand.n_value.to_i) == 'c' then
+                               manager.notes.add(new Warn(location, "overwriting code at {mem} with {long_content_name(content)}"))
+                       end
+               end
+       end
+end
+
+redef class AStbyteInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               #outs.mem[n_operand.n_value.to_i] = 'b'
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = ins.rs[register]
+                       outs.mem[n_operand.n_value.to_i] = content[1]
+               end
+       end
+
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               var mem = mem_var
+               if mem isa MemVar and ins != null then
+                       var content = ins.rs[register]
+                       if ins.memory(n_operand.n_value.to_i) == 'c' then
+                               manager.notes.add(new Warn(location, "overwriting code at {mem} with {long_data_name(content[1])}"))
+                       end
+               end
+       end
+end
+
+redef class AShiftInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+       end
+end
+
+redef class AArithmeticInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               outs.rs[register][0] = 'w'
+               outs.rs[register][1] = 'W'
+       end
+
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               if ins == null then return
+
+               # register
+               var content = ins.rs[register]
+               verify_word(content, "r{register}")
+
+               # memory source
+               var mem = mem_var
+               if mem isa MemVar then
+                       content = [ins.memory(mem.index), ins.memory(mem.index+1)]
+                       verify_word(content, "m{mem.index}")
+               end
+       end
+end
+
+redef class ADecoInstruction
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               if ins == null then return
+
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = [ins.memory(mem.index), ins.memory(mem.index+1)]
+                       verify_word(content, "m{mem.index}")
+               end
+       end
+end
+
+redef class ADeciInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               var mem = mem_var
+               if mem isa MemVar then
+                       outs.mem[mem.index  ] = 'w'
+                       outs.mem[mem.index+1] = 'W'
+               end
+       end
+end
+
+redef class AOutputInstruction
+       fun verify_ascii(content: Char)
+       do
+               if content == 'u' then
+                       manager.notes.add(new Warn(location, "use of uninitialized values"))
+               else if content != 'l' then
+                       if content != 't' or manager.opt_report_unknown_types.value then
+                               manager.notes.add(new Warn(location, "use of non-ascii types ({content})"))
+                       end
+               end
+       end
+end
+
+redef class ACharoInstruction
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               if ins == null then return
+
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = ins.memory(mem.index)
+                       verify_ascii(content)
+               end
+       end
+end
+
+redef class AStroInstruction
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               if ins == null then return
+
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = ins.memory(mem.index)
+                       verify_ascii(content)
+               end
+       end
+end
+
+redef class AChariInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+               outs.mem[n_operand.n_value.to_i] = 'l'
+       end
+end
+
+redef class ABranchInstruction
+       redef fun accept_types_checker(v)
+       do
+               var ins = v.current_line.types_in
+               if ins == null then return
+
+               var mem = mem_var
+               if mem isa MemVar then
+                       var content = [ins.memory(mem.index), ins.memory(mem.index+1)]
+                       if content[0] != 'a' or content[1] != 'A' then
+                               manager.notes.add(new Warn(location, "use of non-address data for branching, got {long_content_name(content)}"))
+                       end
+               end
+       end
+end
+
+redef class AMovInstruction
+       redef fun accept_types_analysis(v, ins, outs)
+       do
+               super
+
+               outs.rs['A'][0] = 'w'
+               outs.rs['A'][1] = 'W'
+       end
+end
diff --git a/contrib/pep8analysis/src/location.nit b/contrib/pep8analysis/src/location.nit
new file mode 100644 (file)
index 0000000..def0b2e
--- /dev/null
@@ -0,0 +1,207 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
+#
+# 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.
+
+# This module is used to model Nit source-file and locations in source-file
+module location
+
+# A raw text Nit source file
+class SourceFile
+       # The path of the source
+       var filename: String
+
+       # The content of the source
+       var string: String
+
+       # Create a new sourcefile using a filename and a stream
+       init(filename: String, stream: IStream)
+       do
+               self.filename = filename
+               string = stream.read_all
+               line_starts[0] = 0
+       end
+
+       # Create a new sourcefile using a dummy filename and a given content
+       init from_string(filename: String, string: String)
+       do
+               self.filename = filename
+               self.string = string
+               line_starts[0] = 0
+       end
+
+       # Position of each line start
+       var line_starts: Array[Int] = new Array[Int]
+end
+
+# A location inside a source file
+class Location
+       super Comparable
+       redef type OTHER: Location
+
+       var file: nullable SourceFile
+       var line_start: Int
+       var line_end: Int
+       var column_start: Int
+       var column_end: Int
+
+       init(f: nullable SourceFile, line_s: Int, line_e: Int, column_s: Int, column_e: Int) do
+               file = f
+               line_start = line_s
+               line_end = line_e
+               column_start = column_s
+               column_end = column_e
+       end
+
+       # The index in the start character in the source
+       fun pstart: Int do return file.line_starts[line_start-1] + column_start-1
+
+       # The index on the end character in the source
+       fun pend: Int do return file.line_starts[line_end-1] + column_end-1
+
+       # The verbatim associated text in the source-file
+       fun text: String
+       do
+               var res = self.text_cache
+               if res != null then return res
+               var l = self
+               var pstart = self.pstart
+               var pend = self.pend
+               res = l.file.string.substring(pstart, pend-pstart+1)
+               self.text_cache = res
+               return res
+       end
+
+       private var text_cache: nullable String
+
+       init with_file(f: SourceFile) do init(f,0,0,0,0)
+
+       redef fun ==(other: nullable Object): Bool do
+               if other == null then return false
+               if not other isa Location then return false
+
+               if other.file != file then return false
+               if other.line_start != line_start then return false
+               if other.line_end != line_end then return false
+               if other.column_start != column_start then return false
+               if other.column_end != column_end then return false
+
+               return true
+       end
+
+       fun located_in(loc: nullable Location): Bool do
+               if loc == null then return false
+
+               if line_start < loc.line_start then return false
+               if line_start > loc.line_end then return false
+
+               if line_end > loc.line_end then return false
+
+               if line_start == loc.line_start then
+                       if column_start < loc.column_start then return false
+                       if column_start > loc.column_end then return false
+               end
+
+               if line_end == loc.line_end and column_end > loc.column_end then return false
+
+               return true
+       end
+
+       redef fun to_s: String do
+               var file_part = ""
+               if file != null then
+                       file_part = file.filename
+                       if file.filename.length > 0 then file_part += ":"
+               end
+
+               if line_start == line_end then
+                       if column_start == column_end then
+                               return "{file_part}{line_start},{column_start}"
+                       else
+                               return "{file_part}{line_start},{column_start}--{column_end}"
+                       end
+               else
+                       return "{file_part}{line_start},{column_start}--{line_end},{column_end}"
+               end
+       end
+
+       fun relative_to(loc: nullable Location): String do
+               var relative: Location
+               if loc != null and loc.file == self.file then
+                       relative = new Location(null, self.line_start, self.line_end, self.column_start, self.column_end)
+               else
+                       relative = new Location(self.file, self.line_start, self.line_end, self.column_start, self.column_end)
+               end
+               return relative.to_s
+       end
+
+       redef fun <(other: OTHER): Bool do
+               if self == other then return false
+               if self.located_in(other) then return true
+               if other.located_in(self) then return false
+
+               if line_start != other.line_start then return line_start < other.line_start
+               if column_start != other.column_start then return column_start < other.column_start
+               if line_end != other.line_end then return line_end < other.line_end
+
+               return column_end < other.column_end
+       end
+
+       # Return the associated line with the location highlihted with color and a carret under the starting position
+       # `color` must be and terminal escape sequence used as `"{escape}[{color}m;"`
+       # * `"0;31"` for red
+       # * `"1;31"` for bright red
+       # * `"0;32"` for green
+       fun colored_line(color: String): String
+       do
+               var esc = 27.ascii
+               var def = "{esc}[0m"
+               var col = "{esc}[{color}m"
+
+               var l = self
+               var i = l.line_start
+               var line_start = l.file.line_starts[i-1]
+               var line_end = line_start
+               var string = l.file.string
+               while line_end+1 < string.length and string[line_end+1] != '\n' and string[line_end+1] != '\r' do
+                       line_end += 1
+               end
+               var lstart = string.substring(line_start, l.column_start - 1)
+               var cend
+               if i != l.line_end then
+                       cend = line_end - line_start + 1
+               else
+                       cend = l.column_end
+               end
+               var lmid
+               var lend
+               if line_start + cend <= string.length then
+                       lmid = string.substring(line_start + l.column_start - 1, cend - l.column_start + 1)
+                       lend = string.substring(line_start + cend, line_end - line_start - cend + 1)
+               else
+                       lmid = ""
+                       lend = ""
+               end
+               var indent = new FlatBuffer
+               for j in [line_start..line_start+l.column_start-1[ do
+                       if string[j] == '\t' then
+                               indent.add '\t'
+                       else
+                               indent.add ' '
+                       end
+               end
+               return "\t{lstart}{col}{lmid}{def}{lend}\n\t{indent}^"
+       end
+end
+
diff --git a/contrib/pep8analysis/src/model/directives.nit b/contrib/pep8analysis/src/model/directives.nit
new file mode 100644 (file)
index 0000000..73d3086
--- /dev/null
@@ -0,0 +1,27 @@
+import ast
+
+import operands
+
+redef class ADirective
+       fun size: Int is abstract
+end
+redef class AByteDirective
+       redef fun size do return 1
+end
+redef class AWordDirective
+       redef fun size do return 2
+end
+redef class ABlockDirective
+       redef fun size do return n_value.to_i
+end
+redef class AAsciiDirective
+       fun data: String do return n_value.as(AStringValue).n_string.content
+       redef fun size do return data.length
+end
+redef class AAddrssDirective
+       redef fun size do return 2
+end
+redef class AEquateDirective
+       redef fun size do return 0
+end
+
diff --git a/contrib/pep8analysis/src/model/model.nit b/contrib/pep8analysis/src/model/model.nit
new file mode 100644 (file)
index 0000000..beea28d
--- /dev/null
@@ -0,0 +1,116 @@
+import backbone
+import ast
+
+import directives
+import operands
+import vars
+
+redef class AnalysisManager
+       var model: nullable Model = null
+       fun build_model(ast: AListing): Model
+       do
+               var model = new Model(ast)
+               self.model = model
+               return model
+       end
+end
+
+class Model
+       # lines to appear on the resulting program
+       var lines = new Array[ANonEmptyLine]
+
+       # labet to declaation line
+       var labels_to_line = new HashMap[String,ALine]
+       var labels_to_address = new HashMap[String,Int]
+
+       # from adress to line
+       var address_to_line = new HashMap[Int,ANonEmptyLine]
+
+       init (ast: AListing)
+       do
+               var offset = 0
+               for line in ast.n_lines do
+                       # TODO if directive = equate
+                       var label_decl = line.n_label_decl
+                       if label_decl != null then
+                               var lbl = label_decl.n_id
+                               var label_name = lbl.text
+
+                               if line isa ADirectiveLine and line.n_directive isa AEquateDirective then
+                                       # .EQUATE
+                                       labels_to_address[label_name] = line.n_directive.as(AEquateDirective).n_value.to_i
+                                       lbl.labels_to_address[label_name] = line.n_directive.as(AEquateDirective).n_value.to_i
+                               else
+                                       labels_to_address[label_name] = offset
+                                       lbl.labels_to_address[label_name] = offset
+                               end
+                       end
+
+                       line.address = offset
+
+                       if line isa ANonEmptyLine and line.size > 0 then
+                               lines.add( line )
+                               address_to_line[offset] = line
+                       end
+                       offset += line.size
+               end
+
+               for lbl,address in labels_to_address do
+                       if address_to_line.has_key(address) then
+                               var line = address_to_line[address]
+                               labels_to_line[lbl] = line
+                       end
+               end
+       end
+end
+
+redef class ALine
+       var address: Int = -1
+
+       fun size: Int is abstract
+
+       redef fun to_s do return "L{address}"
+
+       redef fun text
+       do
+               var text = super
+               var size = size
+               if size > 0 then
+                       return "L{location.to_line_s} (m{address}..{address+size}): {text}"
+               else
+                       return "L{location.to_line_s}: {text}"
+               end
+       end
+
+       fun lbl: nullable String
+       do
+               var lbl_decl = n_label_decl
+               if lbl_decl != null then
+                       var lbl = lbl_decl.n_id.text
+                       return lbl
+               else return null
+       end
+end
+redef class AInstructionLine
+       redef fun size do return 4
+end
+redef class ADirectiveLine
+       redef fun size do return n_directive.size
+end
+redef class AEmptyLine
+       redef fun size do return 0
+end
+
+redef class MemVar
+       redef fun to_s do
+               var ltl = manager.model.address_to_line
+               if ltl.has_key(index) then
+                       var line = ltl[index]
+                       var lbl = line.lbl
+                       if lbl != null then
+                               return "{lbl}@m{index}"
+                       end
+               end
+               return "m{index}"
+       end
+end
diff --git a/contrib/pep8analysis/src/model/operands.nit b/contrib/pep8analysis/src/model/operands.nit
new file mode 100644 (file)
index 0000000..592e1af
--- /dev/null
@@ -0,0 +1,51 @@
+import ast
+
+redef class AValue
+       fun to_i: Int is abstract
+end
+
+redef class ALabelValue
+       redef fun to_i do
+               if not n_id.labels_to_address.has_key(n_id.text) then
+                       manager.fatal_error( self, "Label {n_id.text} used but not defined.")
+                       return 0
+               else
+                       return n_id.labels_to_address[n_id.text]
+               end
+       end
+end
+redef class TId
+       var labels_to_address: HashMap[String,Int] = (once new HashMap[String,Int])
+       #redef fun to_i: Int do return label_to_address[text]
+end
+
+redef class ANumberValue
+       redef fun to_i do return n_number.text.to_i
+end
+
+redef class ACharValue
+       redef fun to_i do return n_char.content.first.ascii
+end
+
+redef class AStringValue
+       # legal but no not recommended
+       redef fun to_i do return n_string.content.first.ascii
+end
+
+redef class AHexValue
+       #TODO
+       redef fun to_i do return n_hex.text.to_hex
+end
+
+redef class TString # TkBlock
+       fun content : String
+       do
+               return text.substring(1, text.length-2)
+       end
+end
+redef class TChar # TkAscii
+       fun content : String
+       do
+               return text.substring(1, text.length-2)
+       end
+end
diff --git a/contrib/pep8analysis/src/model/vars.nit b/contrib/pep8analysis/src/model/vars.nit
new file mode 100644 (file)
index 0000000..94aa4ca
--- /dev/null
@@ -0,0 +1,105 @@
+module vars
+
+import ast
+
+import operands
+
+class Var
+end
+
+class RegisterVar
+       super Var
+
+       init (register: Char) do self.register = register
+
+       var register: Char
+
+       redef fun to_s do return "r{register}"
+
+       redef fun ==(o) do return o isa RegisterVar and register == o.register
+       redef fun hash do return 128 + register.hash
+end
+
+class StackVar
+       super Var
+
+       init (offset: Int) do self.offset = offset
+
+       var offset: Int
+
+       redef fun ==(o) do return o isa StackVar and offset == o.offset
+       redef fun hash do return 512 + offset.hash
+end
+
+class MemVar
+       super Var
+
+       init (index: Int) do self.index = index
+
+       var index: Int
+
+       # need Object::AnalysisManager
+       #redef fun to_s is abstract
+
+       redef fun ==(o) do return o isa MemVar and index == o.index
+       redef fun hash do return 1024 + index.hash
+end
+
+redef class AInstruction
+       fun def_var: nullable Var is abstract
+       fun src_var: nullable Var is abstract
+end
+
+redef class ABinaryInstruction
+       fun mem_var: nullable Var do return n_operand.to_var
+end
+
+redef class ALoadInstruction
+       redef fun def_var do return new RegisterVar(register)
+       redef fun src_var do return n_operand.to_var
+end
+
+redef class AStoreInstruction
+       redef fun def_var do return n_operand.to_var
+       redef fun src_var do return new RegisterVar(register)
+end
+
+redef class AInputInstruction
+       redef fun def_var do return n_operand.to_var
+end
+
+redef class ARegisterSuffixed
+       fun reg_var: Var do return new RegisterVar(register)
+end
+
+redef class AArithmeticInstruction
+end
+
+redef class AOperand
+       fun to_var: nullable Var is abstract
+end
+
+redef class AImmediateOperand
+       redef fun to_var do return null
+end
+
+redef class AAnyOperand
+       fun addressing_mode: String do return n_id.text
+       redef fun to_var
+       do
+               if addressing_mode == "i" then
+               else if addressing_mode == "d" then
+                       return new MemVar(n_value.to_i)
+               else if addressing_mode == "n" then
+               else if addressing_mode == "s" then
+                       return new StackVar(n_value.to_i)
+               else if addressing_mode == "sf" then
+               else if addressing_mode == "x" then
+               else if addressing_mode == "sx" then
+               else if addressing_mode == "sxf" then
+               end
+
+               return null
+       end
+end
+
diff --git a/contrib/pep8analysis/src/parser/Makefile b/contrib/pep8analysis/src/parser/Makefile
new file mode 100644 (file)
index 0000000..2f4c133
--- /dev/null
@@ -0,0 +1,47 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2008-2009 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.
+
+SABLECC3ALTGEN ?= sablecc3
+
+all: parser.nit
+
+# Preprocess the extended sablecc gramar
+#.pep8.sablecc3: pep8.sablecc3xx
+       #./prescc.sh $< $@
+
+# Note that parser_nodes is no more automatically synced with the grammar
+parser.nit: xss/*.xss
+       @${SABLECC3ALTGEN -license} >/dev/null 2>/dev/null || ( echo "***\n*** sablecc3 altgen version is needed.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***" ; exit 1 )
+       @${SABLECC3ALTGEN} | grep altgen >/dev/null 2>/dev/null || ( echo "***\n*** $$SABLECC3ALTGEN is not the sablecc3 altgen version.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***"; exit 1 )
+       ${SABLECC3ALTGEN} -c pep8.sablecc3.dump -t xss/main.xss -p usermodule parser_nodes pep8.sablecc3
+       mv -f -- parser.nit .parser-nofact.nit
+       ./fact_parser.pl .parser-nofact.nit > parser.nit
+       perl -np -i.orig -e 's/([ \[])P([A-Z])/\1A\2/g;' -e 's/"{"/"\\{"/g;' parser.nit parser_abs.nit parser_prod.nit lexer.nit
+
+clean:
+       rm -f -- pep8.sablecc3 pep8.sablecc3.dump .parser-nofact.nit || true
+
+distclean: clean
+
+maintainer-clean: clean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f -- parser.nit parser_abs.nit parser_prod.nit lexer.nit || true
+
+merge:
+       meld parser_nodes.nit parser_abs.nit
+
+.PHONY: parser.nit
diff --git a/contrib/pep8analysis/src/parser/README b/contrib/pep8analysis/src/parser/README
new file mode 100644 (file)
index 0000000..227bcfc
--- /dev/null
@@ -0,0 +1,30 @@
+This directory contains the nit parser. It is generated from a grammar for sablecc3 ( http://www.sablecc.org ).
+In order to generate nit parser, you need the alternate SableCC3 generator ( http://www.mare.ee/indrek/sablecc/ ).
+
+Contents:
+
+       fact_parser.pl: Script used to factorize parser.nit
+       Makefile: Update grammar and generate .nit files
+       nit.sablecc3xx: Extended sablecc3 grammar (see prescc.sh)
+       prescc.sh: Program to transform an extended sablecc3 to a standard one
+       parser_nodes.nit: token and nodes classes hierarchy used by the parser and the lexer
+       tables.nit, tables_nit.h: Interfaces to access the tables needed by the parser and the lexer
+       test_parser.nit:
+       xss/*.xss: alternate SableCC3 template files for the Nit language
+
+
+The following are generated but present to avoid the need of sablecc3:
+
+       lexer.nit: generated lexer
+       parser.nit: generated parser
+       parser_prod.nit: All production with generated visit methods
+       tables_nit.c: The tables needed by the parser and the lexer
+       parser_abs.nit: Raw generated token and nodes classes used to maintain coherence of parser_nodes.nit
+
+
+Other temp files produced by the Makefile:
+
+       .nit.sablecc3: Sablecc3 grammar after processing
+       .nit.sablecc3.dump: Dump of the grammar to improve sablecc3 multiple runs
+       .parser-nofact.nit: The parser generated by SableCC3 before factorization by fact_parser.pl
+
diff --git a/contrib/pep8analysis/src/parser/fact_parser.pl b/contrib/pep8analysis/src/parser/fact_parser.pl
new file mode 100755 (executable)
index 0000000..df7c9cf
--- /dev/null
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+
+# 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.
+
+# fact_parser, a Sablecc postprocessor.
+#
+# Factorize comon actions in a generated sablecc parser file
+# Synopsys: fact_parser < infile > outfile
+
+use warnings;
+
+%actions = (); # body of an action -> id of the first action with this body
+%dupl = (); # id of a duplicate action -> id of the first action with this body
+
+@text = (); # Resulting file
+$start = 0; # current mode: 0=begin of file; 1=after an action; 2=inside an action
+$tot = 0; # original total number of actions
+$cpt = 0; # final total number of action
+while (<>) {
+       # Process the body of the action?
+       if ($start == 2) {
+               push @action, $_;
+               if (/ new (?!Array)/) { $has_new = 1; }
+       }
+
+       # Start a new action?
+       if (/private class ReduceAction(\d+)/) {
+               $tot++;
+               $start = 2;
+               $nb = $1; # Identifier of the action
+               $head = $_; # The declaration line
+               @action = (); # Body of the action
+               $has_new = 0; # Is a new something used?
+       }
+
+       # Process the begin of the file?
+       if ($start == 0) { push @text, $_; }
+
+       # End of an action?
+       if ($start == 2 and /^end/) {
+               # Build the action body by filtering useless new
+               $action = "";
+               foreach $l (@action) {
+                       if ($has_new or $l !~ / isa (?!Array)/) { $action .= $l; }
+               }
+
+               # Is it an original action?
+               if (not defined $actions{$action}) {
+                       # Yes, so register it
+                       $actions{$action} = $nb;
+                       push @text, $head, $action;
+                       $cpt++;
+               } else {
+                       # No, so link the duplicate to the original
+                       $mainnb = $actions{$action};
+                       $dupl{$nb} = $mainnb;
+               }
+               $start = 1;
+       }
+}
+
+# Substitute duplicate actions with the originals in the whole file
+foreach (@text) {
+       if (/ReduceAction(\d+)/ && defined $dupl{$1}) {
+               $d = $dupl{$1};
+               s/$1/$d/;
+       }
+}
+
+print STDERR "* fact_parser: $tot -> $cpt\n";
+
+print @text;
diff --git a/contrib/pep8analysis/src/parser/lexer.nit b/contrib/pep8analysis/src/parser/lexer.nit
new file mode 100644 (file)
index 0000000..5f02813
--- /dev/null
@@ -0,0 +1,487 @@
+# Lexer and its tokens.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module lexer
+
+intrude import parser_nodes
+private import tables
+
+redef class Token
+    var _text: nullable String
+
+    redef fun text
+    do
+        var res = _text
+        if res != null then return res
+        res = location.text
+       _text = res
+       return res
+    end
+
+    fun parser_index: Int is abstract
+end
+
+redef class TEol
+    redef fun parser_index: Int
+    do
+       return 0
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TNumber
+    redef fun parser_index: Int
+    do
+       return 1
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TFloat
+    redef fun parser_index: Int
+    do
+       return 2
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TChar
+    redef fun parser_index: Int
+    do
+       return 3
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TString
+    redef fun parser_index: Int
+    do
+       return 4
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class THex
+    redef fun parser_index: Int
+    do
+       return 5
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TColon
+    redef fun parser_index: Int
+    do
+       return 6
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TComma
+    redef fun parser_index: Int
+    do
+       return 7
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TComment
+    redef fun parser_index: Int
+    do
+       return 8
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkByte
+    redef fun parser_index: Int
+    do
+       return 9
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkWord
+    redef fun parser_index: Int
+    do
+       return 10
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkBlock
+    redef fun parser_index: Int
+    do
+       return 11
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkAscii
+    redef fun parser_index: Int
+    do
+       return 12
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkAddrss
+    redef fun parser_index: Int
+    do
+       return 13
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkEquate
+    redef fun parser_index: Int
+    do
+       return 14
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TTkBurn
+    redef fun parser_index: Int
+    do
+       return 15
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TEndBlock
+    redef fun parser_index: Int
+    do
+       return 16
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+redef class TId
+    redef fun parser_index: Int
+    do
+       return 17
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+
+redef class EOF
+    redef fun parser_index: Int
+    do
+       return 18
+    end
+
+    init(loc: Location)
+    do
+        _text = ""
+               _location = loc
+    end
+end
+
+redef class AError
+    readable var _message: String
+
+    init init_error(message: String, loc: Location)
+    do
+               init(loc)
+               _message = message
+    end
+end
+
+
+# The lexer extract NIT tokens from an input stream.
+# It is better user with the Parser
+class Lexer
+       super TablesCapable
+       # Last peeked token
+       var _token: nullable Token
+
+       # Lexer current state
+       var _state: Int = 0
+
+       # The source file
+       readable var _file: SourceFile
+
+       # Current character in the stream
+       var _stream_pos: Int = 0
+
+       # Current line number in the input stream
+       var _line: Int = 0
+
+       # Current column in the input stream
+       var _pos: Int = 0
+
+       # Was the last character a cariage-return?
+       var _cr: Bool = false
+
+       # Constante state values
+       private fun state_initial: Int do return 0 end
+
+       # Create a new lexer for a stream (and a name)
+       init(file: SourceFile)
+       do
+               _file = file
+       end
+
+       # Give the next token (but do not consume it)
+       fun peek: Token
+       do
+               while _token == null do
+                       _token = get_token
+               end
+               return _token.as(not null)
+       end
+
+       # Give and consume the next token
+       fun next: Token
+       do
+               var result = _token
+               while result == null do
+                       result = get_token
+               end
+               _token = null
+               return result
+       end
+
+       # Get a token, or null if it is discarded
+       private fun get_token: nullable Token
+       do
+               var dfa_state = 0
+
+               var sp = _stream_pos
+               var start_stream_pos = sp
+               var start_pos = _pos
+               var start_line = _line
+               var string = _file.string
+               var string_len = string.length
+
+               var accept_state = -1
+               var accept_token = -1
+               var accept_length = -1
+               var accept_pos = -1
+               var accept_line = -1
+
+               loop
+                       if sp >= string_len then
+                               dfa_state = -1
+                       else
+                               var c = string[sp].ascii
+                               sp += 1
+
+                               var cr = _cr
+                               var line = _line
+                               var pos = _pos
+                               if c == 10 then
+                                       if cr then
+                                               cr = false
+                                               _file.line_starts[line] = sp
+                                       else
+                                               line = line + 1
+                                               pos = 0
+                                               _file.line_starts[line] = sp
+                                       end
+                               else if c == 13 then
+                                       line = line + 1
+                                       pos = 0
+                                       cr = true
+                                       _file.line_starts[line] = sp
+                               else
+                                       pos = pos + 1
+                                       cr = false
+                               end
+
+                               loop
+                                       var old_state = dfa_state
+                                       if dfa_state < -1 then
+                                               old_state = -2 - dfa_state
+                                       end
+
+                                       dfa_state = -1
+
+                                       var low = 0
+                                       var high = lexer_goto(old_state, 0) - 1
+
+                                       if high >= 0 then
+                                               while low <= high do
+                                                       var middle = (low + high) / 2
+                                                       var offset = middle * 3 + 1 # +1 because length is at 0
+
+                                                       if c < lexer_goto(old_state, offset) then
+                                                               high = middle - 1
+                                                       else if c > lexer_goto(old_state, offset+1) then
+                                                               low = middle + 1
+                                                       else
+                                                               dfa_state = lexer_goto(old_state, offset+2)
+                                                               break
+                                                       end
+                                               end
+                                       end
+                                       if dfa_state > -2 then break
+                               end
+
+                               _cr = cr
+                               _line = line
+                               _pos = pos
+                       end
+
+                       if dfa_state >= 0 then
+                               var tok = lexer_accept(dfa_state)
+                               if tok != -1 then
+                                       accept_state = dfa_state
+                                       accept_token = tok
+                                       accept_length = sp - start_stream_pos
+                                       accept_pos = _pos
+                                       accept_line = _line
+                               end
+                       else
+                               if accept_state != -1 then
+                                       var location = new Location(_file, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
+                                       _pos = accept_pos
+                                       _line = accept_line
+                                       _stream_pos = start_stream_pos + accept_length
+                                       if accept_token == 0 then
+                                               return null
+                                       end
+                                       if accept_token == 1 then
+                                               return new TEol.init_tk(location)
+                                       end
+                                       if accept_token == 2 then
+                                               return new TNumber.init_tk(location)
+                                       end
+                                       if accept_token == 3 then
+                                               return new TFloat.init_tk(location)
+                                       end
+                                       if accept_token == 4 then
+                                               return new TChar.init_tk(location)
+                                       end
+                                       if accept_token == 5 then
+                                               return new TString.init_tk(location)
+                                       end
+                                       if accept_token == 6 then
+                                               return new THex.init_tk(location)
+                                       end
+                                       if accept_token == 7 then
+                                               return new TColon.init_tk(location)
+                                       end
+                                       if accept_token == 8 then
+                                               return new TComma.init_tk(location)
+                                       end
+                                       if accept_token == 9 then
+                                               return new TComment.init_tk(location)
+                                       end
+                                       if accept_token == 10 then
+                                               return new TTkByte.init_tk(location)
+                                       end
+                                       if accept_token == 11 then
+                                               return new TTkWord.init_tk(location)
+                                       end
+                                       if accept_token == 12 then
+                                               return new TTkBlock.init_tk(location)
+                                       end
+                                       if accept_token == 13 then
+                                               return new TTkAscii.init_tk(location)
+                                       end
+                                       if accept_token == 14 then
+                                               return new TTkAddrss.init_tk(location)
+                                       end
+                                       if accept_token == 15 then
+                                               return new TTkEquate.init_tk(location)
+                                       end
+                                       if accept_token == 16 then
+                                               return new TTkBurn.init_tk(location)
+                                       end
+                                       if accept_token == 17 then
+                                               return new TEndBlock.init_tk(location)
+                                       end
+                                       if accept_token == 18 then
+                                               return new TId.init_tk(location)
+                                       end
+                               else
+                                       _stream_pos = sp
+                                       var location = new Location(_file, start_line + 1, start_line + 1, start_pos + 1, start_pos + 1)
+                                       if sp > start_stream_pos then
+                                               var text = string.substring(start_stream_pos, sp-start_stream_pos)
+                                               var token = new AError.init_error("Syntax error: unknown token {text}.", location)
+                                               return token
+                                       else
+                                               var token = new EOF(location)
+                                               return token
+                                       end
+                               end
+                       end
+               end
+       end
+end
+
diff --git a/contrib/pep8analysis/src/parser/parser.nit b/contrib/pep8analysis/src/parser/parser.nit
new file mode 100644 (file)
index 0000000..3e57cee
--- /dev/null
@@ -0,0 +1,1002 @@
+# Parser.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser
+
+intrude import parser_prod
+import tables
+
+# State of the parser automata as stored in the parser stack.
+private class State
+       # The internal state number
+       readable writable var _state: Int
+
+       # The node stored with the state in the stack
+       readable writable var _nodes: nullable Object
+
+       init(state: Int, nodes: nullable Object)
+       do
+               _state = state
+               _nodes = nodes
+       end
+end
+
+class Parser
+       super TablesCapable
+       # Associated lexer
+       var _lexer: Lexer
+
+       # Stack of pushed states and productions
+       var _stack: Array[State]
+
+       # Position in the stack
+       var _stack_pos: Int
+
+       # Create a new parser based on a given lexer
+       init(lexer: Lexer)
+       do
+               _lexer = lexer
+               _stack = new Array[State]
+               _stack_pos = -1
+               build_reduce_table
+       end
+
+       # Do a transition in the automata
+       private fun go_to(index: Int): Int
+       do
+               var state = state
+               var low = 1
+               var high = parser_goto(index, 0) - 1
+
+               while low <= high do
+                       var middle = (low + high) / 2
+                       var subindex = middle * 2 + 1 # +1 because parser_goto(index, 0) is the length
+
+                       var goal = parser_goto(index, subindex)
+                       if state < goal then
+                               high = middle - 1
+                       else if state > goal then
+                               low = middle + 1
+                       else
+                               return parser_goto(index, subindex+1)
+                       end
+               end
+
+               return parser_goto(index, 2) # Default value
+       end
+
+       # Push someting in the state stack
+       private fun push(numstate: Int, list_node: nullable Object)
+       do
+               var pos = _stack_pos + 1
+               _stack_pos = pos
+               if pos < _stack.length then
+                       var state = _stack[pos]
+                       state.state = numstate
+                       state.nodes = list_node
+               else
+                       _stack.push(new State(numstate, list_node))
+               end
+       end
+
+       # The current state
+       private fun state: Int
+       do
+               return _stack[_stack_pos].state
+       end
+
+       # Pop something from the stack state
+       private fun pop: nullable Object
+       do
+               var res = _stack[_stack_pos].nodes
+               _stack_pos = _stack_pos -1
+               return res
+       end
+
+       # Build and return a full AST.
+       fun parse: Start
+       do
+               push(0, null)
+
+               var lexer = _lexer
+               loop
+                       var token = lexer.peek
+                       if token isa AError then
+                               return new Start(null, token)
+                       end
+
+                       var state = self.state
+                       var index = token.parser_index
+                       var action_type = parser_action(state, 2)
+                       var action_value = parser_action(state, 3)
+
+                       var low = 1
+                       var high = parser_action(state, 0) - 1
+
+                       while low <= high do
+                               var middle = (low + high) / 2
+                               var subindex = middle * 3 + 1 # +1 because parser_action(state, 0) is the length
+
+                               var goal = parser_action(state, subindex)
+                               if index < goal then
+                                       high = middle - 1
+                               else if index > goal then
+                                       low = middle + 1
+                               else
+                                       action_type = parser_action(state, subindex+1)
+                                       action_value = parser_action(state, subindex+2)
+                                       break
+                               end
+                       end
+
+                       if action_type == 0 then # SHIFT
+                               push(action_value, lexer.next)
+                       else if action_type == 1 then # REDUCE
+                               _reduce_table[action_value].action(self)
+                       else if action_type == 2 then # ACCEPT
+                               var node2 = lexer.next
+                               assert node2 isa EOF
+                               var node1 = pop
+                               assert node1 isa AListing
+                               var node = new Start(node1, node2)
+                               (new ComputeProdLocationVisitor).enter_visit(node)
+                               return node
+                       else if action_type == 3 then # ERROR
+                               var node2 = new AError.init_error("Syntax error: unexpected {token}.", token.location)
+                               var node = new Start(null, node2)
+                               return node
+                       end
+               end
+       end
+
+       var _reduce_table: Array[ReduceAction]
+       private fun build_reduce_table
+       do
+               _reduce_table = new Array[ReduceAction].with_items(
+                       new ReduceAction0(0),
+                       new ReduceAction1(0),
+                       new ReduceAction2(0),
+                       new ReduceAction3(0),
+                       new ReduceAction4(1),
+                       new ReduceAction5(1),
+                       new ReduceAction6(1),
+                       new ReduceAction7(1),
+                       new ReduceAction8(1),
+                       new ReduceAction9(1),
+                       new ReduceAction10(1),
+                       new ReduceAction11(1),
+                       new ReduceAction12(1),
+                       new ReduceAction13(1),
+                       new ReduceAction14(1),
+                       new ReduceAction15(1),
+                       new ReduceAction16(2),
+                       new ReduceAction17(3),
+                       new ReduceAction18(3),
+                       new ReduceAction19(4),
+                       new ReduceAction20(4),
+                       new ReduceAction21(5),
+                       new ReduceAction22(5),
+                       new ReduceAction23(5),
+                       new ReduceAction24(5),
+                       new ReduceAction25(5),
+                       new ReduceAction26(6),
+                       new ReduceAction27(6),
+                       new ReduceAction28(6),
+                       new ReduceAction29(6),
+                       new ReduceAction30(6),
+                       new ReduceAction31(6),
+                       new ReduceAction32(6),
+                       new ReduceAction33(7),
+                       new ReduceAction34(7)
+               )
+       end
+end
+
+redef class Prod
+       # Location on the first token after the start of a production
+       # So outside the production for epilon production
+       var _first_location: nullable Location
+
+       # Location of the last token before the end of a production
+       # So outside the production for epilon production
+       var _last_location: nullable Location
+end
+
+# Find location of production nodes
+# Uses existing token locations to infer location of productions.
+private class ComputeProdLocationVisitor
+       super Visitor
+       # Currenlty visited productions that need a first token
+       var _need_first_prods: Array[Prod] = new Array[Prod]
+
+       # Already visited epsilon productions that waits something after them
+       var _need_after_epsilons: Array[Prod] = new Array[Prod]
+
+       # Already visited epsilon production that waits something before them
+       var _need_before_epsilons: Array[Prod] = new Array[Prod]
+
+       # Location of the last visited token in the current production
+       var _last_location: nullable Location = null
+
+       redef fun visit(n: nullable ANode)
+       do
+               if n == null then
+                       return
+               else if n isa Token then
+                       var loc = n.location
+                       _last_location = loc
+
+                       # Add a first token to productions that need one
+                       if not _need_first_prods.is_empty then
+                               for no in _need_first_prods do
+                                       no._first_location = loc
+                               end
+                               _need_first_prods.clear
+                       end
+
+                       # Find location for already visited epsilon production that need one
+                       if not _need_after_epsilons.is_empty then
+                               for no in _need_after_epsilons do
+                                       # Epsilon production that is in the middle of a non-epsilon production
+                                       # The epsilon production has both a token before and after it
+                                       var endl = loc
+                                       var startl = no._last_location
+                                       no.location = new Location(endl.file, startl.line_end, endl.line_start, startl.column_end, endl.column_start)
+                               end
+                               _need_after_epsilons.clear
+                       end
+               else
+                       assert n isa Prod
+                       _need_first_prods.add(n)
+
+                       var old_last = _last_location
+                       _last_location = null
+                       n.visit_all(self)
+                       var endl = _last_location
+                       if endl == null then _last_location = old_last
+
+                       n._last_location = endl
+                       var startl = n._first_location
+                       if startl != null then
+                               # Non-epsilon production
+                               assert endl != null
+
+                               n.location = new Location(startl.file, startl.line_start, endl.line_end, startl.column_start, endl.column_end)
+
+                               if not _need_before_epsilons.is_empty then
+                                       var loc = new Location(startl.file, startl.line_start, startl.line_start, startl.column_start, startl.column_start)
+                                       for no in _need_before_epsilons do
+                                               # Epsilon production that starts the current non-epsilon production
+                                               no.location = loc
+                                       end
+                                       _need_before_epsilons.clear
+                               end
+
+                               if not _need_after_epsilons.is_empty then
+                                       var loc = new Location(endl.file, endl.line_end, endl.line_end, endl.column_end, endl.column_end)
+                                       for no in _need_after_epsilons do
+                                               # Epsilon production that finishes the current non-epsilon production
+                                               no.location = loc
+                                       end
+                                       _need_after_epsilons.clear
+                               end
+                       else
+                               # No first token means epsilon production (or "throw all my tokens" production)
+                               # So, it must be located it later
+                               if endl == null then
+                                       # Epsilon production that starts a parent non-epsilon production
+                                       _need_before_epsilons.add(n)
+                               else
+                                       # Epsilon production in the middle or that finishes a parent non-epsilon production
+                                       _need_after_epsilons.add(n)
+                               end
+                       end
+               end
+       end
+
+       init do end
+end
+
+# Each reduca action has its own class, this one is the root of the hierarchy.
+private abstract class ReduceAction
+       fun action(p: Parser) is abstract
+       fun concat(l1, l2 : Array[Object]): Array[Object]
+       do
+               if l1.is_empty then return l2
+               l1.append(l2)
+               return l1
+       end
+       var _goto: Int
+       init(g: Int) do _goto = g
+end
+
+private class ReduceAction0
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var listnode2 = new Array[Object]
+                                       var tendblocknode4 = nodearraylist1
+                                       assert tendblocknode4 isa nullable TEndBlock
+                                       var plistingnode1: nullable AListing = new AListing.init_alisting(
+                                               listnode2,
+                                               null,
+                                               tendblocknode4
+                                       )
+                                       node_list = plistingnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction1
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var listnode3 = new Array[Object]
+                                       var listnode2 = nodearraylist1
+                                       assert listnode2 isa Array[Object]
+                                       listnode3 = concat(listnode3, listnode2)
+                                       var tendblocknode5 = nodearraylist2
+                                       assert tendblocknode5 isa nullable TEndBlock
+                                       var plistingnode1: nullable AListing = new AListing.init_alisting(
+                                               listnode3,
+                                               null,
+                                               tendblocknode5
+                                       )
+                                       node_list = plistingnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction2
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var listnode2 = new Array[Object]
+                                       var plabeldeclnode3 = nodearraylist1
+                                       assert plabeldeclnode3 isa nullable ALabelDecl
+                                       var tendblocknode4 = nodearraylist2
+                                       assert tendblocknode4 isa nullable TEndBlock
+                                       var plistingnode1: nullable AListing = new AListing.init_alisting(
+                                               listnode2,
+                                               plabeldeclnode3,
+                                               tendblocknode4
+                                       )
+                                       node_list = plistingnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction3
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var listnode3 = new Array[Object]
+                                       var listnode2 = nodearraylist1
+                                       assert listnode2 isa Array[Object]
+                                       listnode3 = concat(listnode3, listnode2)
+                                       var plabeldeclnode4 = nodearraylist2
+                                       assert plabeldeclnode4 isa nullable ALabelDecl
+                                       var tendblocknode5 = nodearraylist3
+                                       assert tendblocknode5 isa nullable TEndBlock
+                                       var plistingnode1: nullable AListing = new AListing.init_alisting(
+                                               listnode3,
+                                               plabeldeclnode4,
+                                               tendblocknode5
+                                       )
+                                       node_list = plistingnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction4
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var teolnode4 = nodearraylist1
+                                       assert teolnode4 isa nullable TEol
+                                       var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
+                                               null,
+                                               null,
+                                               teolnode4
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction5
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var teolnode4 = nodearraylist2
+                                       assert teolnode4 isa nullable TEol
+                                       var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
+                                               plabeldeclnode2,
+                                               null,
+                                               teolnode4
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction6
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var tcommentnode3 = nodearraylist1
+                                       assert tcommentnode3 isa nullable TComment
+                                       var teolnode4 = nodearraylist2
+                                       assert teolnode4 isa nullable TEol
+                                       var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
+                                               null,
+                                               tcommentnode3,
+                                               teolnode4
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction7
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var tcommentnode3 = nodearraylist2
+                                       assert tcommentnode3 isa nullable TComment
+                                       var teolnode4 = nodearraylist3
+                                       assert teolnode4 isa nullable TEol
+                                       var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
+                                               plabeldeclnode2,
+                                               tcommentnode3,
+                                               teolnode4
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction8
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var pinstructionnode3 = nodearraylist1
+                                       assert pinstructionnode3 isa nullable AInstruction
+                                       var teolnode5 = nodearraylist2
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
+                                               null,
+                                               pinstructionnode3,
+                                               null,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction9
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var pinstructionnode3 = nodearraylist2
+                                       assert pinstructionnode3 isa nullable AInstruction
+                                       var teolnode5 = nodearraylist3
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
+                                               plabeldeclnode2,
+                                               pinstructionnode3,
+                                               null,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction10
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var pinstructionnode3 = nodearraylist1
+                                       assert pinstructionnode3 isa nullable AInstruction
+                                       var tcommentnode4 = nodearraylist2
+                                       assert tcommentnode4 isa nullable TComment
+                                       var teolnode5 = nodearraylist3
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
+                                               null,
+                                               pinstructionnode3,
+                                               tcommentnode4,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction11
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist4 = p.pop
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var pinstructionnode3 = nodearraylist2
+                                       assert pinstructionnode3 isa nullable AInstruction
+                                       var tcommentnode4 = nodearraylist3
+                                       assert tcommentnode4 isa nullable TComment
+                                       var teolnode5 = nodearraylist4
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
+                                               plabeldeclnode2,
+                                               pinstructionnode3,
+                                               tcommentnode4,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction12
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var pdirectivenode3 = nodearraylist1
+                                       assert pdirectivenode3 isa nullable ADirective
+                                       var teolnode5 = nodearraylist2
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
+                                               null,
+                                               pdirectivenode3,
+                                               null,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction13
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var pdirectivenode3 = nodearraylist2
+                                       assert pdirectivenode3 isa nullable ADirective
+                                       var teolnode5 = nodearraylist3
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
+                                               plabeldeclnode2,
+                                               pdirectivenode3,
+                                               null,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction14
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var pdirectivenode3 = nodearraylist1
+                                       assert pdirectivenode3 isa nullable ADirective
+                                       var tcommentnode4 = nodearraylist2
+                                       assert tcommentnode4 isa nullable TComment
+                                       var teolnode5 = nodearraylist3
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
+                                               null,
+                                               pdirectivenode3,
+                                               tcommentnode4,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction15
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist4 = p.pop
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var plabeldeclnode2 = nodearraylist1
+                                       assert plabeldeclnode2 isa nullable ALabelDecl
+                                       var pdirectivenode3 = nodearraylist2
+                                       assert pdirectivenode3 isa nullable ADirective
+                                       var tcommentnode4 = nodearraylist3
+                                       assert tcommentnode4 isa nullable TComment
+                                       var teolnode5 = nodearraylist4
+                                       assert teolnode5 isa nullable TEol
+                                       var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
+                                               plabeldeclnode2,
+                                               pdirectivenode3,
+                                               tcommentnode4,
+                                               teolnode5
+                                       )
+                                       node_list = plinenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction16
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var tidnode2 = nodearraylist1
+                                       assert tidnode2 isa nullable TId
+                                       var tcolonnode3 = nodearraylist2
+                                       assert tcolonnode3 isa nullable TColon
+                                       var plabeldeclnode1: nullable ALabelDecl = new ALabelDecl.init_alabeldecl(
+                                               tidnode2,
+                                               tcolonnode3
+                                       )
+                                       node_list = plabeldeclnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction17
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var tidnode2 = nodearraylist1
+                                       assert tidnode2 isa nullable TId
+                                       var pinstructionnode1: nullable AUnaryInstruction = new AUnaryInstruction.init_aunaryinstruction(
+                                               tidnode2
+                                       )
+                                       node_list = pinstructionnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction18
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var tidnode2 = nodearraylist1
+                                       assert tidnode2 isa nullable TId
+                                       var poperandnode3 = nodearraylist2
+                                       assert poperandnode3 isa nullable AOperand
+                                       var pinstructionnode1: nullable ABinaryInstruction = new ABinaryInstruction.init_abinaryinstruction(
+                                               tidnode2,
+                                               poperandnode3
+                                       )
+                                       node_list = pinstructionnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction19
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var pvaluenode2 = nodearraylist1
+                                       assert pvaluenode2 isa nullable AValue
+                                       var poperandnode1: nullable AImmediateOperand = new AImmediateOperand.init_aimmediateoperand(
+                                               pvaluenode2
+                                       )
+                                       node_list = poperandnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction20
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist3 = p.pop
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var pvaluenode2 = nodearraylist1
+                                       assert pvaluenode2 isa nullable AValue
+                                       var tcommanode3 = nodearraylist2
+                                       assert tcommanode3 isa nullable TComma
+                                       var tidnode4 = nodearraylist3
+                                       assert tidnode4 isa nullable TId
+                                       var poperandnode1: nullable AAnyOperand = new AAnyOperand.init_aanyoperand(
+                                               pvaluenode2,
+                                               tcommanode3,
+                                               tidnode4
+                                       )
+                                       node_list = poperandnode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction21
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var tidnode2 = nodearraylist1
+                                       assert tidnode2 isa nullable TId
+                                       var pvaluenode1: nullable ALabelValue = new ALabelValue.init_alabelvalue(
+                                               tidnode2
+                                       )
+                                       node_list = pvaluenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction22
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var tnumbernode2 = nodearraylist1
+                                       assert tnumbernode2 isa nullable TNumber
+                                       var pvaluenode1: nullable ANumberValue = new ANumberValue.init_anumbervalue(
+                                               tnumbernode2
+                                       )
+                                       node_list = pvaluenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction23
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var tcharnode2 = nodearraylist1
+                                       assert tcharnode2 isa nullable TChar
+                                       var pvaluenode1: nullable ACharValue = new ACharValue.init_acharvalue(
+                                               tcharnode2
+                                       )
+                                       node_list = pvaluenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction24
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var tstringnode2 = nodearraylist1
+                                       assert tstringnode2 isa nullable TString
+                                       var pvaluenode1: nullable AStringValue = new AStringValue.init_astringvalue(
+                                               tstringnode2
+                                       )
+                                       node_list = pvaluenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction25
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var thexnode2 = nodearraylist1
+                                       assert thexnode2 isa nullable THex
+                                       var pvaluenode1: nullable AHexValue = new AHexValue.init_ahexvalue(
+                                               thexnode2
+                                       )
+                                       node_list = pvaluenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction26
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkbytenode2 = nodearraylist1
+                                       assert ttkbytenode2 isa nullable TTkByte
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable AByteDirective = new AByteDirective.init_abytedirective(
+                                               ttkbytenode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction27
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkwordnode2 = nodearraylist1
+                                       assert ttkwordnode2 isa nullable TTkWord
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable AWordDirective = new AWordDirective.init_aworddirective(
+                                               ttkwordnode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction28
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkblocknode2 = nodearraylist1
+                                       assert ttkblocknode2 isa nullable TTkBlock
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable ABlockDirective = new ABlockDirective.init_ablockdirective(
+                                               ttkblocknode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction29
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkasciinode2 = nodearraylist1
+                                       assert ttkasciinode2 isa nullable TTkAscii
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable AAsciiDirective = new AAsciiDirective.init_aasciidirective(
+                                               ttkasciinode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction30
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkaddrssnode2 = nodearraylist1
+                                       assert ttkaddrssnode2 isa nullable TTkAddrss
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable AAddrssDirective = new AAddrssDirective.init_aaddrssdirective(
+                                               ttkaddrssnode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction31
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkequatenode2 = nodearraylist1
+                                       assert ttkequatenode2 isa nullable TTkEquate
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable AEquateDirective = new AEquateDirective.init_aequatedirective(
+                                               ttkequatenode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction32
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var ttkburnnode2 = nodearraylist1
+                                       assert ttkburnnode2 isa nullable TTkBurn
+                                       var pvaluenode3 = nodearraylist2
+                                       assert pvaluenode3 isa nullable AValue
+                                       var pdirectivenode1: nullable ABurnDirective = new ABurnDirective.init_aburndirective(
+                                               ttkburnnode2,
+                                               pvaluenode3
+                                       )
+                                       node_list = pdirectivenode1
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction33
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist1 = p.pop
+                                       var listnode2 = new Array[Object]
+                                       var plinenode1 = nodearraylist1
+                                       if plinenode1 != null then
+                                               listnode2.add(plinenode1)
+                                       end
+                                       node_list = listnode2
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+private class ReduceAction34
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+                                       var nodearraylist2 = p.pop
+                                       var nodearraylist1 = p.pop
+                                       var listnode3 = new Array[Object]
+                                       var listnode1 = nodearraylist1
+                                       assert listnode1 isa Array[Object]
+                                       var plinenode2 = nodearraylist2
+                                       listnode3 = concat(listnode3, listnode1)
+                                       if plinenode2 != null then
+                                               listnode3.add(plinenode2)
+                                       end
+                                       node_list = listnode3
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
diff --git a/contrib/pep8analysis/src/parser/parser_abs.nit b/contrib/pep8analysis/src/parser/parser_abs.nit
new file mode 100644 (file)
index 0000000..a0c8af4
--- /dev/null
@@ -0,0 +1,215 @@
+# Raw AST node hierarchy.
+# This file was generated by SableCC (http://www.sablecc.org/).
+package parser_abs
+
+import location
+
+# Root of the AST hierarchy
+abstract class ANode
+       var _location: nullable Location
+
+       # Location is set during AST building. Once built, location cannon be null
+       # However, manual instanciated nodes may need mode care
+       fun location: Location do return _location.as(not null)
+end
+
+# Ancestor of all tokens
+abstract class Token
+       super ANode
+end
+
+# Ancestor of all productions
+abstract class Prod
+       super ANode
+       fun location=(loc: Location) do _location = loc
+end
+class TEol
+       super Token
+end
+class TNumber
+       super Token
+end
+class TFloat
+       super Token
+end
+class TChar
+       super Token
+end
+class TString
+       super Token
+end
+class THex
+       super Token
+end
+class TColon
+       super Token
+end
+class TComma
+       super Token
+end
+class TComment
+       super Token
+end
+class TTkByte
+       super Token
+end
+class TTkWord
+       super Token
+end
+class TTkBlock
+       super Token
+end
+class TTkAscii
+       super Token
+end
+class TTkAddrss
+       super Token
+end
+class TTkEquate
+       super Token
+end
+class TTkBurn
+       super Token
+end
+class TEndBlock
+       super Token
+end
+class TId
+       super Token
+end
+class EOF
+       super Token
+private init noinit do end
+end
+class AError
+       super EOF
+private init noinit do end
+end
+
+class AListing super Prod end
+class ALine super Prod end
+class ALabelDecl super Prod end
+class AInstruction super Prod end
+class AOperand super Prod end
+class AValue super Prod end
+class ADirective super Prod end
+
+class AListing
+       super AListing
+    readable var _n_lines: List[ALine] = new List[ALine]
+    readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_end_block: TEndBlock
+end
+class AEmptyLine
+       super ALine
+    readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_comment: nullable TComment = null
+    readable var _n_eol: TEol
+end
+class AInstructionLine
+       super ALine
+    readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_instruction: AInstruction
+    readable var _n_comment: nullable TComment = null
+    readable var _n_eol: TEol
+end
+class ADirectiveLine
+       super ALine
+    readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_directive: ADirective
+    readable var _n_comment: nullable TComment = null
+    readable var _n_eol: TEol
+end
+class ALabelDecl
+       super ALabelDecl
+    readable var _n_id: TId
+    readable var _n_colon: TColon
+end
+class AUnaryInstruction
+       super AInstruction
+    readable var _n_id: TId
+end
+class ABinaryInstruction
+       super AInstruction
+    readable var _n_id: TId
+    readable var _n_operand: AOperand
+end
+class AImmediateOperand
+       super AOperand
+    readable var _n_value: AValue
+end
+class AAnyOperand
+       super AOperand
+    readable var _n_value: AValue
+    readable var _n_comma: TComma
+    readable var _n_id: TId
+end
+class ALabelValue
+       super AValue
+    readable var _n_id: TId
+end
+class ANumberValue
+       super AValue
+    readable var _n_number: TNumber
+end
+class ACharValue
+       super AValue
+    readable var _n_char: TChar
+end
+class AStringValue
+       super AValue
+    readable var _n_string: TString
+end
+class AHexValue
+       super AValue
+    readable var _n_hex: THex
+end
+class AByteDirective
+       super ADirective
+    readable var _n_tk_byte: TTkByte
+    readable var _n_value: AValue
+end
+class AWordDirective
+       super ADirective
+    readable var _n_tk_word: TTkWord
+    readable var _n_value: AValue
+end
+class ABlockDirective
+       super ADirective
+    readable var _n_tk_block: TTkBlock
+    readable var _n_value: AValue
+end
+class AAsciiDirective
+       super ADirective
+    readable var _n_tk_ascii: TTkAscii
+    readable var _n_value: AValue
+end
+class AAddrssDirective
+       super ADirective
+    readable var _n_tk_addrss: TTkAddrss
+    readable var _n_value: AValue
+end
+class AEquateDirective
+       super ADirective
+    readable var _n_tk_equate: TTkEquate
+    readable var _n_value: AValue
+end
+class ABurnDirective
+       super ADirective
+    readable var _n_tk_burn: TTkBurn
+    readable var _n_value: AValue
+end
+
+class Start
+       super Prod
+    readable var _n_base: nullable AListing
+    readable var _n_eof: EOF
+    init(
+        n_base: nullable AListing,
+        n_eof: EOF)
+    do
+        _n_base = n_base
+        _n_eof = n_eof
+    end
+
+end
diff --git a/contrib/pep8analysis/src/parser/parser_nodes.nit b/contrib/pep8analysis/src/parser/parser_nodes.nit
new file mode 100644 (file)
index 0000000..62efb2a
--- /dev/null
@@ -0,0 +1,216 @@
+# Raw AST node hierarchy.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser_nodes
+
+import location
+
+# Root of the AST hierarchy
+abstract class ANode
+       var _location: nullable Location
+
+       # Location is set during AST building. Once built, location cannon be null
+       # However, manual instanciated nodes may need mode care
+       fun location: Location do return _location.as(not null)
+end
+
+# Ancestor of all tokens
+abstract class Token
+       super ANode
+
+       fun text : String is abstract
+end
+
+# Ancestor of all productions
+abstract class Prod
+       super ANode
+       fun location=(loc: Location) do _location = loc
+end
+class TEol
+       super Token
+end
+class TNumber
+       super Token
+end
+class TFloat
+       super Token
+end
+class TChar
+       super Token
+end
+class TString
+       super Token
+end
+class THex
+       super Token
+end
+class TColon
+       super Token
+end
+class TComma
+       super Token
+end
+class TComment
+       super Token
+end
+class TTkByte
+       super Token
+end
+class TTkWord
+       super Token
+end
+class TTkBlock
+       super Token
+end
+class TTkAscii
+       super Token
+end
+class TTkAddrss
+       super Token
+end
+class TTkEquate
+       super Token
+end
+class TTkBurn
+       super Token
+end
+class TEndBlock
+       super Token
+end
+class TId
+       super Token
+end
+class EOF
+       super Token
+       #private init noinit do end
+end
+class AError
+       super EOF
+       #private init noinit do end
+end
+
+class ALine
+       super Prod
+       readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_comment: nullable TComment = null
+end
+class AInstruction
+       super Prod
+    readable writable var _n_id: TId
+end
+class AOperand
+       super Prod
+    readable var _n_value: AValue
+end
+class AValue super Prod end
+class ADirective super Prod end
+
+class AListing
+       super Prod
+    readable var _n_lines: List[ALine] = new List[ALine]
+    readable var _n_label_decl: nullable ALabelDecl = null
+    readable var _n_end_block: TEndBlock
+end
+class AEmptyLine
+       super ALine
+    readable var _n_eol: TEol
+end
+abstract class ANonEmptyLine
+       super ALine
+end
+class AInstructionLine
+       super ANonEmptyLine
+    readable var _n_instruction: AInstruction
+    readable var _n_eol: TEol
+end
+class ADirectiveLine
+       super ANonEmptyLine
+    readable var _n_directive: ADirective
+    readable var _n_eol: TEol
+end
+class ALabelDecl
+       super Prod
+    readable var _n_id: TId
+    readable var _n_colon: TColon
+end
+class AUnaryInstruction
+       super AInstruction
+end
+class ABinaryInstruction
+       super AInstruction
+    readable var _n_operand: AOperand
+end
+class AImmediateOperand
+       super AOperand
+end
+class AAnyOperand
+       super AOperand
+    readable var _n_comma: TComma
+    readable var _n_id: TId
+end
+class ALabelValue
+       super AValue
+    readable var _n_id: TId
+end
+class ANumberValue
+       super AValue
+    readable var _n_number: TNumber
+end
+class ACharValue
+       super AValue
+    readable var _n_char: TChar
+end
+class AStringValue
+       super AValue
+    readable var _n_string: TString
+end
+class AHexValue
+       super AValue
+    readable var _n_hex: THex
+end
+class AByteDirective
+       super ADirective
+    readable var _n_tk_byte: TTkByte
+    readable var _n_value: AValue
+end
+class AWordDirective
+       super ADirective
+    readable var _n_tk_word: TTkWord
+    readable var _n_value: AValue
+end
+class ABlockDirective
+       super ADirective
+    readable var _n_tk_block: TTkBlock
+    readable var _n_value: AValue
+end
+class AAsciiDirective
+       super ADirective
+    readable var _n_tk_ascii: TTkAscii
+    readable var _n_value: AValue
+end
+class AAddrssDirective
+       super ADirective
+    readable var _n_tk_addrss: TTkAddrss
+    readable var _n_value: AValue
+end
+class AEquateDirective
+       super ADirective
+    readable var _n_tk_equate: TTkEquate
+    readable var _n_value: AValue
+end
+class ABurnDirective
+       super ADirective
+    readable var _n_tk_burn: TTkBurn
+    readable var _n_value: AValue
+end
+
+class Start
+       super Prod
+    readable var _n_base: nullable AListing
+    readable var _n_eof: EOF
+       init(n_base: nullable AListing, n_eof: EOF)
+       do
+               super(null)
+               _n_base = n_base
+               _n_eof = n_eof
+       end
+end
diff --git a/contrib/pep8analysis/src/parser/parser_prod.nit b/contrib/pep8analysis/src/parser/parser_prod.nit
new file mode 100644 (file)
index 0000000..05bb5b2
--- /dev/null
@@ -0,0 +1,1073 @@
+# Production AST nodes full definition.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser_prod
+
+import lexer
+intrude import parser_nodes
+private import tables
+
+redef class ANode
+       # Parent of the node in the AST
+       readable writable var _parent: nullable ANode
+
+       # Remove a child from the AST
+       fun remove_child(child: ANode)
+       do
+               replace_child(child, null)
+       end
+
+       # Replace a child with an other node in the AST
+       fun replace_child(old_child: ANode, new_child: nullable ANode) is abstract
+
+       # Replace itself with an other node in the AST
+       fun replace_with(node: ANode)
+       do
+               if _parent != null then
+                       _parent.replace_child(self, node)
+               end
+       end
+
+       # Visit all nodes in order.
+       # Thus, call "v.visit(e)" for each node e
+       fun visit_all(v: Visitor) is abstract
+end
+
+redef class Token
+       redef fun visit_all(v: Visitor) do end
+       redef fun replace_child(old_child: ANode, new_child: nullable ANode) do end
+end
+
+redef class Prod
+       redef fun replace_with(n: ANode)
+        do
+                super
+                assert n isa Prod
+                n.location = location
+        end
+end
+
+# Abstract standard visitor
+abstract class Visitor
+       # What the visitor do when a node is visited
+        # Concrete visitors should redefine this method.
+        protected fun visit(e: nullable ANode) is abstract
+
+        # Ask the visitor to visit a given node.
+        # Usually automatically called by visit_all* methods.
+       # This methos should not be redefined
+        fun enter_visit(e: nullable ANode)
+       do
+               var old = _current_node
+               _current_node = e
+               visit(e)
+               _current_node = old
+       end
+
+       # The current visited node
+       readable var _current_node: nullable ANode = null
+end
+
+redef class AListing
+    private init empty_init do end
+
+    init init_alisting (
+            n_lines: Collection[Object], # Should be Collection[ALine]
+            n_label_decl: nullable ALabelDecl,
+            n_end_block: nullable TEndBlock
+    )
+    do
+        empty_init
+       for n in n_lines do
+               assert n isa ALine
+               _n_lines.add(n)
+               n.parent = self
+       end
+        _n_label_decl = n_label_decl
+       if n_label_decl != null then
+               n_label_decl.parent = self
+       end
+        _n_end_block = n_end_block.as(not null)
+       n_end_block.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        for i in [0.._n_lines.length[ do
+            if _n_lines[i] == old_child then
+                if new_child != null then
+                   assert new_child isa ALine
+                    _n_lines[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_lines.remove_at(i)
+                end
+                return
+            end
+        end
+        if _n_label_decl == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ALabelDecl
+                _n_label_decl = new_child
+           else
+               _n_label_decl = null
+            end
+            return
+       end
+        if _n_end_block == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TEndBlock
+                _n_end_block = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+            for n in _n_lines do
+                v.enter_visit(n)
+           end
+        if _n_label_decl != null then
+            v.enter_visit(_n_label_decl.as(not null))
+        end
+        v.enter_visit(_n_end_block)
+    end
+end
+redef class AEmptyLine
+    private init empty_init do end
+
+    init init_aemptyline (
+            n_label_decl: nullable ALabelDecl,
+            n_comment: nullable TComment,
+            n_eol: nullable TEol
+    )
+    do
+        empty_init
+        _n_label_decl = n_label_decl
+       if n_label_decl != null then
+               n_label_decl.parent = self
+       end
+        _n_comment = n_comment
+       if n_comment != null then
+               n_comment.parent = self
+       end
+        _n_eol = n_eol.as(not null)
+       n_eol.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_label_decl == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ALabelDecl
+                _n_label_decl = new_child
+           else
+               _n_label_decl = null
+            end
+            return
+       end
+        if _n_comment == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TComment
+                _n_comment = new_child
+           else
+               _n_comment = null
+            end
+            return
+       end
+        if _n_eol == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TEol
+                _n_eol = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        if _n_label_decl != null then
+            v.enter_visit(_n_label_decl.as(not null))
+        end
+        if _n_comment != null then
+            v.enter_visit(_n_comment.as(not null))
+        end
+        v.enter_visit(_n_eol)
+    end
+end
+redef class AInstructionLine
+    private init empty_init do end
+
+    init init_ainstructionline (
+            n_label_decl: nullable ALabelDecl,
+            n_instruction: nullable AInstruction,
+            n_comment: nullable TComment,
+            n_eol: nullable TEol
+    )
+    do
+        empty_init
+        _n_label_decl = n_label_decl
+       if n_label_decl != null then
+               n_label_decl.parent = self
+       end
+        _n_instruction = n_instruction.as(not null)
+       n_instruction.parent = self
+        _n_comment = n_comment
+       if n_comment != null then
+               n_comment.parent = self
+       end
+        _n_eol = n_eol.as(not null)
+       n_eol.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_label_decl == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ALabelDecl
+                _n_label_decl = new_child
+           else
+               _n_label_decl = null
+            end
+            return
+       end
+        if _n_instruction == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AInstruction
+                _n_instruction = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_comment == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TComment
+                _n_comment = new_child
+           else
+               _n_comment = null
+            end
+            return
+       end
+        if _n_eol == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TEol
+                _n_eol = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        if _n_label_decl != null then
+            v.enter_visit(_n_label_decl.as(not null))
+        end
+        v.enter_visit(_n_instruction)
+        if _n_comment != null then
+            v.enter_visit(_n_comment.as(not null))
+        end
+        v.enter_visit(_n_eol)
+    end
+end
+redef class ADirectiveLine
+    private init empty_init do end
+
+    init init_adirectiveline (
+            n_label_decl: nullable ALabelDecl,
+            n_directive: nullable ADirective,
+            n_comment: nullable TComment,
+            n_eol: nullable TEol
+    )
+    do
+        empty_init
+        _n_label_decl = n_label_decl
+       if n_label_decl != null then
+               n_label_decl.parent = self
+       end
+        _n_directive = n_directive.as(not null)
+       n_directive.parent = self
+        _n_comment = n_comment
+       if n_comment != null then
+               n_comment.parent = self
+       end
+        _n_eol = n_eol.as(not null)
+       n_eol.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_label_decl == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ALabelDecl
+                _n_label_decl = new_child
+           else
+               _n_label_decl = null
+            end
+            return
+       end
+        if _n_directive == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ADirective
+                _n_directive = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_comment == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TComment
+                _n_comment = new_child
+           else
+               _n_comment = null
+            end
+            return
+       end
+        if _n_eol == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TEol
+                _n_eol = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        if _n_label_decl != null then
+            v.enter_visit(_n_label_decl.as(not null))
+        end
+        v.enter_visit(_n_directive)
+        if _n_comment != null then
+            v.enter_visit(_n_comment.as(not null))
+        end
+        v.enter_visit(_n_eol)
+    end
+end
+redef class ALabelDecl
+    private init empty_init do end
+
+    init init_alabeldecl (
+            n_id: nullable TId,
+            n_colon: nullable TColon
+    )
+    do
+        empty_init
+        _n_id = n_id.as(not null)
+       n_id.parent = self
+        _n_colon = n_colon.as(not null)
+       n_colon.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_colon == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TColon
+                _n_colon = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_id)
+        v.enter_visit(_n_colon)
+    end
+end
+redef class AUnaryInstruction
+    private init empty_init do end
+
+    init init_aunaryinstruction (
+            n_id: nullable TId
+    )
+    do
+        empty_init
+        _n_id = n_id.as(not null)
+       n_id.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_id)
+    end
+end
+redef class ABinaryInstruction
+    private init empty_init do end
+
+    init init_abinaryinstruction (
+            n_id: nullable TId,
+            n_operand: nullable AOperand
+    )
+    do
+        empty_init
+        _n_id = n_id.as(not null)
+       n_id.parent = self
+        _n_operand = n_operand.as(not null)
+       n_operand.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_operand == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AOperand
+                _n_operand = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_id)
+        v.enter_visit(_n_operand)
+    end
+end
+redef class AImmediateOperand
+    private init empty_init do end
+
+    init init_aimmediateoperand (
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_value)
+    end
+end
+redef class AAnyOperand
+    private init empty_init do end
+
+    init init_aanyoperand (
+            n_value: nullable AValue,
+            n_comma: nullable TComma,
+            n_id: nullable TId
+    )
+    do
+        empty_init
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+        _n_comma = n_comma.as(not null)
+       n_comma.parent = self
+        _n_id = n_id.as(not null)
+       n_id.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_comma == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TComma
+                _n_comma = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_value)
+        v.enter_visit(_n_comma)
+        v.enter_visit(_n_id)
+    end
+end
+redef class ALabelValue
+    private init empty_init do end
+
+    init init_alabelvalue (
+            n_id: nullable TId
+    )
+    do
+        empty_init
+        _n_id = n_id.as(not null)
+       n_id.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_id == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_id)
+    end
+end
+redef class ANumberValue
+    private init empty_init do end
+
+    init init_anumbervalue (
+            n_number: nullable TNumber
+    )
+    do
+        empty_init
+        _n_number = n_number.as(not null)
+       n_number.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_number == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TNumber
+                _n_number = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_number)
+    end
+end
+redef class ACharValue
+    private init empty_init do end
+
+    init init_acharvalue (
+            n_char: nullable TChar
+    )
+    do
+        empty_init
+        _n_char = n_char.as(not null)
+       n_char.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_char == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TChar
+                _n_char = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_char)
+    end
+end
+redef class AStringValue
+    private init empty_init do end
+
+    init init_astringvalue (
+            n_string: nullable TString
+    )
+    do
+        empty_init
+        _n_string = n_string.as(not null)
+       n_string.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_string == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TString
+                _n_string = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_string)
+    end
+end
+redef class AHexValue
+    private init empty_init do end
+
+    init init_ahexvalue (
+            n_hex: nullable THex
+    )
+    do
+        empty_init
+        _n_hex = n_hex.as(not null)
+       n_hex.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_hex == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa THex
+                _n_hex = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_hex)
+    end
+end
+redef class AByteDirective
+    private init empty_init do end
+
+    init init_abytedirective (
+            n_tk_byte: nullable TTkByte,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_byte = n_tk_byte.as(not null)
+       n_tk_byte.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_byte == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkByte
+                _n_tk_byte = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_byte)
+        v.enter_visit(_n_value)
+    end
+end
+redef class AWordDirective
+    private init empty_init do end
+
+    init init_aworddirective (
+            n_tk_word: nullable TTkWord,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_word = n_tk_word.as(not null)
+       n_tk_word.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_word == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkWord
+                _n_tk_word = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_word)
+        v.enter_visit(_n_value)
+    end
+end
+redef class ABlockDirective
+    private init empty_init do end
+
+    init init_ablockdirective (
+            n_tk_block: nullable TTkBlock,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_block = n_tk_block.as(not null)
+       n_tk_block.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_block == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkBlock
+                _n_tk_block = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_block)
+        v.enter_visit(_n_value)
+    end
+end
+redef class AAsciiDirective
+    private init empty_init do end
+
+    init init_aasciidirective (
+            n_tk_ascii: nullable TTkAscii,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_ascii = n_tk_ascii.as(not null)
+       n_tk_ascii.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_ascii == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkAscii
+                _n_tk_ascii = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_ascii)
+        v.enter_visit(_n_value)
+    end
+end
+redef class AAddrssDirective
+    private init empty_init do end
+
+    init init_aaddrssdirective (
+            n_tk_addrss: nullable TTkAddrss,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_addrss = n_tk_addrss.as(not null)
+       n_tk_addrss.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_addrss == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkAddrss
+                _n_tk_addrss = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_addrss)
+        v.enter_visit(_n_value)
+    end
+end
+redef class AEquateDirective
+    private init empty_init do end
+
+    init init_aequatedirective (
+            n_tk_equate: nullable TTkEquate,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_equate = n_tk_equate.as(not null)
+       n_tk_equate.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_equate == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkEquate
+                _n_tk_equate = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_equate)
+        v.enter_visit(_n_value)
+    end
+end
+redef class ABurnDirective
+    private init empty_init do end
+
+    init init_aburndirective (
+            n_tk_burn: nullable TTkBurn,
+            n_value: nullable AValue
+    )
+    do
+        empty_init
+        _n_tk_burn = n_tk_burn.as(not null)
+       n_tk_burn.parent = self
+        _n_value = n_value.as(not null)
+       n_value.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_tk_burn == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TTkBurn
+                _n_tk_burn = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_value == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AValue
+                _n_value = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_tk_burn)
+        v.enter_visit(_n_value)
+    end
+end
+
+redef class Start
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_base == old_child then
+            if new_child == null then
+            else
+                new_child.parent = self
+               assert new_child isa AListing
+                _n_base = new_child
+            end
+            old_child.parent = null
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        if _n_base != null then
+            v.enter_visit(_n_base.as(not null))
+        end
+       v.enter_visit(_n_eof)
+    end
+end
diff --git a/contrib/pep8analysis/src/parser/pep8.sablecc b/contrib/pep8analysis/src/parser/pep8.sablecc
new file mode 100644 (file)
index 0000000..d74cbb1
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * This file is part of the pep8analyser project.
+ *
+ * Copyright 2013 Alexis Laferriere <alexis.laf@xymus.net>
+ *
+ * Inspired from the Nit language grammar by:
+ * Copyright 2008-2009 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.
+ */
+
+/* This grammar defines the Pep/8 language. */
+Grammar pep8;
+
+/*****************************************************************************/
+Lexer
+/*****************************************************************************/
+
+all = ' ' .. '~';
+lowercase = 'a' .. 'z';
+uppercase = 'A' .. 'Z';
+digit = '0' .. '9';
+letter = lowercase | uppercase | digit | '_';
+
+tab = '\t';
+cr = '\n';
+lf = '\r';
+any = all - (cr | lf);
+
+str_char
+       = (any - '"') + '\\'
+       | '\\' any;
+
+eol_helper = cr lf | cr | lf; // This takes care of different platforms;
+
+hex_digit = '0' .. '9' | 'A' .. 'F' | 'a' .. 'f';
+
+blank = (' ' | tab)+;
+
+eol = eol_helper;
+
+number = '-'? digit+;
+hex = '0' ('x'|'X') hex_digit+;
+float = digit* '.' digit+;
+char = ('\'' ((any - '\'') - '\\') '\'')
+       | ('\'' '\\' any '\'')
+       | ('\'' '\\' 'x' hex_digit hex_digit '\'');
+string = '"' str_char* '"';
+
+colon = ':';
+comma = ',';
+comment = ';' any*;
+
+tk_byte = '.' ('B'|'b') ('Y'|'y') ('T'|'t') ('E'|'e');
+tk_word = '.' ('W'|'w') ('O'|'o') ('R'|'r') ('D'|'d');
+tk_block = '.' ('B'|'b') ('L'|'l') ('O'|'o') ('C'|'c') ('K'|'k');
+tk_ascii = '.' ('A'|'a') ('S'|'s') ('C'|'c') ('I'|'i') ('I'|'i');
+tk_addrss = '.' ('A'|'a') ('D'|'d') ('D'|'d') ('R'|'r') ('S'|'s') ('S'|'s');
+tk_equate = '.' ('E'|'e') ('Q'|'q') ('U'|'u') ('A'|'a') ('T'|'t') ('E'|'e');
+tk_burn = '.' ('B'|'b') ('U'|'u') ('R'|'r') ('N'|'n');
+
+end_block = '.' ('E'|'e') ('N'|'n') ('D'|'d') (any | eol_helper)*;
+
+id = (lowercase|uppercase|'_') letter*;
+
+/*****************************************************************************/
+Parser
+/*****************************************************************************/
+Ignored blank;
+listing = [lines]:line* label_decl? end_block;
+
+line
+       = {empty} label_decl? comment? eol
+       | {instruction} label_decl? instruction comment? eol
+       | {directive} label_decl? directive comment? eol;
+
+label_decl = id colon;
+
+instruction
+       = {unary} id
+       | {binary} id operand;
+
+/* operands
+ * We will manage which operands are possible with each stmt at a higher level.
+ * This will allow better error messages and a cleaner model. */
+operand
+       = {immediate} value
+       | {any} value comma id;
+
+value
+       = {label} id
+       | {char} char
+       | {string} string;
+       /*| {hex} hex;*/
+directive
+       = {byte} tk_byte value
+       | {word} tk_word value
+       | {block} tk_block value
+       | {ascii} tk_ascii value
+       | {addrss} tk_addrss value
+       | {equate} tk_equate value
+       | {burn} tk_burn value;
+
diff --git a/contrib/pep8analysis/src/parser/pep8.sablecc3 b/contrib/pep8analysis/src/parser/pep8.sablecc3
new file mode 100644 (file)
index 0000000..9262b43
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * This file is part of the pep8analyser project.
+ *
+ * Copyright 2013 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * Inspired from the Nit language grammar by:
+ * Copyright 2008-2009 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.
+ */
+
+/* This grammar defines the Pep/8 language. */
+
+/*****************************************************************************/
+Helpers
+/*****************************************************************************/
+
+all = [0 .. 0xFF];
+lowercase = ['a' .. 'z'];
+uppercase = ['A' .. 'Z'];
+digit = ['0' .. '9'];
+letter = lowercase | uppercase | digit | '_';
+
+tab = 9;
+cr = 13;
+lf = 10;
+any = [all - [cr + lf]];
+
+str_char
+       = [[any - '"'] + '\']
+       | '\' any;
+
+eol_helper = cr lf | cr | lf; // This takes care of different platforms;
+
+hex_digit = ['0' .. '9'] | ['A' .. 'F'] | ['a' .. 'f'];
+
+/*****************************************************************************/
+States
+/*****************************************************************************/
+initial;
+
+/*****************************************************************************/
+Tokens
+/*****************************************************************************/
+
+blank = (' ' | tab)+;
+
+eol = eol_helper;
+
+number = '-'? digit+;
+float = digit* '.' digit+;
+char = (''' [[any - '''] - '\'] ''')
+       | (''' '\' any ''')
+       | (''' '\' 'x' hex_digit hex_digit ''');
+string = '"' str_char* '"';
+hex = '0' ('x'|'X') hex_digit+;
+
+colon = ':';
+comma = ',';
+comment = ';' any*;
+
+tk_byte = '.' ('B'|'b') ('Y'|'y') ('T'|'t') ('E'|'e');
+tk_word = '.' ('W'|'w') ('O'|'o') ('R'|'r') ('D'|'d');
+tk_block = '.' ('B'|'b') ('L'|'l') ('O'|'o') ('C'|'c') ('K'|'k');
+tk_ascii = '.' ('A'|'a') ('S'|'s') ('C'|'c') ('I'|'i') ('I'|'i');
+tk_addrss = '.' ('A'|'a') ('D'|'d') ('D'|'d') ('R'|'r') ('S'|'s') ('S'|'s');
+tk_equate = '.' ('E'|'e') ('Q'|'q') ('U'|'u') ('A'|'a') ('T'|'t') ('E'|'e');
+tk_burn = '.' ('B'|'b') ('U'|'u') ('R'|'r') ('N'|'n');
+
+end_block = '.' ('E'|'e') ('N'|'n') ('D'|'d') (any | eol_helper)*;
+
+id = letter+;
+
+/*****************************************************************************/
+Ignored Tokens
+/*****************************************************************************/
+
+blank;
+
+/*****************************************************************************/
+Productions
+/*****************************************************************************/
+listing = [lines]:line* label_decl? end_block;
+
+line
+       = {empty} label_decl? comment? eol
+       | {instruction} label_decl? instruction comment? eol
+       | {directive} label_decl? directive comment? eol;
+
+label_decl = id colon;
+
+instruction
+       = {unary} id
+       | {binary} id operand;
+
+/* operands
+ * We will manage which operands are possible with each stmt at a higher level.
+ * This will allow better error messages and a cleaner model. */
+operand
+       = {immediate} value
+       | {any} value comma id;
+
+value
+       = {label} id
+       | {number} number
+       | {char} char
+       | {string} string
+       | {hex} hex;
+directive
+       = {byte} tk_byte value
+       | {word} tk_word value
+       | {block} tk_block value
+       | {ascii} tk_ascii value
+       | {addrss} tk_addrss value
+       | {equate} tk_equate value
+       | {burn} tk_burn value;
+
diff --git a/contrib/pep8analysis/src/parser/pep8_lexer.nit b/contrib/pep8analysis/src/parser/pep8_lexer.nit
new file mode 100644 (file)
index 0000000..5e0fa09
--- /dev/null
@@ -0,0 +1,3654 @@
+# Lexer generated by nitccimport nitcc_runtime
+import pep8_parser
+class MyLexer
+       super Lexer
+       redef fun start_state do return dfastate_0
+end
+redef class Object
+       private fun dfastate_0: DFAState0 do return once new DFAState0
+       private fun dfastate_1: DFAState1 do return once new DFAState1
+       private fun dfastate_2: DFAState2 do return once new DFAState2
+       private fun dfastate_3: DFAState3 do return once new DFAState3
+       private fun dfastate_4: DFAState4 do return once new DFAState4
+       private fun dfastate_5: DFAState5 do return once new DFAState5
+       private fun dfastate_6: DFAState6 do return once new DFAState6
+       private fun dfastate_7: DFAState7 do return once new DFAState7
+       private fun dfastate_8: DFAState8 do return once new DFAState8
+       private fun dfastate_9: DFAState9 do return once new DFAState9
+       private fun dfastate_10: DFAState10 do return once new DFAState10
+       private fun dfastate_11: DFAState11 do return once new DFAState11
+       private fun dfastate_12: DFAState12 do return once new DFAState12
+       private fun dfastate_13: DFAState13 do return once new DFAState13
+       private fun dfastate_14: DFAState14 do return once new DFAState14
+       private fun dfastate_15: DFAState15 do return once new DFAState15
+       private fun dfastate_16: DFAState16 do return once new DFAState16
+       private fun dfastate_17: DFAState17 do return once new DFAState17
+       private fun dfastate_18: DFAState18 do return once new DFAState18
+       private fun dfastate_19: DFAState19 do return once new DFAState19
+       private fun dfastate_20: DFAState20 do return once new DFAState20
+       private fun dfastate_21: DFAState21 do return once new DFAState21
+       private fun dfastate_22: DFAState22 do return once new DFAState22
+       private fun dfastate_23: DFAState23 do return once new DFAState23
+       private fun dfastate_24: DFAState24 do return once new DFAState24
+       private fun dfastate_25: DFAState25 do return once new DFAState25
+       private fun dfastate_26: DFAState26 do return once new DFAState26
+       private fun dfastate_27: DFAState27 do return once new DFAState27
+       private fun dfastate_28: DFAState28 do return once new DFAState28
+       private fun dfastate_29: DFAState29 do return once new DFAState29
+       private fun dfastate_30: DFAState30 do return once new DFAState30
+       private fun dfastate_31: DFAState31 do return once new DFAState31
+       private fun dfastate_32: DFAState32 do return once new DFAState32
+       private fun dfastate_33: DFAState33 do return once new DFAState33
+       private fun dfastate_34: DFAState34 do return once new DFAState34
+       private fun dfastate_35: DFAState35 do return once new DFAState35
+       private fun dfastate_36: DFAState36 do return once new DFAState36
+       private fun dfastate_37: DFAState37 do return once new DFAState37
+       private fun dfastate_38: DFAState38 do return once new DFAState38
+       private fun dfastate_39: DFAState39 do return once new DFAState39
+       private fun dfastate_40: DFAState40 do return once new DFAState40
+       private fun dfastate_41: DFAState41 do return once new DFAState41
+       private fun dfastate_42: DFAState42 do return once new DFAState42
+       private fun dfastate_43: DFAState43 do return once new DFAState43
+       private fun dfastate_44: DFAState44 do return once new DFAState44
+       private fun dfastate_45: DFAState45 do return once new DFAState45
+       private fun dfastate_46: DFAState46 do return once new DFAState46
+       private fun dfastate_47: DFAState47 do return once new DFAState47
+       private fun dfastate_48: DFAState48 do return once new DFAState48
+       private fun dfastate_49: DFAState49 do return once new DFAState49
+       private fun dfastate_50: DFAState50 do return once new DFAState50
+       private fun dfastate_51: DFAState51 do return once new DFAState51
+       private fun dfastate_52: DFAState52 do return once new DFAState52
+       private fun dfastate_53: DFAState53 do return once new DFAState53
+       private fun dfastate_54: DFAState54 do return once new DFAState54
+       private fun dfastate_55: DFAState55 do return once new DFAState55
+       private fun dfastate_56: DFAState56 do return once new DFAState56
+       private fun dfastate_57: DFAState57 do return once new DFAState57
+       private fun dfastate_58: DFAState58 do return once new DFAState58
+       private fun dfastate_59: DFAState59 do return once new DFAState59
+       private fun dfastate_60: DFAState60 do return once new DFAState60
+       private fun dfastate_61: DFAState61 do return once new DFAState61
+       private fun dfastate_62: DFAState62 do return once new DFAState62
+       private fun dfastate_63: DFAState63 do return once new DFAState63
+       private fun dfastate_64: DFAState64 do return once new DFAState64
+       private fun dfastate_65: DFAState65 do return once new DFAState65
+       private fun dfastate_66: DFAState66 do return once new DFAState66
+       private fun dfastate_67: DFAState67 do return once new DFAState67
+       private fun dfastate_68: DFAState68 do return once new DFAState68
+       private fun dfastate_69: DFAState69 do return once new DFAState69
+       private fun dfastate_70: DFAState70 do return once new DFAState70
+       private fun dfastate_71: DFAState71 do return once new DFAState71
+       private fun dfastate_72: DFAState72 do return once new DFAState72
+       private fun dfastate_73: DFAState73 do return once new DFAState73
+       private fun dfastate_74: DFAState74 do return once new DFAState74
+       private fun dfastate_75: DFAState75 do return once new DFAState75
+       private fun dfastate_76: DFAState76 do return once new DFAState76
+       private fun dfastate_77: DFAState77 do return once new DFAState77
+       private fun dfastate_78: DFAState78 do return once new DFAState78
+       private fun dfastate_79: DFAState79 do return once new DFAState79
+       private fun dfastate_80: DFAState80 do return once new DFAState80
+       private fun dfastate_81: DFAState81 do return once new DFAState81
+       private fun dfastate_82: DFAState82 do return once new DFAState82
+       private fun dfastate_83: DFAState83 do return once new DFAState83
+       private fun dfastate_84: DFAState84 do return once new DFAState84
+       private fun dfastate_85: DFAState85 do return once new DFAState85
+       private fun dfastate_86: DFAState86 do return once new DFAState86
+       private fun dfastate_87: DFAState87 do return once new DFAState87
+       private fun dfastate_88: DFAState88 do return once new DFAState88
+       private fun dfastate_89: DFAState89 do return once new DFAState89
+       private fun dfastate_90: DFAState90 do return once new DFAState90
+       private fun dfastate_91: DFAState91 do return once new DFAState91
+       private fun dfastate_92: DFAState92 do return once new DFAState92
+       private fun dfastate_93: DFAState93 do return once new DFAState93
+       private fun dfastate_94: DFAState94 do return once new DFAState94
+       private fun dfastate_95: DFAState95 do return once new DFAState95
+       private fun dfastate_96: DFAState96 do return once new DFAState96
+       private fun dfastate_97: DFAState97 do return once new DFAState97
+       private fun dfastate_98: DFAState98 do return once new DFAState98
+       private fun dfastate_99: DFAState99 do return once new DFAState99
+       private fun dfastate_100: DFAState100 do return once new DFAState100
+       private fun dfastate_101: DFAState101 do return once new DFAState101
+       private fun dfastate_102: DFAState102 do return once new DFAState102
+       private fun dfastate_103: DFAState103 do return once new DFAState103
+       private fun dfastate_104: DFAState104 do return once new DFAState104
+       private fun dfastate_105: DFAState105 do return once new DFAState105
+       private fun dfastate_106: DFAState106 do return once new DFAState106
+       private fun dfastate_107: DFAState107 do return once new DFAState107
+       private fun dfastate_108: DFAState108 do return once new DFAState108
+       private fun dfastate_109: DFAState109 do return once new DFAState109
+       private fun dfastate_110: DFAState110 do return once new DFAState110
+       private fun dfastate_111: DFAState111 do return once new DFAState111
+       private fun dfastate_112: DFAState112 do return once new DFAState112
+end
+class MyNToken
+       super NToken
+end
+class DFAState0
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 46 then return dfastate_1
+               if c.ascii == 34 then return dfastate_2
+               if c.ascii == 39 then return dfastate_3
+               if c.ascii == 44 then return dfastate_4
+               if c.ascii == 58 then return dfastate_5
+               if c.ascii == 95 then return dfastate_6
+               if c.ascii == 97 then return dfastate_7
+               if c.ascii == 98 then return dfastate_7
+               if c.ascii == 99 then return dfastate_7
+               if c.ascii == 100 then return dfastate_7
+               if c.ascii == 101 then return dfastate_7
+               if c.ascii == 102 then return dfastate_7
+               if c.ascii == 103 then return dfastate_7
+               if c.ascii == 104 then return dfastate_7
+               if c.ascii == 105 then return dfastate_7
+               if c.ascii == 106 then return dfastate_7
+               if c.ascii == 107 then return dfastate_7
+               if c.ascii == 108 then return dfastate_7
+               if c.ascii == 109 then return dfastate_7
+               if c.ascii == 110 then return dfastate_7
+               if c.ascii == 111 then return dfastate_7
+               if c.ascii == 112 then return dfastate_7
+               if c.ascii == 113 then return dfastate_7
+               if c.ascii == 114 then return dfastate_7
+               if c.ascii == 115 then return dfastate_7
+               if c.ascii == 116 then return dfastate_7
+               if c.ascii == 117 then return dfastate_7
+               if c.ascii == 118 then return dfastate_7
+               if c.ascii == 119 then return dfastate_7
+               if c.ascii == 120 then return dfastate_7
+               if c.ascii == 121 then return dfastate_7
+               if c.ascii == 122 then return dfastate_7
+               if c.ascii == 65 then return dfastate_8
+               if c.ascii == 66 then return dfastate_8
+               if c.ascii == 67 then return dfastate_8
+               if c.ascii == 68 then return dfastate_8
+               if c.ascii == 69 then return dfastate_8
+               if c.ascii == 70 then return dfastate_8
+               if c.ascii == 71 then return dfastate_8
+               if c.ascii == 72 then return dfastate_8
+               if c.ascii == 73 then return dfastate_8
+               if c.ascii == 74 then return dfastate_8
+               if c.ascii == 75 then return dfastate_8
+               if c.ascii == 76 then return dfastate_8
+               if c.ascii == 77 then return dfastate_8
+               if c.ascii == 78 then return dfastate_8
+               if c.ascii == 79 then return dfastate_8
+               if c.ascii == 80 then return dfastate_8
+               if c.ascii == 81 then return dfastate_8
+               if c.ascii == 82 then return dfastate_8
+               if c.ascii == 83 then return dfastate_8
+               if c.ascii == 84 then return dfastate_8
+               if c.ascii == 85 then return dfastate_8
+               if c.ascii == 86 then return dfastate_8
+               if c.ascii == 87 then return dfastate_8
+               if c.ascii == 88 then return dfastate_8
+               if c.ascii == 89 then return dfastate_8
+               if c.ascii == 90 then return dfastate_8
+               if c.ascii == 13 then return dfastate_9
+               if c.ascii == 10 then return dfastate_10
+               if c.ascii == 59 then return dfastate_11
+               if c.ascii == 9 then return dfastate_12
+               if c.ascii == 32 then return dfastate_13
+               return null
+       end
+end
+class DFAState1
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 101 then return dfastate_43
+               if c.ascii == 69 then return dfastate_44
+               if c.ascii == 98 then return dfastate_45
+               if c.ascii == 66 then return dfastate_46
+               if c.ascii == 119 then return dfastate_47
+               if c.ascii == 87 then return dfastate_48
+               if c.ascii == 97 then return dfastate_49
+               if c.ascii == 65 then return dfastate_50
+               return null
+       end
+end
+class DFAState2
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_34
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               if c.ascii == 34 then return dfastate_35
+               return null
+       end
+end
+class DFAState3
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_20
+               if c.ascii == 33 then return dfastate_20
+               if c.ascii == 34 then return dfastate_20
+               if c.ascii == 35 then return dfastate_20
+               if c.ascii == 36 then return dfastate_20
+               if c.ascii == 37 then return dfastate_20
+               if c.ascii == 38 then return dfastate_20
+               if c.ascii == 40 then return dfastate_20
+               if c.ascii == 41 then return dfastate_20
+               if c.ascii == 42 then return dfastate_20
+               if c.ascii == 43 then return dfastate_20
+               if c.ascii == 44 then return dfastate_20
+               if c.ascii == 45 then return dfastate_20
+               if c.ascii == 46 then return dfastate_20
+               if c.ascii == 47 then return dfastate_20
+               if c.ascii == 48 then return dfastate_20
+               if c.ascii == 49 then return dfastate_20
+               if c.ascii == 50 then return dfastate_20
+               if c.ascii == 51 then return dfastate_20
+               if c.ascii == 52 then return dfastate_20
+               if c.ascii == 53 then return dfastate_20
+               if c.ascii == 54 then return dfastate_20
+               if c.ascii == 55 then return dfastate_20
+               if c.ascii == 56 then return dfastate_20
+               if c.ascii == 57 then return dfastate_20
+               if c.ascii == 58 then return dfastate_20
+               if c.ascii == 59 then return dfastate_20
+               if c.ascii == 60 then return dfastate_20
+               if c.ascii == 61 then return dfastate_20
+               if c.ascii == 62 then return dfastate_20
+               if c.ascii == 63 then return dfastate_20
+               if c.ascii == 64 then return dfastate_20
+               if c.ascii == 65 then return dfastate_20
+               if c.ascii == 66 then return dfastate_20
+               if c.ascii == 67 then return dfastate_20
+               if c.ascii == 68 then return dfastate_20
+               if c.ascii == 69 then return dfastate_20
+               if c.ascii == 70 then return dfastate_20
+               if c.ascii == 71 then return dfastate_20
+               if c.ascii == 72 then return dfastate_20
+               if c.ascii == 73 then return dfastate_20
+               if c.ascii == 74 then return dfastate_20
+               if c.ascii == 75 then return dfastate_20
+               if c.ascii == 76 then return dfastate_20
+               if c.ascii == 77 then return dfastate_20
+               if c.ascii == 78 then return dfastate_20
+               if c.ascii == 79 then return dfastate_20
+               if c.ascii == 80 then return dfastate_20
+               if c.ascii == 81 then return dfastate_20
+               if c.ascii == 82 then return dfastate_20
+               if c.ascii == 83 then return dfastate_20
+               if c.ascii == 84 then return dfastate_20
+               if c.ascii == 85 then return dfastate_20
+               if c.ascii == 86 then return dfastate_20
+               if c.ascii == 87 then return dfastate_20
+               if c.ascii == 88 then return dfastate_20
+               if c.ascii == 89 then return dfastate_20
+               if c.ascii == 90 then return dfastate_20
+               if c.ascii == 91 then return dfastate_20
+               if c.ascii == 93 then return dfastate_20
+               if c.ascii == 94 then return dfastate_20
+               if c.ascii == 95 then return dfastate_20
+               if c.ascii == 96 then return dfastate_20
+               if c.ascii == 97 then return dfastate_20
+               if c.ascii == 98 then return dfastate_20
+               if c.ascii == 99 then return dfastate_20
+               if c.ascii == 100 then return dfastate_20
+               if c.ascii == 101 then return dfastate_20
+               if c.ascii == 102 then return dfastate_20
+               if c.ascii == 103 then return dfastate_20
+               if c.ascii == 104 then return dfastate_20
+               if c.ascii == 105 then return dfastate_20
+               if c.ascii == 106 then return dfastate_20
+               if c.ascii == 107 then return dfastate_20
+               if c.ascii == 108 then return dfastate_20
+               if c.ascii == 109 then return dfastate_20
+               if c.ascii == 110 then return dfastate_20
+               if c.ascii == 111 then return dfastate_20
+               if c.ascii == 112 then return dfastate_20
+               if c.ascii == 113 then return dfastate_20
+               if c.ascii == 114 then return dfastate_20
+               if c.ascii == 115 then return dfastate_20
+               if c.ascii == 116 then return dfastate_20
+               if c.ascii == 117 then return dfastate_20
+               if c.ascii == 118 then return dfastate_20
+               if c.ascii == 119 then return dfastate_20
+               if c.ascii == 120 then return dfastate_20
+               if c.ascii == 121 then return dfastate_20
+               if c.ascii == 122 then return dfastate_20
+               if c.ascii == 123 then return dfastate_20
+               if c.ascii == 124 then return dfastate_20
+               if c.ascii == 125 then return dfastate_20
+               if c.ascii == 126 then return dfastate_20
+               if c.ascii == 92 then return dfastate_21
+               return null
+       end
+end
+class DFAState4
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ncomma
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState5
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ncolon
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState6
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState7
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState8
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState9
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Neol
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState10
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Neol
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 13 then return dfastate_15
+               return null
+       end
+end
+class DFAState11
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ncomment
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_14
+               if c.ascii == 33 then return dfastate_14
+               if c.ascii == 34 then return dfastate_14
+               if c.ascii == 35 then return dfastate_14
+               if c.ascii == 36 then return dfastate_14
+               if c.ascii == 37 then return dfastate_14
+               if c.ascii == 38 then return dfastate_14
+               if c.ascii == 39 then return dfastate_14
+               if c.ascii == 40 then return dfastate_14
+               if c.ascii == 41 then return dfastate_14
+               if c.ascii == 42 then return dfastate_14
+               if c.ascii == 43 then return dfastate_14
+               if c.ascii == 44 then return dfastate_14
+               if c.ascii == 45 then return dfastate_14
+               if c.ascii == 46 then return dfastate_14
+               if c.ascii == 47 then return dfastate_14
+               if c.ascii == 48 then return dfastate_14
+               if c.ascii == 49 then return dfastate_14
+               if c.ascii == 50 then return dfastate_14
+               if c.ascii == 51 then return dfastate_14
+               if c.ascii == 52 then return dfastate_14
+               if c.ascii == 53 then return dfastate_14
+               if c.ascii == 54 then return dfastate_14
+               if c.ascii == 55 then return dfastate_14
+               if c.ascii == 56 then return dfastate_14
+               if c.ascii == 57 then return dfastate_14
+               if c.ascii == 58 then return dfastate_14
+               if c.ascii == 59 then return dfastate_14
+               if c.ascii == 60 then return dfastate_14
+               if c.ascii == 61 then return dfastate_14
+               if c.ascii == 62 then return dfastate_14
+               if c.ascii == 63 then return dfastate_14
+               if c.ascii == 64 then return dfastate_14
+               if c.ascii == 65 then return dfastate_14
+               if c.ascii == 66 then return dfastate_14
+               if c.ascii == 67 then return dfastate_14
+               if c.ascii == 68 then return dfastate_14
+               if c.ascii == 69 then return dfastate_14
+               if c.ascii == 70 then return dfastate_14
+               if c.ascii == 71 then return dfastate_14
+               if c.ascii == 72 then return dfastate_14
+               if c.ascii == 73 then return dfastate_14
+               if c.ascii == 74 then return dfastate_14
+               if c.ascii == 75 then return dfastate_14
+               if c.ascii == 76 then return dfastate_14
+               if c.ascii == 77 then return dfastate_14
+               if c.ascii == 78 then return dfastate_14
+               if c.ascii == 79 then return dfastate_14
+               if c.ascii == 80 then return dfastate_14
+               if c.ascii == 81 then return dfastate_14
+               if c.ascii == 82 then return dfastate_14
+               if c.ascii == 83 then return dfastate_14
+               if c.ascii == 84 then return dfastate_14
+               if c.ascii == 85 then return dfastate_14
+               if c.ascii == 86 then return dfastate_14
+               if c.ascii == 87 then return dfastate_14
+               if c.ascii == 88 then return dfastate_14
+               if c.ascii == 89 then return dfastate_14
+               if c.ascii == 90 then return dfastate_14
+               if c.ascii == 91 then return dfastate_14
+               if c.ascii == 92 then return dfastate_14
+               if c.ascii == 93 then return dfastate_14
+               if c.ascii == 94 then return dfastate_14
+               if c.ascii == 95 then return dfastate_14
+               if c.ascii == 96 then return dfastate_14
+               if c.ascii == 97 then return dfastate_14
+               if c.ascii == 98 then return dfastate_14
+               if c.ascii == 99 then return dfastate_14
+               if c.ascii == 100 then return dfastate_14
+               if c.ascii == 101 then return dfastate_14
+               if c.ascii == 102 then return dfastate_14
+               if c.ascii == 103 then return dfastate_14
+               if c.ascii == 104 then return dfastate_14
+               if c.ascii == 105 then return dfastate_14
+               if c.ascii == 106 then return dfastate_14
+               if c.ascii == 107 then return dfastate_14
+               if c.ascii == 108 then return dfastate_14
+               if c.ascii == 109 then return dfastate_14
+               if c.ascii == 110 then return dfastate_14
+               if c.ascii == 111 then return dfastate_14
+               if c.ascii == 112 then return dfastate_14
+               if c.ascii == 113 then return dfastate_14
+               if c.ascii == 114 then return dfastate_14
+               if c.ascii == 115 then return dfastate_14
+               if c.ascii == 116 then return dfastate_14
+               if c.ascii == 117 then return dfastate_14
+               if c.ascii == 118 then return dfastate_14
+               if c.ascii == 119 then return dfastate_14
+               if c.ascii == 120 then return dfastate_14
+               if c.ascii == 121 then return dfastate_14
+               if c.ascii == 122 then return dfastate_14
+               if c.ascii == 123 then return dfastate_14
+               if c.ascii == 124 then return dfastate_14
+               if c.ascii == 125 then return dfastate_14
+               if c.ascii == 126 then return dfastate_14
+               return null
+       end
+end
+class DFAState12
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               return null
+       end
+       redef fun trans(c) do
+               if c.ascii == 9 then return dfastate_12
+               if c.ascii == 32 then return dfastate_13
+               return null
+       end
+end
+class DFAState13
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               return null
+       end
+       redef fun trans(c) do
+               if c.ascii == 9 then return dfastate_12
+               if c.ascii == 32 then return dfastate_13
+               return null
+       end
+end
+class DFAState14
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ncomment
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_14
+               if c.ascii == 33 then return dfastate_14
+               if c.ascii == 34 then return dfastate_14
+               if c.ascii == 35 then return dfastate_14
+               if c.ascii == 36 then return dfastate_14
+               if c.ascii == 37 then return dfastate_14
+               if c.ascii == 38 then return dfastate_14
+               if c.ascii == 39 then return dfastate_14
+               if c.ascii == 40 then return dfastate_14
+               if c.ascii == 41 then return dfastate_14
+               if c.ascii == 42 then return dfastate_14
+               if c.ascii == 43 then return dfastate_14
+               if c.ascii == 44 then return dfastate_14
+               if c.ascii == 45 then return dfastate_14
+               if c.ascii == 46 then return dfastate_14
+               if c.ascii == 47 then return dfastate_14
+               if c.ascii == 48 then return dfastate_14
+               if c.ascii == 49 then return dfastate_14
+               if c.ascii == 50 then return dfastate_14
+               if c.ascii == 51 then return dfastate_14
+               if c.ascii == 52 then return dfastate_14
+               if c.ascii == 53 then return dfastate_14
+               if c.ascii == 54 then return dfastate_14
+               if c.ascii == 55 then return dfastate_14
+               if c.ascii == 56 then return dfastate_14
+               if c.ascii == 57 then return dfastate_14
+               if c.ascii == 58 then return dfastate_14
+               if c.ascii == 59 then return dfastate_14
+               if c.ascii == 60 then return dfastate_14
+               if c.ascii == 61 then return dfastate_14
+               if c.ascii == 62 then return dfastate_14
+               if c.ascii == 63 then return dfastate_14
+               if c.ascii == 64 then return dfastate_14
+               if c.ascii == 65 then return dfastate_14
+               if c.ascii == 66 then return dfastate_14
+               if c.ascii == 67 then return dfastate_14
+               if c.ascii == 68 then return dfastate_14
+               if c.ascii == 69 then return dfastate_14
+               if c.ascii == 70 then return dfastate_14
+               if c.ascii == 71 then return dfastate_14
+               if c.ascii == 72 then return dfastate_14
+               if c.ascii == 73 then return dfastate_14
+               if c.ascii == 74 then return dfastate_14
+               if c.ascii == 75 then return dfastate_14
+               if c.ascii == 76 then return dfastate_14
+               if c.ascii == 77 then return dfastate_14
+               if c.ascii == 78 then return dfastate_14
+               if c.ascii == 79 then return dfastate_14
+               if c.ascii == 80 then return dfastate_14
+               if c.ascii == 81 then return dfastate_14
+               if c.ascii == 82 then return dfastate_14
+               if c.ascii == 83 then return dfastate_14
+               if c.ascii == 84 then return dfastate_14
+               if c.ascii == 85 then return dfastate_14
+               if c.ascii == 86 then return dfastate_14
+               if c.ascii == 87 then return dfastate_14
+               if c.ascii == 88 then return dfastate_14
+               if c.ascii == 89 then return dfastate_14
+               if c.ascii == 90 then return dfastate_14
+               if c.ascii == 91 then return dfastate_14
+               if c.ascii == 92 then return dfastate_14
+               if c.ascii == 93 then return dfastate_14
+               if c.ascii == 94 then return dfastate_14
+               if c.ascii == 95 then return dfastate_14
+               if c.ascii == 96 then return dfastate_14
+               if c.ascii == 97 then return dfastate_14
+               if c.ascii == 98 then return dfastate_14
+               if c.ascii == 99 then return dfastate_14
+               if c.ascii == 100 then return dfastate_14
+               if c.ascii == 101 then return dfastate_14
+               if c.ascii == 102 then return dfastate_14
+               if c.ascii == 103 then return dfastate_14
+               if c.ascii == 104 then return dfastate_14
+               if c.ascii == 105 then return dfastate_14
+               if c.ascii == 106 then return dfastate_14
+               if c.ascii == 107 then return dfastate_14
+               if c.ascii == 108 then return dfastate_14
+               if c.ascii == 109 then return dfastate_14
+               if c.ascii == 110 then return dfastate_14
+               if c.ascii == 111 then return dfastate_14
+               if c.ascii == 112 then return dfastate_14
+               if c.ascii == 113 then return dfastate_14
+               if c.ascii == 114 then return dfastate_14
+               if c.ascii == 115 then return dfastate_14
+               if c.ascii == 116 then return dfastate_14
+               if c.ascii == 117 then return dfastate_14
+               if c.ascii == 118 then return dfastate_14
+               if c.ascii == 119 then return dfastate_14
+               if c.ascii == 120 then return dfastate_14
+               if c.ascii == 121 then return dfastate_14
+               if c.ascii == 122 then return dfastate_14
+               if c.ascii == 123 then return dfastate_14
+               if c.ascii == 124 then return dfastate_14
+               if c.ascii == 125 then return dfastate_14
+               if c.ascii == 126 then return dfastate_14
+               return null
+       end
+end
+class DFAState15
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Neol
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState16
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState17
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState18
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState19
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nid
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 95 then return dfastate_16
+               if c.ascii == 48 then return dfastate_17
+               if c.ascii == 49 then return dfastate_17
+               if c.ascii == 50 then return dfastate_17
+               if c.ascii == 51 then return dfastate_17
+               if c.ascii == 52 then return dfastate_17
+               if c.ascii == 53 then return dfastate_17
+               if c.ascii == 54 then return dfastate_17
+               if c.ascii == 55 then return dfastate_17
+               if c.ascii == 56 then return dfastate_17
+               if c.ascii == 57 then return dfastate_17
+               if c.ascii == 97 then return dfastate_18
+               if c.ascii == 98 then return dfastate_18
+               if c.ascii == 99 then return dfastate_18
+               if c.ascii == 100 then return dfastate_18
+               if c.ascii == 101 then return dfastate_18
+               if c.ascii == 102 then return dfastate_18
+               if c.ascii == 103 then return dfastate_18
+               if c.ascii == 104 then return dfastate_18
+               if c.ascii == 105 then return dfastate_18
+               if c.ascii == 106 then return dfastate_18
+               if c.ascii == 107 then return dfastate_18
+               if c.ascii == 108 then return dfastate_18
+               if c.ascii == 109 then return dfastate_18
+               if c.ascii == 110 then return dfastate_18
+               if c.ascii == 111 then return dfastate_18
+               if c.ascii == 112 then return dfastate_18
+               if c.ascii == 113 then return dfastate_18
+               if c.ascii == 114 then return dfastate_18
+               if c.ascii == 115 then return dfastate_18
+               if c.ascii == 116 then return dfastate_18
+               if c.ascii == 117 then return dfastate_18
+               if c.ascii == 118 then return dfastate_18
+               if c.ascii == 119 then return dfastate_18
+               if c.ascii == 120 then return dfastate_18
+               if c.ascii == 121 then return dfastate_18
+               if c.ascii == 122 then return dfastate_18
+               if c.ascii == 65 then return dfastate_19
+               if c.ascii == 66 then return dfastate_19
+               if c.ascii == 67 then return dfastate_19
+               if c.ascii == 68 then return dfastate_19
+               if c.ascii == 69 then return dfastate_19
+               if c.ascii == 70 then return dfastate_19
+               if c.ascii == 71 then return dfastate_19
+               if c.ascii == 72 then return dfastate_19
+               if c.ascii == 73 then return dfastate_19
+               if c.ascii == 74 then return dfastate_19
+               if c.ascii == 75 then return dfastate_19
+               if c.ascii == 76 then return dfastate_19
+               if c.ascii == 77 then return dfastate_19
+               if c.ascii == 78 then return dfastate_19
+               if c.ascii == 79 then return dfastate_19
+               if c.ascii == 80 then return dfastate_19
+               if c.ascii == 81 then return dfastate_19
+               if c.ascii == 82 then return dfastate_19
+               if c.ascii == 83 then return dfastate_19
+               if c.ascii == 84 then return dfastate_19
+               if c.ascii == 85 then return dfastate_19
+               if c.ascii == 86 then return dfastate_19
+               if c.ascii == 87 then return dfastate_19
+               if c.ascii == 88 then return dfastate_19
+               if c.ascii == 89 then return dfastate_19
+               if c.ascii == 90 then return dfastate_19
+               return null
+       end
+end
+class DFAState20
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_32
+               return null
+       end
+end
+class DFAState21
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 120 then return dfastate_22
+               if c.ascii == 32 then return dfastate_23
+               if c.ascii == 33 then return dfastate_23
+               if c.ascii == 34 then return dfastate_23
+               if c.ascii == 35 then return dfastate_23
+               if c.ascii == 36 then return dfastate_23
+               if c.ascii == 37 then return dfastate_23
+               if c.ascii == 38 then return dfastate_23
+               if c.ascii == 39 then return dfastate_23
+               if c.ascii == 40 then return dfastate_23
+               if c.ascii == 41 then return dfastate_23
+               if c.ascii == 42 then return dfastate_23
+               if c.ascii == 43 then return dfastate_23
+               if c.ascii == 44 then return dfastate_23
+               if c.ascii == 45 then return dfastate_23
+               if c.ascii == 46 then return dfastate_23
+               if c.ascii == 47 then return dfastate_23
+               if c.ascii == 48 then return dfastate_23
+               if c.ascii == 49 then return dfastate_23
+               if c.ascii == 50 then return dfastate_23
+               if c.ascii == 51 then return dfastate_23
+               if c.ascii == 52 then return dfastate_23
+               if c.ascii == 53 then return dfastate_23
+               if c.ascii == 54 then return dfastate_23
+               if c.ascii == 55 then return dfastate_23
+               if c.ascii == 56 then return dfastate_23
+               if c.ascii == 57 then return dfastate_23
+               if c.ascii == 58 then return dfastate_23
+               if c.ascii == 59 then return dfastate_23
+               if c.ascii == 60 then return dfastate_23
+               if c.ascii == 61 then return dfastate_23
+               if c.ascii == 62 then return dfastate_23
+               if c.ascii == 63 then return dfastate_23
+               if c.ascii == 64 then return dfastate_23
+               if c.ascii == 65 then return dfastate_23
+               if c.ascii == 66 then return dfastate_23
+               if c.ascii == 67 then return dfastate_23
+               if c.ascii == 68 then return dfastate_23
+               if c.ascii == 69 then return dfastate_23
+               if c.ascii == 70 then return dfastate_23
+               if c.ascii == 71 then return dfastate_23
+               if c.ascii == 72 then return dfastate_23
+               if c.ascii == 73 then return dfastate_23
+               if c.ascii == 74 then return dfastate_23
+               if c.ascii == 75 then return dfastate_23
+               if c.ascii == 76 then return dfastate_23
+               if c.ascii == 77 then return dfastate_23
+               if c.ascii == 78 then return dfastate_23
+               if c.ascii == 79 then return dfastate_23
+               if c.ascii == 80 then return dfastate_23
+               if c.ascii == 81 then return dfastate_23
+               if c.ascii == 82 then return dfastate_23
+               if c.ascii == 83 then return dfastate_23
+               if c.ascii == 84 then return dfastate_23
+               if c.ascii == 85 then return dfastate_23
+               if c.ascii == 86 then return dfastate_23
+               if c.ascii == 87 then return dfastate_23
+               if c.ascii == 88 then return dfastate_23
+               if c.ascii == 89 then return dfastate_23
+               if c.ascii == 90 then return dfastate_23
+               if c.ascii == 91 then return dfastate_23
+               if c.ascii == 92 then return dfastate_23
+               if c.ascii == 93 then return dfastate_23
+               if c.ascii == 94 then return dfastate_23
+               if c.ascii == 95 then return dfastate_23
+               if c.ascii == 96 then return dfastate_23
+               if c.ascii == 97 then return dfastate_23
+               if c.ascii == 98 then return dfastate_23
+               if c.ascii == 99 then return dfastate_23
+               if c.ascii == 100 then return dfastate_23
+               if c.ascii == 101 then return dfastate_23
+               if c.ascii == 102 then return dfastate_23
+               if c.ascii == 103 then return dfastate_23
+               if c.ascii == 104 then return dfastate_23
+               if c.ascii == 105 then return dfastate_23
+               if c.ascii == 106 then return dfastate_23
+               if c.ascii == 107 then return dfastate_23
+               if c.ascii == 108 then return dfastate_23
+               if c.ascii == 109 then return dfastate_23
+               if c.ascii == 110 then return dfastate_23
+               if c.ascii == 111 then return dfastate_23
+               if c.ascii == 112 then return dfastate_23
+               if c.ascii == 113 then return dfastate_23
+               if c.ascii == 114 then return dfastate_23
+               if c.ascii == 115 then return dfastate_23
+               if c.ascii == 116 then return dfastate_23
+               if c.ascii == 117 then return dfastate_23
+               if c.ascii == 118 then return dfastate_23
+               if c.ascii == 119 then return dfastate_23
+               if c.ascii == 121 then return dfastate_23
+               if c.ascii == 122 then return dfastate_23
+               if c.ascii == 123 then return dfastate_23
+               if c.ascii == 124 then return dfastate_23
+               if c.ascii == 125 then return dfastate_23
+               if c.ascii == 126 then return dfastate_23
+               return null
+       end
+end
+class DFAState22
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_24
+               if c.ascii == 97 then return dfastate_25
+               if c.ascii == 98 then return dfastate_25
+               if c.ascii == 99 then return dfastate_25
+               if c.ascii == 100 then return dfastate_25
+               if c.ascii == 101 then return dfastate_25
+               if c.ascii == 102 then return dfastate_25
+               if c.ascii == 48 then return dfastate_26
+               if c.ascii == 49 then return dfastate_26
+               if c.ascii == 50 then return dfastate_26
+               if c.ascii == 51 then return dfastate_26
+               if c.ascii == 52 then return dfastate_26
+               if c.ascii == 53 then return dfastate_26
+               if c.ascii == 54 then return dfastate_26
+               if c.ascii == 55 then return dfastate_26
+               if c.ascii == 56 then return dfastate_26
+               if c.ascii == 57 then return dfastate_26
+               if c.ascii == 65 then return dfastate_27
+               if c.ascii == 66 then return dfastate_27
+               if c.ascii == 67 then return dfastate_27
+               if c.ascii == 68 then return dfastate_27
+               if c.ascii == 69 then return dfastate_27
+               if c.ascii == 70 then return dfastate_27
+               return null
+       end
+end
+class DFAState23
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_24
+               return null
+       end
+end
+class DFAState24
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nchar
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState25
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 97 then return dfastate_28
+               if c.ascii == 98 then return dfastate_28
+               if c.ascii == 99 then return dfastate_28
+               if c.ascii == 100 then return dfastate_28
+               if c.ascii == 101 then return dfastate_28
+               if c.ascii == 102 then return dfastate_28
+               if c.ascii == 48 then return dfastate_29
+               if c.ascii == 49 then return dfastate_29
+               if c.ascii == 50 then return dfastate_29
+               if c.ascii == 51 then return dfastate_29
+               if c.ascii == 52 then return dfastate_29
+               if c.ascii == 53 then return dfastate_29
+               if c.ascii == 54 then return dfastate_29
+               if c.ascii == 55 then return dfastate_29
+               if c.ascii == 56 then return dfastate_29
+               if c.ascii == 57 then return dfastate_29
+               if c.ascii == 65 then return dfastate_30
+               if c.ascii == 66 then return dfastate_30
+               if c.ascii == 67 then return dfastate_30
+               if c.ascii == 68 then return dfastate_30
+               if c.ascii == 69 then return dfastate_30
+               if c.ascii == 70 then return dfastate_30
+               return null
+       end
+end
+class DFAState26
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 97 then return dfastate_28
+               if c.ascii == 98 then return dfastate_28
+               if c.ascii == 99 then return dfastate_28
+               if c.ascii == 100 then return dfastate_28
+               if c.ascii == 101 then return dfastate_28
+               if c.ascii == 102 then return dfastate_28
+               if c.ascii == 48 then return dfastate_29
+               if c.ascii == 49 then return dfastate_29
+               if c.ascii == 50 then return dfastate_29
+               if c.ascii == 51 then return dfastate_29
+               if c.ascii == 52 then return dfastate_29
+               if c.ascii == 53 then return dfastate_29
+               if c.ascii == 54 then return dfastate_29
+               if c.ascii == 55 then return dfastate_29
+               if c.ascii == 56 then return dfastate_29
+               if c.ascii == 57 then return dfastate_29
+               if c.ascii == 65 then return dfastate_30
+               if c.ascii == 66 then return dfastate_30
+               if c.ascii == 67 then return dfastate_30
+               if c.ascii == 68 then return dfastate_30
+               if c.ascii == 69 then return dfastate_30
+               if c.ascii == 70 then return dfastate_30
+               return null
+       end
+end
+class DFAState27
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 97 then return dfastate_28
+               if c.ascii == 98 then return dfastate_28
+               if c.ascii == 99 then return dfastate_28
+               if c.ascii == 100 then return dfastate_28
+               if c.ascii == 101 then return dfastate_28
+               if c.ascii == 102 then return dfastate_28
+               if c.ascii == 48 then return dfastate_29
+               if c.ascii == 49 then return dfastate_29
+               if c.ascii == 50 then return dfastate_29
+               if c.ascii == 51 then return dfastate_29
+               if c.ascii == 52 then return dfastate_29
+               if c.ascii == 53 then return dfastate_29
+               if c.ascii == 54 then return dfastate_29
+               if c.ascii == 55 then return dfastate_29
+               if c.ascii == 56 then return dfastate_29
+               if c.ascii == 57 then return dfastate_29
+               if c.ascii == 65 then return dfastate_30
+               if c.ascii == 66 then return dfastate_30
+               if c.ascii == 67 then return dfastate_30
+               if c.ascii == 68 then return dfastate_30
+               if c.ascii == 69 then return dfastate_30
+               if c.ascii == 70 then return dfastate_30
+               return null
+       end
+end
+class DFAState28
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_31
+               return null
+       end
+end
+class DFAState29
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_31
+               return null
+       end
+end
+class DFAState30
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 39 then return dfastate_31
+               return null
+       end
+end
+class DFAState31
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nchar
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState32
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nchar
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState33
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_42
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               return null
+       end
+end
+class DFAState34
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_36
+               if c.ascii == 33 then return dfastate_36
+               if c.ascii == 34 then return dfastate_37
+               if c.ascii == 35 then return dfastate_36
+               if c.ascii == 36 then return dfastate_36
+               if c.ascii == 37 then return dfastate_36
+               if c.ascii == 38 then return dfastate_36
+               if c.ascii == 39 then return dfastate_36
+               if c.ascii == 40 then return dfastate_36
+               if c.ascii == 41 then return dfastate_36
+               if c.ascii == 42 then return dfastate_36
+               if c.ascii == 43 then return dfastate_36
+               if c.ascii == 44 then return dfastate_36
+               if c.ascii == 45 then return dfastate_36
+               if c.ascii == 46 then return dfastate_36
+               if c.ascii == 47 then return dfastate_36
+               if c.ascii == 48 then return dfastate_36
+               if c.ascii == 49 then return dfastate_36
+               if c.ascii == 50 then return dfastate_36
+               if c.ascii == 51 then return dfastate_36
+               if c.ascii == 52 then return dfastate_36
+               if c.ascii == 53 then return dfastate_36
+               if c.ascii == 54 then return dfastate_36
+               if c.ascii == 55 then return dfastate_36
+               if c.ascii == 56 then return dfastate_36
+               if c.ascii == 57 then return dfastate_36
+               if c.ascii == 58 then return dfastate_36
+               if c.ascii == 59 then return dfastate_36
+               if c.ascii == 60 then return dfastate_36
+               if c.ascii == 61 then return dfastate_36
+               if c.ascii == 62 then return dfastate_36
+               if c.ascii == 63 then return dfastate_36
+               if c.ascii == 64 then return dfastate_36
+               if c.ascii == 65 then return dfastate_36
+               if c.ascii == 66 then return dfastate_36
+               if c.ascii == 67 then return dfastate_36
+               if c.ascii == 68 then return dfastate_36
+               if c.ascii == 69 then return dfastate_36
+               if c.ascii == 70 then return dfastate_36
+               if c.ascii == 71 then return dfastate_36
+               if c.ascii == 72 then return dfastate_36
+               if c.ascii == 73 then return dfastate_36
+               if c.ascii == 74 then return dfastate_36
+               if c.ascii == 75 then return dfastate_36
+               if c.ascii == 76 then return dfastate_36
+               if c.ascii == 77 then return dfastate_36
+               if c.ascii == 78 then return dfastate_36
+               if c.ascii == 79 then return dfastate_36
+               if c.ascii == 80 then return dfastate_36
+               if c.ascii == 81 then return dfastate_36
+               if c.ascii == 82 then return dfastate_36
+               if c.ascii == 83 then return dfastate_36
+               if c.ascii == 84 then return dfastate_36
+               if c.ascii == 85 then return dfastate_36
+               if c.ascii == 86 then return dfastate_36
+               if c.ascii == 87 then return dfastate_36
+               if c.ascii == 88 then return dfastate_36
+               if c.ascii == 89 then return dfastate_36
+               if c.ascii == 90 then return dfastate_36
+               if c.ascii == 91 then return dfastate_36
+               if c.ascii == 92 then return dfastate_38
+               if c.ascii == 93 then return dfastate_36
+               if c.ascii == 94 then return dfastate_36
+               if c.ascii == 95 then return dfastate_36
+               if c.ascii == 96 then return dfastate_36
+               if c.ascii == 97 then return dfastate_36
+               if c.ascii == 98 then return dfastate_36
+               if c.ascii == 99 then return dfastate_36
+               if c.ascii == 100 then return dfastate_36
+               if c.ascii == 101 then return dfastate_36
+               if c.ascii == 102 then return dfastate_36
+               if c.ascii == 103 then return dfastate_36
+               if c.ascii == 104 then return dfastate_36
+               if c.ascii == 105 then return dfastate_36
+               if c.ascii == 106 then return dfastate_36
+               if c.ascii == 107 then return dfastate_36
+               if c.ascii == 108 then return dfastate_36
+               if c.ascii == 109 then return dfastate_36
+               if c.ascii == 110 then return dfastate_36
+               if c.ascii == 111 then return dfastate_36
+               if c.ascii == 112 then return dfastate_36
+               if c.ascii == 113 then return dfastate_36
+               if c.ascii == 114 then return dfastate_36
+               if c.ascii == 115 then return dfastate_36
+               if c.ascii == 116 then return dfastate_36
+               if c.ascii == 117 then return dfastate_36
+               if c.ascii == 118 then return dfastate_36
+               if c.ascii == 119 then return dfastate_36
+               if c.ascii == 120 then return dfastate_36
+               if c.ascii == 121 then return dfastate_36
+               if c.ascii == 122 then return dfastate_36
+               if c.ascii == 123 then return dfastate_36
+               if c.ascii == 124 then return dfastate_36
+               if c.ascii == 125 then return dfastate_36
+               if c.ascii == 126 then return dfastate_36
+               return null
+       end
+end
+class DFAState35
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nstring
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState36
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_39
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               if c.ascii == 34 then return dfastate_35
+               return null
+       end
+end
+class DFAState37
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_35
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_34
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               return null
+       end
+end
+class DFAState38
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_35
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_39
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               return null
+       end
+end
+class DFAState39
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_40
+               if c.ascii == 32 then return dfastate_36
+               if c.ascii == 33 then return dfastate_36
+               if c.ascii == 35 then return dfastate_36
+               if c.ascii == 36 then return dfastate_36
+               if c.ascii == 37 then return dfastate_36
+               if c.ascii == 38 then return dfastate_36
+               if c.ascii == 39 then return dfastate_36
+               if c.ascii == 40 then return dfastate_36
+               if c.ascii == 41 then return dfastate_36
+               if c.ascii == 42 then return dfastate_36
+               if c.ascii == 43 then return dfastate_36
+               if c.ascii == 44 then return dfastate_36
+               if c.ascii == 45 then return dfastate_36
+               if c.ascii == 46 then return dfastate_36
+               if c.ascii == 47 then return dfastate_36
+               if c.ascii == 48 then return dfastate_36
+               if c.ascii == 49 then return dfastate_36
+               if c.ascii == 50 then return dfastate_36
+               if c.ascii == 51 then return dfastate_36
+               if c.ascii == 52 then return dfastate_36
+               if c.ascii == 53 then return dfastate_36
+               if c.ascii == 54 then return dfastate_36
+               if c.ascii == 55 then return dfastate_36
+               if c.ascii == 56 then return dfastate_36
+               if c.ascii == 57 then return dfastate_36
+               if c.ascii == 58 then return dfastate_36
+               if c.ascii == 59 then return dfastate_36
+               if c.ascii == 60 then return dfastate_36
+               if c.ascii == 61 then return dfastate_36
+               if c.ascii == 62 then return dfastate_36
+               if c.ascii == 63 then return dfastate_36
+               if c.ascii == 64 then return dfastate_36
+               if c.ascii == 65 then return dfastate_36
+               if c.ascii == 66 then return dfastate_36
+               if c.ascii == 67 then return dfastate_36
+               if c.ascii == 68 then return dfastate_36
+               if c.ascii == 69 then return dfastate_36
+               if c.ascii == 70 then return dfastate_36
+               if c.ascii == 71 then return dfastate_36
+               if c.ascii == 72 then return dfastate_36
+               if c.ascii == 73 then return dfastate_36
+               if c.ascii == 74 then return dfastate_36
+               if c.ascii == 75 then return dfastate_36
+               if c.ascii == 76 then return dfastate_36
+               if c.ascii == 77 then return dfastate_36
+               if c.ascii == 78 then return dfastate_36
+               if c.ascii == 79 then return dfastate_36
+               if c.ascii == 80 then return dfastate_36
+               if c.ascii == 81 then return dfastate_36
+               if c.ascii == 82 then return dfastate_36
+               if c.ascii == 83 then return dfastate_36
+               if c.ascii == 84 then return dfastate_36
+               if c.ascii == 85 then return dfastate_36
+               if c.ascii == 86 then return dfastate_36
+               if c.ascii == 87 then return dfastate_36
+               if c.ascii == 88 then return dfastate_36
+               if c.ascii == 89 then return dfastate_36
+               if c.ascii == 90 then return dfastate_36
+               if c.ascii == 91 then return dfastate_36
+               if c.ascii == 92 then return dfastate_41
+               if c.ascii == 93 then return dfastate_36
+               if c.ascii == 94 then return dfastate_36
+               if c.ascii == 95 then return dfastate_36
+               if c.ascii == 96 then return dfastate_36
+               if c.ascii == 97 then return dfastate_36
+               if c.ascii == 98 then return dfastate_36
+               if c.ascii == 99 then return dfastate_36
+               if c.ascii == 100 then return dfastate_36
+               if c.ascii == 101 then return dfastate_36
+               if c.ascii == 102 then return dfastate_36
+               if c.ascii == 103 then return dfastate_36
+               if c.ascii == 104 then return dfastate_36
+               if c.ascii == 105 then return dfastate_36
+               if c.ascii == 106 then return dfastate_36
+               if c.ascii == 107 then return dfastate_36
+               if c.ascii == 108 then return dfastate_36
+               if c.ascii == 109 then return dfastate_36
+               if c.ascii == 110 then return dfastate_36
+               if c.ascii == 111 then return dfastate_36
+               if c.ascii == 112 then return dfastate_36
+               if c.ascii == 113 then return dfastate_36
+               if c.ascii == 114 then return dfastate_36
+               if c.ascii == 115 then return dfastate_36
+               if c.ascii == 116 then return dfastate_36
+               if c.ascii == 117 then return dfastate_36
+               if c.ascii == 118 then return dfastate_36
+               if c.ascii == 119 then return dfastate_36
+               if c.ascii == 120 then return dfastate_36
+               if c.ascii == 121 then return dfastate_36
+               if c.ascii == 122 then return dfastate_36
+               if c.ascii == 123 then return dfastate_36
+               if c.ascii == 124 then return dfastate_36
+               if c.ascii == 125 then return dfastate_36
+               if c.ascii == 126 then return dfastate_36
+               return null
+       end
+end
+class DFAState40
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nstring
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_35
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_34
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               return null
+       end
+end
+class DFAState41
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_40
+               if c.ascii == 32 then return dfastate_36
+               if c.ascii == 33 then return dfastate_36
+               if c.ascii == 35 then return dfastate_36
+               if c.ascii == 36 then return dfastate_36
+               if c.ascii == 37 then return dfastate_36
+               if c.ascii == 38 then return dfastate_36
+               if c.ascii == 39 then return dfastate_36
+               if c.ascii == 40 then return dfastate_36
+               if c.ascii == 41 then return dfastate_36
+               if c.ascii == 42 then return dfastate_36
+               if c.ascii == 43 then return dfastate_36
+               if c.ascii == 44 then return dfastate_36
+               if c.ascii == 45 then return dfastate_36
+               if c.ascii == 46 then return dfastate_36
+               if c.ascii == 47 then return dfastate_36
+               if c.ascii == 48 then return dfastate_36
+               if c.ascii == 49 then return dfastate_36
+               if c.ascii == 50 then return dfastate_36
+               if c.ascii == 51 then return dfastate_36
+               if c.ascii == 52 then return dfastate_36
+               if c.ascii == 53 then return dfastate_36
+               if c.ascii == 54 then return dfastate_36
+               if c.ascii == 55 then return dfastate_36
+               if c.ascii == 56 then return dfastate_36
+               if c.ascii == 57 then return dfastate_36
+               if c.ascii == 58 then return dfastate_36
+               if c.ascii == 59 then return dfastate_36
+               if c.ascii == 60 then return dfastate_36
+               if c.ascii == 61 then return dfastate_36
+               if c.ascii == 62 then return dfastate_36
+               if c.ascii == 63 then return dfastate_36
+               if c.ascii == 64 then return dfastate_36
+               if c.ascii == 65 then return dfastate_36
+               if c.ascii == 66 then return dfastate_36
+               if c.ascii == 67 then return dfastate_36
+               if c.ascii == 68 then return dfastate_36
+               if c.ascii == 69 then return dfastate_36
+               if c.ascii == 70 then return dfastate_36
+               if c.ascii == 71 then return dfastate_36
+               if c.ascii == 72 then return dfastate_36
+               if c.ascii == 73 then return dfastate_36
+               if c.ascii == 74 then return dfastate_36
+               if c.ascii == 75 then return dfastate_36
+               if c.ascii == 76 then return dfastate_36
+               if c.ascii == 77 then return dfastate_36
+               if c.ascii == 78 then return dfastate_36
+               if c.ascii == 79 then return dfastate_36
+               if c.ascii == 80 then return dfastate_36
+               if c.ascii == 81 then return dfastate_36
+               if c.ascii == 82 then return dfastate_36
+               if c.ascii == 83 then return dfastate_36
+               if c.ascii == 84 then return dfastate_36
+               if c.ascii == 85 then return dfastate_36
+               if c.ascii == 86 then return dfastate_36
+               if c.ascii == 87 then return dfastate_36
+               if c.ascii == 88 then return dfastate_36
+               if c.ascii == 89 then return dfastate_36
+               if c.ascii == 90 then return dfastate_36
+               if c.ascii == 91 then return dfastate_36
+               if c.ascii == 92 then return dfastate_41
+               if c.ascii == 93 then return dfastate_36
+               if c.ascii == 94 then return dfastate_36
+               if c.ascii == 95 then return dfastate_36
+               if c.ascii == 96 then return dfastate_36
+               if c.ascii == 97 then return dfastate_36
+               if c.ascii == 98 then return dfastate_36
+               if c.ascii == 99 then return dfastate_36
+               if c.ascii == 100 then return dfastate_36
+               if c.ascii == 101 then return dfastate_36
+               if c.ascii == 102 then return dfastate_36
+               if c.ascii == 103 then return dfastate_36
+               if c.ascii == 104 then return dfastate_36
+               if c.ascii == 105 then return dfastate_36
+               if c.ascii == 106 then return dfastate_36
+               if c.ascii == 107 then return dfastate_36
+               if c.ascii == 108 then return dfastate_36
+               if c.ascii == 109 then return dfastate_36
+               if c.ascii == 110 then return dfastate_36
+               if c.ascii == 111 then return dfastate_36
+               if c.ascii == 112 then return dfastate_36
+               if c.ascii == 113 then return dfastate_36
+               if c.ascii == 114 then return dfastate_36
+               if c.ascii == 115 then return dfastate_36
+               if c.ascii == 116 then return dfastate_36
+               if c.ascii == 117 then return dfastate_36
+               if c.ascii == 118 then return dfastate_36
+               if c.ascii == 119 then return dfastate_36
+               if c.ascii == 120 then return dfastate_36
+               if c.ascii == 121 then return dfastate_36
+               if c.ascii == 122 then return dfastate_36
+               if c.ascii == 123 then return dfastate_36
+               if c.ascii == 124 then return dfastate_36
+               if c.ascii == 125 then return dfastate_36
+               if c.ascii == 126 then return dfastate_36
+               return null
+       end
+end
+class DFAState42
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 34 then return dfastate_35
+               if c.ascii == 32 then return dfastate_33
+               if c.ascii == 33 then return dfastate_33
+               if c.ascii == 35 then return dfastate_33
+               if c.ascii == 36 then return dfastate_33
+               if c.ascii == 37 then return dfastate_33
+               if c.ascii == 38 then return dfastate_33
+               if c.ascii == 39 then return dfastate_33
+               if c.ascii == 40 then return dfastate_33
+               if c.ascii == 41 then return dfastate_33
+               if c.ascii == 42 then return dfastate_33
+               if c.ascii == 43 then return dfastate_33
+               if c.ascii == 44 then return dfastate_33
+               if c.ascii == 45 then return dfastate_33
+               if c.ascii == 46 then return dfastate_33
+               if c.ascii == 47 then return dfastate_33
+               if c.ascii == 48 then return dfastate_33
+               if c.ascii == 49 then return dfastate_33
+               if c.ascii == 50 then return dfastate_33
+               if c.ascii == 51 then return dfastate_33
+               if c.ascii == 52 then return dfastate_33
+               if c.ascii == 53 then return dfastate_33
+               if c.ascii == 54 then return dfastate_33
+               if c.ascii == 55 then return dfastate_33
+               if c.ascii == 56 then return dfastate_33
+               if c.ascii == 57 then return dfastate_33
+               if c.ascii == 58 then return dfastate_33
+               if c.ascii == 59 then return dfastate_33
+               if c.ascii == 60 then return dfastate_33
+               if c.ascii == 61 then return dfastate_33
+               if c.ascii == 62 then return dfastate_33
+               if c.ascii == 63 then return dfastate_33
+               if c.ascii == 64 then return dfastate_33
+               if c.ascii == 65 then return dfastate_33
+               if c.ascii == 66 then return dfastate_33
+               if c.ascii == 67 then return dfastate_33
+               if c.ascii == 68 then return dfastate_33
+               if c.ascii == 69 then return dfastate_33
+               if c.ascii == 70 then return dfastate_33
+               if c.ascii == 71 then return dfastate_33
+               if c.ascii == 72 then return dfastate_33
+               if c.ascii == 73 then return dfastate_33
+               if c.ascii == 74 then return dfastate_33
+               if c.ascii == 75 then return dfastate_33
+               if c.ascii == 76 then return dfastate_33
+               if c.ascii == 77 then return dfastate_33
+               if c.ascii == 78 then return dfastate_33
+               if c.ascii == 79 then return dfastate_33
+               if c.ascii == 80 then return dfastate_33
+               if c.ascii == 81 then return dfastate_33
+               if c.ascii == 82 then return dfastate_33
+               if c.ascii == 83 then return dfastate_33
+               if c.ascii == 84 then return dfastate_33
+               if c.ascii == 85 then return dfastate_33
+               if c.ascii == 86 then return dfastate_33
+               if c.ascii == 87 then return dfastate_33
+               if c.ascii == 88 then return dfastate_33
+               if c.ascii == 89 then return dfastate_33
+               if c.ascii == 90 then return dfastate_33
+               if c.ascii == 91 then return dfastate_33
+               if c.ascii == 92 then return dfastate_39
+               if c.ascii == 93 then return dfastate_33
+               if c.ascii == 94 then return dfastate_33
+               if c.ascii == 95 then return dfastate_33
+               if c.ascii == 96 then return dfastate_33
+               if c.ascii == 97 then return dfastate_33
+               if c.ascii == 98 then return dfastate_33
+               if c.ascii == 99 then return dfastate_33
+               if c.ascii == 100 then return dfastate_33
+               if c.ascii == 101 then return dfastate_33
+               if c.ascii == 102 then return dfastate_33
+               if c.ascii == 103 then return dfastate_33
+               if c.ascii == 104 then return dfastate_33
+               if c.ascii == 105 then return dfastate_33
+               if c.ascii == 106 then return dfastate_33
+               if c.ascii == 107 then return dfastate_33
+               if c.ascii == 108 then return dfastate_33
+               if c.ascii == 109 then return dfastate_33
+               if c.ascii == 110 then return dfastate_33
+               if c.ascii == 111 then return dfastate_33
+               if c.ascii == 112 then return dfastate_33
+               if c.ascii == 113 then return dfastate_33
+               if c.ascii == 114 then return dfastate_33
+               if c.ascii == 115 then return dfastate_33
+               if c.ascii == 116 then return dfastate_33
+               if c.ascii == 117 then return dfastate_33
+               if c.ascii == 118 then return dfastate_33
+               if c.ascii == 119 then return dfastate_33
+               if c.ascii == 120 then return dfastate_33
+               if c.ascii == 121 then return dfastate_33
+               if c.ascii == 122 then return dfastate_33
+               if c.ascii == 123 then return dfastate_33
+               if c.ascii == 124 then return dfastate_33
+               if c.ascii == 125 then return dfastate_33
+               if c.ascii == 126 then return dfastate_33
+               return null
+       end
+end
+class DFAState43
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 113 then return dfastate_95
+               if c.ascii == 81 then return dfastate_96
+               if c.ascii == 110 then return dfastate_97
+               if c.ascii == 78 then return dfastate_98
+               return null
+       end
+end
+class DFAState44
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 113 then return dfastate_95
+               if c.ascii == 81 then return dfastate_96
+               if c.ascii == 110 then return dfastate_97
+               if c.ascii == 78 then return dfastate_98
+               return null
+       end
+end
+class DFAState45
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 117 then return dfastate_75
+               if c.ascii == 85 then return dfastate_76
+               if c.ascii == 108 then return dfastate_77
+               if c.ascii == 76 then return dfastate_78
+               if c.ascii == 121 then return dfastate_79
+               if c.ascii == 89 then return dfastate_80
+               return null
+       end
+end
+class DFAState46
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 117 then return dfastate_75
+               if c.ascii == 85 then return dfastate_76
+               if c.ascii == 108 then return dfastate_77
+               if c.ascii == 76 then return dfastate_78
+               if c.ascii == 121 then return dfastate_79
+               if c.ascii == 89 then return dfastate_80
+               return null
+       end
+end
+class DFAState47
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 111 then return dfastate_69
+               if c.ascii == 79 then return dfastate_70
+               return null
+       end
+end
+class DFAState48
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 111 then return dfastate_69
+               if c.ascii == 79 then return dfastate_70
+               return null
+       end
+end
+class DFAState49
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_51
+               if c.ascii == 68 then return dfastate_52
+               if c.ascii == 115 then return dfastate_53
+               if c.ascii == 83 then return dfastate_54
+               return null
+       end
+end
+class DFAState50
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_51
+               if c.ascii == 68 then return dfastate_52
+               if c.ascii == 115 then return dfastate_53
+               if c.ascii == 83 then return dfastate_54
+               return null
+       end
+end
+class DFAState51
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_61
+               if c.ascii == 68 then return dfastate_62
+               return null
+       end
+end
+class DFAState52
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_61
+               if c.ascii == 68 then return dfastate_62
+               return null
+       end
+end
+class DFAState53
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 99 then return dfastate_55
+               if c.ascii == 67 then return dfastate_56
+               return null
+       end
+end
+class DFAState54
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 99 then return dfastate_55
+               if c.ascii == 67 then return dfastate_56
+               return null
+       end
+end
+class DFAState55
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 105 then return dfastate_57
+               if c.ascii == 73 then return dfastate_58
+               return null
+       end
+end
+class DFAState56
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 105 then return dfastate_57
+               if c.ascii == 73 then return dfastate_58
+               return null
+       end
+end
+class DFAState57
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 105 then return dfastate_59
+               if c.ascii == 73 then return dfastate_60
+               return null
+       end
+end
+class DFAState58
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 105 then return dfastate_59
+               if c.ascii == 73 then return dfastate_60
+               return null
+       end
+end
+class DFAState59
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_ascii
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState60
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_ascii
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState61
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_63
+               if c.ascii == 82 then return dfastate_64
+               return null
+       end
+end
+class DFAState62
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_63
+               if c.ascii == 82 then return dfastate_64
+               return null
+       end
+end
+class DFAState63
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 115 then return dfastate_65
+               if c.ascii == 83 then return dfastate_66
+               return null
+       end
+end
+class DFAState64
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 115 then return dfastate_65
+               if c.ascii == 83 then return dfastate_66
+               return null
+       end
+end
+class DFAState65
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 115 then return dfastate_67
+               if c.ascii == 83 then return dfastate_68
+               return null
+       end
+end
+class DFAState66
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 115 then return dfastate_67
+               if c.ascii == 83 then return dfastate_68
+               return null
+       end
+end
+class DFAState67
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_addrss
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState68
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_addrss
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState69
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_71
+               if c.ascii == 82 then return dfastate_72
+               return null
+       end
+end
+class DFAState70
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_71
+               if c.ascii == 82 then return dfastate_72
+               return null
+       end
+end
+class DFAState71
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_73
+               if c.ascii == 68 then return dfastate_74
+               return null
+       end
+end
+class DFAState72
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_73
+               if c.ascii == 68 then return dfastate_74
+               return null
+       end
+end
+class DFAState73
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_word
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState74
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_word
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState75
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_91
+               if c.ascii == 82 then return dfastate_92
+               return null
+       end
+end
+class DFAState76
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 114 then return dfastate_91
+               if c.ascii == 82 then return dfastate_92
+               return null
+       end
+end
+class DFAState77
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 111 then return dfastate_85
+               if c.ascii == 79 then return dfastate_86
+               return null
+       end
+end
+class DFAState78
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 111 then return dfastate_85
+               if c.ascii == 79 then return dfastate_86
+               return null
+       end
+end
+class DFAState79
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 116 then return dfastate_81
+               if c.ascii == 84 then return dfastate_82
+               return null
+       end
+end
+class DFAState80
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 116 then return dfastate_81
+               if c.ascii == 84 then return dfastate_82
+               return null
+       end
+end
+class DFAState81
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 101 then return dfastate_83
+               if c.ascii == 69 then return dfastate_84
+               return null
+       end
+end
+class DFAState82
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 101 then return dfastate_83
+               if c.ascii == 69 then return dfastate_84
+               return null
+       end
+end
+class DFAState83
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_byte
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState84
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_byte
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState85
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 99 then return dfastate_87
+               if c.ascii == 67 then return dfastate_88
+               return null
+       end
+end
+class DFAState86
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 99 then return dfastate_87
+               if c.ascii == 67 then return dfastate_88
+               return null
+       end
+end
+class DFAState87
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 107 then return dfastate_89
+               if c.ascii == 75 then return dfastate_90
+               return null
+       end
+end
+class DFAState88
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 107 then return dfastate_89
+               if c.ascii == 75 then return dfastate_90
+               return null
+       end
+end
+class DFAState89
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_block
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState90
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_block
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState91
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 110 then return dfastate_93
+               if c.ascii == 78 then return dfastate_94
+               return null
+       end
+end
+class DFAState92
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 110 then return dfastate_93
+               if c.ascii == 78 then return dfastate_94
+               return null
+       end
+end
+class DFAState93
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_burn
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState94
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_burn
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState95
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 117 then return dfastate_105
+               if c.ascii == 85 then return dfastate_106
+               return null
+       end
+end
+class DFAState96
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 117 then return dfastate_105
+               if c.ascii == 85 then return dfastate_106
+               return null
+       end
+end
+class DFAState97
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_99
+               if c.ascii == 68 then return dfastate_100
+               return null
+       end
+end
+class DFAState98
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 100 then return dfastate_99
+               if c.ascii == 68 then return dfastate_100
+               return null
+       end
+end
+class DFAState99
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 13 then return dfastate_102
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState100
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 13 then return dfastate_102
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState101
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 13 then return dfastate_102
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState102
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 13 then return dfastate_102
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState103
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 13 then return dfastate_104
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState104
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Nend_block
+               t.position = position
+               t.text = text
+               return t
+       end
+       redef fun trans(c) do
+               if c.ascii == 32 then return dfastate_101
+               if c.ascii == 33 then return dfastate_101
+               if c.ascii == 34 then return dfastate_101
+               if c.ascii == 35 then return dfastate_101
+               if c.ascii == 36 then return dfastate_101
+               if c.ascii == 37 then return dfastate_101
+               if c.ascii == 38 then return dfastate_101
+               if c.ascii == 39 then return dfastate_101
+               if c.ascii == 40 then return dfastate_101
+               if c.ascii == 41 then return dfastate_101
+               if c.ascii == 42 then return dfastate_101
+               if c.ascii == 43 then return dfastate_101
+               if c.ascii == 44 then return dfastate_101
+               if c.ascii == 45 then return dfastate_101
+               if c.ascii == 46 then return dfastate_101
+               if c.ascii == 47 then return dfastate_101
+               if c.ascii == 48 then return dfastate_101
+               if c.ascii == 49 then return dfastate_101
+               if c.ascii == 50 then return dfastate_101
+               if c.ascii == 51 then return dfastate_101
+               if c.ascii == 52 then return dfastate_101
+               if c.ascii == 53 then return dfastate_101
+               if c.ascii == 54 then return dfastate_101
+               if c.ascii == 55 then return dfastate_101
+               if c.ascii == 56 then return dfastate_101
+               if c.ascii == 57 then return dfastate_101
+               if c.ascii == 58 then return dfastate_101
+               if c.ascii == 59 then return dfastate_101
+               if c.ascii == 60 then return dfastate_101
+               if c.ascii == 61 then return dfastate_101
+               if c.ascii == 62 then return dfastate_101
+               if c.ascii == 63 then return dfastate_101
+               if c.ascii == 64 then return dfastate_101
+               if c.ascii == 65 then return dfastate_101
+               if c.ascii == 66 then return dfastate_101
+               if c.ascii == 67 then return dfastate_101
+               if c.ascii == 68 then return dfastate_101
+               if c.ascii == 69 then return dfastate_101
+               if c.ascii == 70 then return dfastate_101
+               if c.ascii == 71 then return dfastate_101
+               if c.ascii == 72 then return dfastate_101
+               if c.ascii == 73 then return dfastate_101
+               if c.ascii == 74 then return dfastate_101
+               if c.ascii == 75 then return dfastate_101
+               if c.ascii == 76 then return dfastate_101
+               if c.ascii == 77 then return dfastate_101
+               if c.ascii == 78 then return dfastate_101
+               if c.ascii == 79 then return dfastate_101
+               if c.ascii == 80 then return dfastate_101
+               if c.ascii == 81 then return dfastate_101
+               if c.ascii == 82 then return dfastate_101
+               if c.ascii == 83 then return dfastate_101
+               if c.ascii == 84 then return dfastate_101
+               if c.ascii == 85 then return dfastate_101
+               if c.ascii == 86 then return dfastate_101
+               if c.ascii == 87 then return dfastate_101
+               if c.ascii == 88 then return dfastate_101
+               if c.ascii == 89 then return dfastate_101
+               if c.ascii == 90 then return dfastate_101
+               if c.ascii == 91 then return dfastate_101
+               if c.ascii == 92 then return dfastate_101
+               if c.ascii == 93 then return dfastate_101
+               if c.ascii == 94 then return dfastate_101
+               if c.ascii == 95 then return dfastate_101
+               if c.ascii == 96 then return dfastate_101
+               if c.ascii == 97 then return dfastate_101
+               if c.ascii == 98 then return dfastate_101
+               if c.ascii == 99 then return dfastate_101
+               if c.ascii == 100 then return dfastate_101
+               if c.ascii == 101 then return dfastate_101
+               if c.ascii == 102 then return dfastate_101
+               if c.ascii == 103 then return dfastate_101
+               if c.ascii == 104 then return dfastate_101
+               if c.ascii == 105 then return dfastate_101
+               if c.ascii == 106 then return dfastate_101
+               if c.ascii == 107 then return dfastate_101
+               if c.ascii == 108 then return dfastate_101
+               if c.ascii == 109 then return dfastate_101
+               if c.ascii == 110 then return dfastate_101
+               if c.ascii == 111 then return dfastate_101
+               if c.ascii == 112 then return dfastate_101
+               if c.ascii == 113 then return dfastate_101
+               if c.ascii == 114 then return dfastate_101
+               if c.ascii == 115 then return dfastate_101
+               if c.ascii == 116 then return dfastate_101
+               if c.ascii == 117 then return dfastate_101
+               if c.ascii == 118 then return dfastate_101
+               if c.ascii == 119 then return dfastate_101
+               if c.ascii == 120 then return dfastate_101
+               if c.ascii == 121 then return dfastate_101
+               if c.ascii == 122 then return dfastate_101
+               if c.ascii == 123 then return dfastate_101
+               if c.ascii == 124 then return dfastate_101
+               if c.ascii == 125 then return dfastate_101
+               if c.ascii == 126 then return dfastate_101
+               if c.ascii == 13 then return dfastate_102
+               if c.ascii == 10 then return dfastate_103
+               return null
+       end
+end
+class DFAState105
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 97 then return dfastate_107
+               if c.ascii == 65 then return dfastate_108
+               return null
+       end
+end
+class DFAState106
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 97 then return dfastate_107
+               if c.ascii == 65 then return dfastate_108
+               return null
+       end
+end
+class DFAState107
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 116 then return dfastate_109
+               if c.ascii == 84 then return dfastate_110
+               return null
+       end
+end
+class DFAState108
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 116 then return dfastate_109
+               if c.ascii == 84 then return dfastate_110
+               return null
+       end
+end
+class DFAState109
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 101 then return dfastate_111
+               if c.ascii == 69 then return dfastate_112
+               return null
+       end
+end
+class DFAState110
+       super DFAState
+       redef fun trans(c) do
+               if c.ascii == 101 then return dfastate_111
+               if c.ascii == 69 then return dfastate_112
+               return null
+       end
+end
+class DFAState111
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_equate
+               t.position = position
+               t.text = text
+               return t
+       end
+end
+class DFAState112
+       super DFAState
+       redef fun is_accept do return true
+       redef fun make_token(position, text) do
+               var t = new Ntk_equate
+               t.position = position
+               t.text = text
+               return t
+       end
+end
diff --git a/contrib/pep8analysis/src/parser/pep8_parser.nit b/contrib/pep8analysis/src/parser/pep8_parser.nit
new file mode 100644 (file)
index 0000000..1b91658
--- /dev/null
@@ -0,0 +1,1754 @@
+# Parser generated by nitcc
+import nitcc_runtime
+class MyParser
+       super Parser
+       redef fun start_state do return state_Start
+end
+redef class Object
+       private fun state_Start: LRStateStart do return once new LRStateStart
+       private fun state_listing: LRStatelisting do return once new LRStatelisting
+       private fun state_line_43d: LRStateline_43d do return once new LRStateline_43d
+       private fun state_line: LRStateline do return once new LRStateline
+       private fun state_label_decl: LRStatelabel_decl do return once new LRStatelabel_decl
+       private fun state_id: LRStateid do return once new LRStateid
+       private fun state_comment: LRStatecomment do return once new LRStatecomment
+       private fun state_eol: LRStateeol do return once new LRStateeol
+       private fun state_instruction: LRStateinstruction do return once new LRStateinstruction
+       private fun state_directive: LRStatedirective do return once new LRStatedirective
+       private fun state_tk_byte: LRStatetk_byte do return once new LRStatetk_byte
+       private fun state_tk_word: LRStatetk_word do return once new LRStatetk_word
+       private fun state_tk_block: LRStatetk_block do return once new LRStatetk_block
+       private fun state_tk_ascii: LRStatetk_ascii do return once new LRStatetk_ascii
+       private fun state_tk_addrss: LRStatetk_addrss do return once new LRStatetk_addrss
+       private fun state_tk_equate: LRStatetk_equate do return once new LRStatetk_equate
+       private fun state_tk_burn: LRStatetk_burn do return once new LRStatetk_burn
+       private fun state_end_block: LRStateend_block do return once new LRStateend_block
+       private fun state_listing_32dEof: LRStatelisting_32dEof do return once new LRStatelisting_32dEof
+       private fun state_line_43d_32dlabel_decl: LRStateline_43d_32dlabel_decl do return once new LRStateline_43d_32dlabel_decl
+       private fun state_line_43d_32dline: LRStateline_43d_32dline do return once new LRStateline_43d_32dline
+       private fun state_line_43d_32dend_block: LRStateline_43d_32dend_block do return once new LRStateline_43d_32dend_block
+       private fun state_label_decl_32dcomment: LRStatelabel_decl_32dcomment do return once new LRStatelabel_decl_32dcomment
+       private fun state_label_decl_32deol: LRStatelabel_decl_32deol do return once new LRStatelabel_decl_32deol
+       private fun state_label_decl_32dinstruction: LRStatelabel_decl_32dinstruction do return once new LRStatelabel_decl_32dinstruction
+       private fun state_label_decl_32ddirective: LRStatelabel_decl_32ddirective do return once new LRStatelabel_decl_32ddirective
+       private fun state_label_decl_32dend_block: LRStatelabel_decl_32dend_block do return once new LRStatelabel_decl_32dend_block
+       private fun state_label_decl_32did: LRStatelabel_decl_32did do return once new LRStatelabel_decl_32did
+       private fun state_id_32dcolon: LRStateid_32dcolon do return once new LRStateid_32dcolon
+       private fun state_id_32doperand: LRStateid_32doperand do return once new LRStateid_32doperand
+       private fun state_id_32dvalue: LRStateid_32dvalue do return once new LRStateid_32dvalue
+       private fun state_id_32did: LRStateid_32did do return once new LRStateid_32did
+       private fun state_id_32dchar: LRStateid_32dchar do return once new LRStateid_32dchar
+       private fun state_id_32dstring: LRStateid_32dstring do return once new LRStateid_32dstring
+       private fun state_comment_32deol: LRStatecomment_32deol do return once new LRStatecomment_32deol
+       private fun state_instruction_32dcomment: LRStateinstruction_32dcomment do return once new LRStateinstruction_32dcomment
+       private fun state_instruction_32deol: LRStateinstruction_32deol do return once new LRStateinstruction_32deol
+       private fun state_directive_32dcomment: LRStatedirective_32dcomment do return once new LRStatedirective_32dcomment
+       private fun state_directive_32deol: LRStatedirective_32deol do return once new LRStatedirective_32deol
+       private fun state_tk_byte_32dvalue: LRStatetk_byte_32dvalue do return once new LRStatetk_byte_32dvalue
+       private fun state_tk_word_32dvalue: LRStatetk_word_32dvalue do return once new LRStatetk_word_32dvalue
+       private fun state_tk_block_32dvalue: LRStatetk_block_32dvalue do return once new LRStatetk_block_32dvalue
+       private fun state_tk_ascii_32dvalue: LRStatetk_ascii_32dvalue do return once new LRStatetk_ascii_32dvalue
+       private fun state_tk_addrss_32dvalue: LRStatetk_addrss_32dvalue do return once new LRStatetk_addrss_32dvalue
+       private fun state_tk_equate_32dvalue: LRStatetk_equate_32dvalue do return once new LRStatetk_equate_32dvalue
+       private fun state_tk_burn_32dvalue: LRStatetk_burn_32dvalue do return once new LRStatetk_burn_32dvalue
+       private fun state_line_43d_32dlabel_decl_32dend_block: LRStateline_43d_32dlabel_decl_32dend_block do return once new LRStateline_43d_32dlabel_decl_32dend_block
+       private fun state_label_decl_32dcomment_32deol: LRStatelabel_decl_32dcomment_32deol do return once new LRStatelabel_decl_32dcomment_32deol
+       private fun state_label_decl_32dinstruction_32dcomment: LRStatelabel_decl_32dinstruction_32dcomment do return once new LRStatelabel_decl_32dinstruction_32dcomment
+       private fun state_label_decl_32dinstruction_32deol: LRStatelabel_decl_32dinstruction_32deol do return once new LRStatelabel_decl_32dinstruction_32deol
+       private fun state_label_decl_32ddirective_32dcomment: LRStatelabel_decl_32ddirective_32dcomment do return once new LRStatelabel_decl_32ddirective_32dcomment
+       private fun state_label_decl_32ddirective_32deol: LRStatelabel_decl_32ddirective_32deol do return once new LRStatelabel_decl_32ddirective_32deol
+       private fun state_id_32dvalue_32dcomma: LRStateid_32dvalue_32dcomma do return once new LRStateid_32dvalue_32dcomma
+       private fun state_instruction_32dcomment_32deol: LRStateinstruction_32dcomment_32deol do return once new LRStateinstruction_32dcomment_32deol
+       private fun state_directive_32dcomment_32deol: LRStatedirective_32dcomment_32deol do return once new LRStatedirective_32dcomment_32deol
+       private fun state_label_decl_32dinstruction_32dcomment_32deol: LRStatelabel_decl_32dinstruction_32dcomment_32deol do return once new LRStatelabel_decl_32dinstruction_32dcomment_32deol
+       private fun state_label_decl_32ddirective_32dcomment_32deol: LRStatelabel_decl_32ddirective_32dcomment_32deol do return once new LRStatelabel_decl_32ddirective_32dcomment_32deol
+       private fun state_id_32dvalue_32dcomma_32did: LRStateid_32dvalue_32dcomma_32did do return once new LRStateid_32dvalue_32dcomma_32did
+       private fun goto_Nlisting: Goto_Nlisting do return once new Goto_Nlisting
+       private fun goto_Nline: Goto_Nline do return once new Goto_Nline
+       private fun goto_Nlabel_decl: Goto_Nlabel_decl do return once new Goto_Nlabel_decl
+       private fun goto_Ninstruction: Goto_Ninstruction do return once new Goto_Ninstruction
+       private fun goto_Noperand: Goto_Noperand do return once new Goto_Noperand
+       private fun goto_Nvalue: Goto_Nvalue do return once new Goto_Nvalue
+       private fun goto_Ndirective: Goto_Ndirective do return once new Goto_Ndirective
+       private fun goto_Nline_43d: Goto_Nline_43d do return once new Goto_Nline_43d
+       private fun goto_N_start: Goto_N_start do return once new Goto_N_start
+end
+redef class NToken
+       # guarded action for state Start
+       # 11 shift(s) and 0 reduce(s)
+       private fun action_sStart(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state listing
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_slisting(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state line+
+       # 11 shift(s) and 0 reduce(s)
+       private fun action_sline_43d(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl
+       # 11 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state id
+       # 4 shift(s) and 1 reduce(s)
+       private fun action_sid(parser: Parser) do
+               # REDUCE instruction::instruction_unary=id
+               var n0 = parser.pop.as(Nid)
+               var p1 = new Ninstruction_unary(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ninstruction)
+       end
+       # guarded action for state comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_scomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state instruction
+       # 2 shift(s) and 0 reduce(s)
+       private fun action_sinstruction(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state directive
+       # 2 shift(s) and 0 reduce(s)
+       private fun action_sdirective(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_byte
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_byte(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_word
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_word(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_block
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_block(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_ascii
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_ascii(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_addrss
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_addrss(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_equate
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_equate(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state tk_burn
+       # 3 shift(s) and 0 reduce(s)
+       private fun action_stk_burn(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state line+ label_decl
+       # 11 shift(s) and 0 reduce(s)
+       private fun action_sline_43d_32dlabel_decl(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl_32dcomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl instruction
+       # 2 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl_32dinstruction(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl directive
+       # 2 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl_32ddirective(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl id
+       # 3 shift(s) and 1 reduce(s)
+       private fun action_slabel_decl_32did(parser: Parser) do
+               # REDUCE instruction::instruction_unary=id
+               var n0 = parser.pop.as(Nid)
+               var p1 = new Ninstruction_unary(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ninstruction)
+       end
+       # guarded action for state id value
+       # 1 shift(s) and 1 reduce(s)
+       private fun action_sid_32dvalue(parser: Parser) do
+               # REDUCE operand::operand_immediate=value
+               var n0 = parser.pop.as(Nvalue)
+               var p1 = new Noperand_immediate(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Noperand)
+       end
+       # guarded action for state instruction comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_sinstruction_32dcomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state directive comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_sdirective_32dcomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl instruction comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl_32dinstruction_32dcomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state label_decl directive comment
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_slabel_decl_32ddirective_32dcomment(parser: Parser) do
+               parser.parse_error
+       end
+       # guarded action for state id value comma
+       # 1 shift(s) and 0 reduce(s)
+       private fun action_sid_32dvalue_32dcomma(parser: Parser) do
+               parser.parse_error
+       end
+end
+class NIgnored
+       super NToken
+       redef fun node_name do return "Ignored"
+end
+class Nend_block
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_end_block)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_line_43d_32dend_block)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_label_decl_32dend_block)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_line_43d_32dlabel_decl_32dend_block)
+       end
+       redef fun node_name do return "end_block"
+end
+class Ncomment
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_comment)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_comment)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_label_decl_32dcomment)
+       end
+       redef fun action_sinstruction(parser) do
+               parser.shift(state_instruction_32dcomment)
+       end
+       redef fun action_sdirective(parser) do
+               parser.shift(state_directive_32dcomment)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_label_decl_32dcomment)
+       end
+       redef fun action_slabel_decl_32dinstruction(parser) do
+               parser.shift(state_label_decl_32dinstruction_32dcomment)
+       end
+       redef fun action_slabel_decl_32ddirective(parser) do
+               parser.shift(state_label_decl_32ddirective_32dcomment)
+       end
+       redef fun node_name do return "comment"
+end
+class Neol
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_eol)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_eol)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_label_decl_32deol)
+       end
+       redef fun action_scomment(parser) do
+               parser.shift(state_comment_32deol)
+       end
+       redef fun action_sinstruction(parser) do
+               parser.shift(state_instruction_32deol)
+       end
+       redef fun action_sdirective(parser) do
+               parser.shift(state_directive_32deol)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_label_decl_32deol)
+       end
+       redef fun action_slabel_decl_32dcomment(parser) do
+               parser.shift(state_label_decl_32dcomment_32deol)
+       end
+       redef fun action_slabel_decl_32dinstruction(parser) do
+               parser.shift(state_label_decl_32dinstruction_32deol)
+       end
+       redef fun action_slabel_decl_32ddirective(parser) do
+               parser.shift(state_label_decl_32ddirective_32deol)
+       end
+       redef fun action_sinstruction_32dcomment(parser) do
+               parser.shift(state_instruction_32dcomment_32deol)
+       end
+       redef fun action_sdirective_32dcomment(parser) do
+               parser.shift(state_directive_32dcomment_32deol)
+       end
+       redef fun action_slabel_decl_32dinstruction_32dcomment(parser) do
+               parser.shift(state_label_decl_32dinstruction_32dcomment_32deol)
+       end
+       redef fun action_slabel_decl_32ddirective_32dcomment(parser) do
+               parser.shift(state_label_decl_32ddirective_32dcomment_32deol)
+       end
+       redef fun node_name do return "eol"
+end
+class Nid
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_id)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_id)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_label_decl_32did)
+       end
+       redef fun action_sid(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_byte(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_word(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_block(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_ascii(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_addrss(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_equate(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_stk_burn(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_label_decl_32did)
+       end
+       redef fun action_slabel_decl_32did(parser) do
+               parser.shift(state_id_32did)
+       end
+       redef fun action_sid_32dvalue_32dcomma(parser) do
+               parser.shift(state_id_32dvalue_32dcomma_32did)
+       end
+       redef fun node_name do return "id"
+end
+class Ncolon
+       super NToken
+       redef fun action_sid(parser) do
+               parser.shift(state_id_32dcolon)
+       end
+       redef fun node_name do return "colon"
+end
+class Ncomma
+       super NToken
+       redef fun action_sid_32dvalue(parser) do
+               parser.shift(state_id_32dvalue_32dcomma)
+       end
+       redef fun node_name do return "comma"
+end
+class Nchar
+       super NToken
+       redef fun action_sid(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_byte(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_word(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_block(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_ascii(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_addrss(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_equate(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_stk_burn(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun action_slabel_decl_32did(parser) do
+               parser.shift(state_id_32dchar)
+       end
+       redef fun node_name do return "char"
+end
+class Nstring
+       super NToken
+       redef fun action_sid(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_byte(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_word(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_block(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_ascii(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_addrss(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_equate(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_stk_burn(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun action_slabel_decl_32did(parser) do
+               parser.shift(state_id_32dstring)
+       end
+       redef fun node_name do return "string"
+end
+class Ntk_byte
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_byte)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_byte)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_byte)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_byte)
+       end
+       redef fun node_name do return "tk_byte"
+end
+class Ntk_word
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_word)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_word)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_word)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_word)
+       end
+       redef fun node_name do return "tk_word"
+end
+class Ntk_block
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_block)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_block)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_block)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_block)
+       end
+       redef fun node_name do return "tk_block"
+end
+class Ntk_ascii
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_ascii)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_ascii)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_ascii)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_ascii)
+       end
+       redef fun node_name do return "tk_ascii"
+end
+class Ntk_addrss
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_addrss)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_addrss)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_addrss)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_addrss)
+       end
+       redef fun node_name do return "tk_addrss"
+end
+class Ntk_equate
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_equate)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_equate)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_equate)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_equate)
+       end
+       redef fun node_name do return "tk_equate"
+end
+class Ntk_burn
+       super NToken
+       redef fun action_sStart(parser) do
+               parser.shift(state_tk_burn)
+       end
+       redef fun action_sline_43d(parser) do
+               parser.shift(state_tk_burn)
+       end
+       redef fun action_slabel_decl(parser) do
+               parser.shift(state_tk_burn)
+       end
+       redef fun action_sline_43d_32dlabel_decl(parser) do
+               parser.shift(state_tk_burn)
+       end
+       redef fun node_name do return "tk_burn"
+end
+redef class NEof
+       super NToken
+       redef fun action_slisting(parser) do
+               parser.shift(state_listing_32dEof)
+       end
+       redef fun node_name do return "Eof"
+end
+redef class LRGoto
+       private fun goto_sStart(parser: Parser) do abort
+       private fun goto_sline_43d(parser: Parser) do abort
+       private fun goto_slabel_decl(parser: Parser) do abort
+       private fun goto_sid(parser: Parser) do abort
+       private fun goto_sline_43d_32dlabel_decl(parser: Parser) do abort
+       private fun goto_slabel_decl_32did(parser: Parser) do abort
+end
+class Goto_Nlisting
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_listing)
+       end
+end
+class Goto_Nline
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_line)
+       end
+       redef fun goto_sline_43d(parser) do
+               parser.push(state_line_43d_32dline)
+       end
+end
+class Goto_Nlabel_decl
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_label_decl)
+       end
+       redef fun goto_sline_43d(parser) do
+               parser.push(state_line_43d_32dlabel_decl)
+       end
+end
+class Goto_Ninstruction
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_instruction)
+       end
+       redef fun goto_sline_43d(parser) do
+               parser.push(state_instruction)
+       end
+       redef fun goto_slabel_decl(parser) do
+               parser.push(state_label_decl_32dinstruction)
+       end
+       redef fun goto_sline_43d_32dlabel_decl(parser) do
+               parser.push(state_label_decl_32dinstruction)
+       end
+end
+class Goto_Noperand
+       super LRGoto
+       redef fun goto_sid(parser) do
+               parser.push(state_id_32doperand)
+       end
+       redef fun goto_slabel_decl_32did(parser) do
+               parser.push(state_id_32doperand)
+       end
+end
+class Goto_Nvalue
+       super LRGoto
+       redef fun goto_sid(parser) do
+               parser.push(state_id_32dvalue)
+       end
+       redef fun goto_slabel_decl_32did(parser) do
+               parser.push(state_id_32dvalue)
+       end
+end
+class Goto_Ndirective
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_directive)
+       end
+       redef fun goto_sline_43d(parser) do
+               parser.push(state_directive)
+       end
+       redef fun goto_slabel_decl(parser) do
+               parser.push(state_label_decl_32ddirective)
+       end
+       redef fun goto_sline_43d_32dlabel_decl(parser) do
+               parser.push(state_label_decl_32ddirective)
+       end
+end
+class Goto_Nline_43d
+       super LRGoto
+       redef fun goto_sStart(parser) do
+               parser.push(state_line_43d)
+       end
+end
+class Goto_N_start
+       super LRGoto
+end
+class Nlisting
+       super NProd
+       redef fun node_name do return "listing"
+       var n_lines: nullable Nodes[Nline]
+       var n_label_decl: nullable Nlabel_decl
+       var n_end_block: Nend_block
+       init(n_lines: nullable Nodes[Nline], n_label_decl: nullable Nlabel_decl, n_end_block: Nend_block) do
+               self.n_lines = n_lines
+               self.n_label_decl = n_label_decl
+               self.n_end_block = n_end_block
+       end
+       redef fun number_of_children do return 3
+       redef fun child(i) do
+               if i == 0 then return n_lines
+               if i == 1 then return n_label_decl
+               if i == 2 then return n_end_block
+               abort
+       end
+end
+class Nline
+       super NProd
+       redef fun node_name do return "line"
+end
+class Nline_empty
+       super Nline
+       redef fun node_name do return "line_empty"
+       var n_label_decl: nullable Nlabel_decl
+       var n_comment: nullable Ncomment
+       var n_eol: Neol
+       init(n_label_decl: nullable Nlabel_decl, n_comment: nullable Ncomment, n_eol: Neol) do
+               self.n_label_decl = n_label_decl
+               self.n_comment = n_comment
+               self.n_eol = n_eol
+       end
+       redef fun number_of_children do return 3
+       redef fun child(i) do
+               if i == 0 then return n_label_decl
+               if i == 1 then return n_comment
+               if i == 2 then return n_eol
+               abort
+       end
+end
+class Nline_instruction
+       super Nline
+       redef fun node_name do return "line_instruction"
+       var n_label_decl: nullable Nlabel_decl
+       var n_instruction: Ninstruction
+       var n_comment: nullable Ncomment
+       var n_eol: Neol
+       init(n_label_decl: nullable Nlabel_decl, n_instruction: Ninstruction, n_comment: nullable Ncomment, n_eol: Neol) do
+               self.n_label_decl = n_label_decl
+               self.n_instruction = n_instruction
+               self.n_comment = n_comment
+               self.n_eol = n_eol
+       end
+       redef fun number_of_children do return 4
+       redef fun child(i) do
+               if i == 0 then return n_label_decl
+               if i == 1 then return n_instruction
+               if i == 2 then return n_comment
+               if i == 3 then return n_eol
+               abort
+       end
+end
+class Nline_directive
+       super Nline
+       redef fun node_name do return "line_directive"
+       var n_label_decl: nullable Nlabel_decl
+       var n_directive: Ndirective
+       var n_comment: nullable Ncomment
+       var n_eol: Neol
+       init(n_label_decl: nullable Nlabel_decl, n_directive: Ndirective, n_comment: nullable Ncomment, n_eol: Neol) do
+               self.n_label_decl = n_label_decl
+               self.n_directive = n_directive
+               self.n_comment = n_comment
+               self.n_eol = n_eol
+       end
+       redef fun number_of_children do return 4
+       redef fun child(i) do
+               if i == 0 then return n_label_decl
+               if i == 1 then return n_directive
+               if i == 2 then return n_comment
+               if i == 3 then return n_eol
+               abort
+       end
+end
+class Nlabel_decl
+       super NProd
+       redef fun node_name do return "label_decl"
+       var n_id: Nid
+       var n_colon: Ncolon
+       init(n_id: Nid, n_colon: Ncolon) do
+               self.n_id = n_id
+               self.n_colon = n_colon
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_id
+               if i == 1 then return n_colon
+               abort
+       end
+end
+class Ninstruction
+       super NProd
+       redef fun node_name do return "instruction"
+end
+class Ninstruction_unary
+       super Ninstruction
+       redef fun node_name do return "instruction_unary"
+       var n_id: Nid
+       init(n_id: Nid) do
+               self.n_id = n_id
+       end
+       redef fun number_of_children do return 1
+       redef fun child(i) do
+               if i == 0 then return n_id
+               abort
+       end
+end
+class Ninstruction_binary
+       super Ninstruction
+       redef fun node_name do return "instruction_binary"
+       var n_id: Nid
+       var n_operand: Noperand
+       init(n_id: Nid, n_operand: Noperand) do
+               self.n_id = n_id
+               self.n_operand = n_operand
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_id
+               if i == 1 then return n_operand
+               abort
+       end
+end
+class Noperand
+       super NProd
+       redef fun node_name do return "operand"
+end
+class Noperand_immediate
+       super Noperand
+       redef fun node_name do return "operand_immediate"
+       var n_value: Nvalue
+       init(n_value: Nvalue) do
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 1
+       redef fun child(i) do
+               if i == 0 then return n_value
+               abort
+       end
+end
+class Noperand_any
+       super Noperand
+       redef fun node_name do return "operand_any"
+       var n_value: Nvalue
+       var n_comma: Ncomma
+       var n_id: Nid
+       init(n_value: Nvalue, n_comma: Ncomma, n_id: Nid) do
+               self.n_value = n_value
+               self.n_comma = n_comma
+               self.n_id = n_id
+       end
+       redef fun number_of_children do return 3
+       redef fun child(i) do
+               if i == 0 then return n_value
+               if i == 1 then return n_comma
+               if i == 2 then return n_id
+               abort
+       end
+end
+class Nvalue
+       super NProd
+       redef fun node_name do return "value"
+end
+class Nvalue_label
+       super Nvalue
+       redef fun node_name do return "value_label"
+       var n_id: Nid
+       init(n_id: Nid) do
+               self.n_id = n_id
+       end
+       redef fun number_of_children do return 1
+       redef fun child(i) do
+               if i == 0 then return n_id
+               abort
+       end
+end
+class Nvalue_char
+       super Nvalue
+       redef fun node_name do return "value_char"
+       var n_char: Nchar
+       init(n_char: Nchar) do
+               self.n_char = n_char
+       end
+       redef fun number_of_children do return 1
+       redef fun child(i) do
+               if i == 0 then return n_char
+               abort
+       end
+end
+class Nvalue_string
+       super Nvalue
+       redef fun node_name do return "value_string"
+       var n_string: Nstring
+       init(n_string: Nstring) do
+               self.n_string = n_string
+       end
+       redef fun number_of_children do return 1
+       redef fun child(i) do
+               if i == 0 then return n_string
+               abort
+       end
+end
+class Ndirective
+       super NProd
+       redef fun node_name do return "directive"
+end
+class Ndirective_byte
+       super Ndirective
+       redef fun node_name do return "directive_byte"
+       var n_tk_byte: Ntk_byte
+       var n_value: Nvalue
+       init(n_tk_byte: Ntk_byte, n_value: Nvalue) do
+               self.n_tk_byte = n_tk_byte
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_byte
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_word
+       super Ndirective
+       redef fun node_name do return "directive_word"
+       var n_tk_word: Ntk_word
+       var n_value: Nvalue
+       init(n_tk_word: Ntk_word, n_value: Nvalue) do
+               self.n_tk_word = n_tk_word
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_word
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_block
+       super Ndirective
+       redef fun node_name do return "directive_block"
+       var n_tk_block: Ntk_block
+       var n_value: Nvalue
+       init(n_tk_block: Ntk_block, n_value: Nvalue) do
+               self.n_tk_block = n_tk_block
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_block
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_ascii
+       super Ndirective
+       redef fun node_name do return "directive_ascii"
+       var n_tk_ascii: Ntk_ascii
+       var n_value: Nvalue
+       init(n_tk_ascii: Ntk_ascii, n_value: Nvalue) do
+               self.n_tk_ascii = n_tk_ascii
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_ascii
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_addrss
+       super Ndirective
+       redef fun node_name do return "directive_addrss"
+       var n_tk_addrss: Ntk_addrss
+       var n_value: Nvalue
+       init(n_tk_addrss: Ntk_addrss, n_value: Nvalue) do
+               self.n_tk_addrss = n_tk_addrss
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_addrss
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_equate
+       super Ndirective
+       redef fun node_name do return "directive_equate"
+       var n_tk_equate: Ntk_equate
+       var n_value: Nvalue
+       init(n_tk_equate: Ntk_equate, n_value: Nvalue) do
+               self.n_tk_equate = n_tk_equate
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_equate
+               if i == 1 then return n_value
+               abort
+       end
+end
+class Ndirective_burn
+       super Ndirective
+       redef fun node_name do return "directive_burn"
+       var n_tk_burn: Ntk_burn
+       var n_value: Nvalue
+       init(n_tk_burn: Ntk_burn, n_value: Nvalue) do
+               self.n_tk_burn = n_tk_burn
+               self.n_value = n_value
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_tk_burn
+               if i == 1 then return n_value
+               abort
+       end
+end
+class N_start
+       super NProd
+       redef fun node_name do return "_start"
+end
+class NStart
+       super N_start
+       redef fun node_name do return "Start"
+       var n_0: Nlisting
+       var n_1: NEof
+       init(n_0: Nlisting, n_1: NEof) do
+               self.n_0 = n_0
+               self.n_1 = n_1
+       end
+       redef fun number_of_children do return 2
+       redef fun child(i) do
+               if i == 0 then return n_0
+               if i == 1 then return n_1
+               abort
+       end
+end
+# State Start
+private class LRStateStart
+       super LRState
+       redef fun to_s do return "Start"
+       redef fun error_msg do return "listing, line+, line, label_decl, instruction, directive"
+       redef fun action(parser) do
+               parser.peek_token.action_sStart(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_sStart(parser)
+       end
+end
+# State listing
+private class LRStatelisting
+       super LRState
+       redef fun to_s do return "listing"
+       redef fun error_msg do return "Eof"
+       redef fun action(parser) do
+               parser.peek_token.action_slisting(parser)
+       end
+end
+# State line+
+private class LRStateline_43d
+       super LRState
+       redef fun to_s do return "line+"
+       redef fun error_msg do return "label_decl, line, instruction, directive"
+       redef fun action(parser) do
+               parser.peek_token.action_sline_43d(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_sline_43d(parser)
+       end
+end
+# State line
+private class LRStateline
+       super LRState
+       redef fun to_s do return "line"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line+::line+_one=line
+               var n0 = parser.pop.as(Nline)
+               var prod = new Nodes[Nline]
+               prod.items.add(n0)
+               parser.node_stack.push prod
+               parser.goto(goto_Nline_43d)
+       end
+end
+# State label_decl
+private class LRStatelabel_decl
+       super LRState
+       redef fun to_s do return "label_decl"
+       redef fun error_msg do return "instruction, directive"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_slabel_decl(parser)
+       end
+end
+# State id
+private class LRStateid
+       super LRState
+       redef fun to_s do return "id"
+       redef fun error_msg do return "operand, value"
+       redef fun action(parser) do
+               parser.peek_token.action_sid(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_sid(parser)
+       end
+end
+# State comment
+private class LRStatecomment
+       super LRState
+       redef fun to_s do return "comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_scomment(parser)
+       end
+end
+# State eol
+private class LRStateeol
+       super LRState
+       redef fun to_s do return "eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_empty_3=eol
+               var n0 = parser.pop.as(Neol)
+               var p1 = new Nline_empty(null, null, n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State instruction
+private class LRStateinstruction
+       super LRState
+       redef fun to_s do return "instruction"
+       redef fun error_msg do return "comment, eol"
+       redef fun action(parser) do
+               parser.peek_token.action_sinstruction(parser)
+       end
+end
+# State directive
+private class LRStatedirective
+       super LRState
+       redef fun to_s do return "directive"
+       redef fun error_msg do return "comment, eol"
+       redef fun action(parser) do
+               parser.peek_token.action_sdirective(parser)
+       end
+end
+# State tk_byte
+private class LRStatetk_byte
+       super LRState
+       redef fun to_s do return "tk_byte"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_byte(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_byte_32dvalue)
+       end
+end
+# State tk_word
+private class LRStatetk_word
+       super LRState
+       redef fun to_s do return "tk_word"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_word(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_word_32dvalue)
+       end
+end
+# State tk_block
+private class LRStatetk_block
+       super LRState
+       redef fun to_s do return "tk_block"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_block(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_block_32dvalue)
+       end
+end
+# State tk_ascii
+private class LRStatetk_ascii
+       super LRState
+       redef fun to_s do return "tk_ascii"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_ascii(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_ascii_32dvalue)
+       end
+end
+# State tk_addrss
+private class LRStatetk_addrss
+       super LRState
+       redef fun to_s do return "tk_addrss"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_addrss(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_addrss_32dvalue)
+       end
+end
+# State tk_equate
+private class LRStatetk_equate
+       super LRState
+       redef fun to_s do return "tk_equate"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_equate(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_equate_32dvalue)
+       end
+end
+# State tk_burn
+private class LRStatetk_burn
+       super LRState
+       redef fun to_s do return "tk_burn"
+       redef fun error_msg do return "value"
+       redef fun action(parser) do
+               parser.peek_token.action_stk_burn(parser)
+       end
+       redef fun goto(parser, goto) do
+               parser.push(state_tk_burn_32dvalue)
+       end
+end
+# State end_block
+private class LRStateend_block
+       super LRState
+       redef fun to_s do return "end_block"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE listing::listing_3=end_block
+               var n0 = parser.pop.as(Nend_block)
+               var p1 = new Nlisting(null, null, n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nlisting)
+       end
+end
+# State listing Eof
+private class LRStatelisting_32dEof
+       super LRState
+       redef fun to_s do return "listing Eof"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE _start::Start=listing Eof
+               var n1 = parser.pop.as(NEof)
+               var n0 = parser.pop.as(Nlisting)
+               var p1 = new NStart(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.stop = true
+       end
+end
+# State line+ label_decl
+private class LRStateline_43d_32dlabel_decl
+       super LRState
+       redef fun to_s do return "line+ label_decl"
+       redef fun error_msg do return "instruction, directive"
+       redef fun action(parser) do
+               parser.peek_token.action_sline_43d_32dlabel_decl(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_sline_43d_32dlabel_decl(parser)
+       end
+end
+# State line+ line
+private class LRStateline_43d_32dline
+       super LRState
+       redef fun to_s do return "line+ line"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line+::line+_more=line+ line
+               var n1 = parser.pop.as(Nline)
+               var n0 = parser.pop.as(Nodes[Nline])
+               var prod = n0
+               n0.items.add(n1)
+               parser.node_stack.push prod
+               parser.goto(goto_Nline_43d)
+       end
+end
+# State line+ end_block
+private class LRStateline_43d_32dend_block
+       super LRState
+       redef fun to_s do return "line+ end_block"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE listing::listing_2=line+ end_block
+               var n1 = parser.pop.as(Nend_block)
+               var n0 = parser.pop.as(Nodes[Nline])
+               var p1 = new Nlisting(n0, null, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nlisting)
+       end
+end
+# State label_decl comment
+private class LRStatelabel_decl_32dcomment
+       super LRState
+       redef fun to_s do return "label_decl comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32dcomment(parser)
+       end
+end
+# State label_decl eol
+private class LRStatelabel_decl_32deol
+       super LRState
+       redef fun to_s do return "label_decl eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_empty_2=label_decl eol
+               var n1 = parser.pop.as(Neol)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_empty(n0, null, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State label_decl instruction
+private class LRStatelabel_decl_32dinstruction
+       super LRState
+       redef fun to_s do return "label_decl instruction"
+       redef fun error_msg do return "comment, eol"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32dinstruction(parser)
+       end
+end
+# State label_decl directive
+private class LRStatelabel_decl_32ddirective
+       super LRState
+       redef fun to_s do return "label_decl directive"
+       redef fun error_msg do return "comment, eol"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32ddirective(parser)
+       end
+end
+# State label_decl end_block
+private class LRStatelabel_decl_32dend_block
+       super LRState
+       redef fun to_s do return "label_decl end_block"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE listing::listing_1=label_decl end_block
+               var n1 = parser.pop.as(Nend_block)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nlisting(null, n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nlisting)
+       end
+end
+# State label_decl id
+private class LRStatelabel_decl_32did
+       super LRState
+       redef fun to_s do return "label_decl id"
+       redef fun error_msg do return "operand, value"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32did(parser)
+       end
+       redef fun goto(parser, goto) do
+               goto.goto_slabel_decl_32did(parser)
+       end
+end
+# State id colon
+private class LRStateid_32dcolon
+       super LRState
+       redef fun to_s do return "id colon"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE label_decl::label_decl=id colon
+               var n1 = parser.pop.as(Ncolon)
+               var n0 = parser.pop.as(Nid)
+               var p1 = new Nlabel_decl(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nlabel_decl)
+       end
+end
+# State id operand
+private class LRStateid_32doperand
+       super LRState
+       redef fun to_s do return "id operand"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE instruction::instruction_binary=id operand
+               var n1 = parser.pop.as(Noperand)
+               var n0 = parser.pop.as(Nid)
+               var p1 = new Ninstruction_binary(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ninstruction)
+       end
+end
+# State id value
+private class LRStateid_32dvalue
+       super LRState
+       redef fun to_s do return "id value"
+       redef fun error_msg do return "comma"
+       redef fun action(parser) do
+               parser.peek_token.action_sid_32dvalue(parser)
+       end
+end
+# State id id
+private class LRStateid_32did
+       super LRState
+       redef fun to_s do return "id id"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE value::value_label=id
+               var n0 = parser.pop.as(Nid)
+               var p1 = new Nvalue_label(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nvalue)
+       end
+end
+# State id char
+private class LRStateid_32dchar
+       super LRState
+       redef fun to_s do return "id char"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE value::value_char=char
+               var n0 = parser.pop.as(Nchar)
+               var p1 = new Nvalue_char(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nvalue)
+       end
+end
+# State id string
+private class LRStateid_32dstring
+       super LRState
+       redef fun to_s do return "id string"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE value::value_string=string
+               var n0 = parser.pop.as(Nstring)
+               var p1 = new Nvalue_string(n0)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nvalue)
+       end
+end
+# State comment eol
+private class LRStatecomment_32deol
+       super LRState
+       redef fun to_s do return "comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_empty_1=comment eol
+               var n1 = parser.pop.as(Neol)
+               var n0 = parser.pop.as(Ncomment)
+               var p1 = new Nline_empty(null, n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State instruction comment
+private class LRStateinstruction_32dcomment
+       super LRState
+       redef fun to_s do return "instruction comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_sinstruction_32dcomment(parser)
+       end
+end
+# State instruction eol
+private class LRStateinstruction_32deol
+       super LRState
+       redef fun to_s do return "instruction eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_instruction_3=instruction eol
+               var n1 = parser.pop.as(Neol)
+               var n0 = parser.pop.as(Ninstruction)
+               var p1 = new Nline_instruction(null, n0, null, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State directive comment
+private class LRStatedirective_32dcomment
+       super LRState
+       redef fun to_s do return "directive comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_sdirective_32dcomment(parser)
+       end
+end
+# State directive eol
+private class LRStatedirective_32deol
+       super LRState
+       redef fun to_s do return "directive eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_directive_3=directive eol
+               var n1 = parser.pop.as(Neol)
+               var n0 = parser.pop.as(Ndirective)
+               var p1 = new Nline_directive(null, n0, null, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State tk_byte value
+private class LRStatetk_byte_32dvalue
+       super LRState
+       redef fun to_s do return "tk_byte value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_byte=tk_byte value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_byte)
+               var p1 = new Ndirective_byte(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_word value
+private class LRStatetk_word_32dvalue
+       super LRState
+       redef fun to_s do return "tk_word value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_word=tk_word value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_word)
+               var p1 = new Ndirective_word(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_block value
+private class LRStatetk_block_32dvalue
+       super LRState
+       redef fun to_s do return "tk_block value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_block=tk_block value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_block)
+               var p1 = new Ndirective_block(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_ascii value
+private class LRStatetk_ascii_32dvalue
+       super LRState
+       redef fun to_s do return "tk_ascii value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_ascii=tk_ascii value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_ascii)
+               var p1 = new Ndirective_ascii(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_addrss value
+private class LRStatetk_addrss_32dvalue
+       super LRState
+       redef fun to_s do return "tk_addrss value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_addrss=tk_addrss value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_addrss)
+               var p1 = new Ndirective_addrss(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_equate value
+private class LRStatetk_equate_32dvalue
+       super LRState
+       redef fun to_s do return "tk_equate value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_equate=tk_equate value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_equate)
+               var p1 = new Ndirective_equate(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State tk_burn value
+private class LRStatetk_burn_32dvalue
+       super LRState
+       redef fun to_s do return "tk_burn value"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE directive::directive_burn=tk_burn value
+               var n1 = parser.pop.as(Nvalue)
+               var n0 = parser.pop.as(Ntk_burn)
+               var p1 = new Ndirective_burn(n0, n1)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Ndirective)
+       end
+end
+# State line+ label_decl end_block
+private class LRStateline_43d_32dlabel_decl_32dend_block
+       super LRState
+       redef fun to_s do return "line+ label_decl end_block"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE listing::listing_0=line+ label_decl end_block
+               var n2 = parser.pop.as(Nend_block)
+               var n1 = parser.pop.as(Nlabel_decl)
+               var n0 = parser.pop.as(Nodes[Nline])
+               var p1 = new Nlisting(n0, n1, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nlisting)
+       end
+end
+# State label_decl comment eol
+private class LRStatelabel_decl_32dcomment_32deol
+       super LRState
+       redef fun to_s do return "label_decl comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_empty_0=label_decl comment eol
+               var n2 = parser.pop.as(Neol)
+               var n1 = parser.pop.as(Ncomment)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_empty(n0, n1, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State label_decl instruction comment
+private class LRStatelabel_decl_32dinstruction_32dcomment
+       super LRState
+       redef fun to_s do return "label_decl instruction comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32dinstruction_32dcomment(parser)
+       end
+end
+# State label_decl instruction eol
+private class LRStatelabel_decl_32dinstruction_32deol
+       super LRState
+       redef fun to_s do return "label_decl instruction eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_instruction_2=label_decl instruction eol
+               var n2 = parser.pop.as(Neol)
+               var n1 = parser.pop.as(Ninstruction)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_instruction(n0, n1, null, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State label_decl directive comment
+private class LRStatelabel_decl_32ddirective_32dcomment
+       super LRState
+       redef fun to_s do return "label_decl directive comment"
+       redef fun error_msg do return "eol"
+       redef fun action(parser) do
+               parser.peek_token.action_slabel_decl_32ddirective_32dcomment(parser)
+       end
+end
+# State label_decl directive eol
+private class LRStatelabel_decl_32ddirective_32deol
+       super LRState
+       redef fun to_s do return "label_decl directive eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_directive_2=label_decl directive eol
+               var n2 = parser.pop.as(Neol)
+               var n1 = parser.pop.as(Ndirective)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_directive(n0, n1, null, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State id value comma
+private class LRStateid_32dvalue_32dcomma
+       super LRState
+       redef fun to_s do return "id value comma"
+       redef fun error_msg do return "id"
+       redef fun action(parser) do
+               parser.peek_token.action_sid_32dvalue_32dcomma(parser)
+       end
+end
+# State instruction comment eol
+private class LRStateinstruction_32dcomment_32deol
+       super LRState
+       redef fun to_s do return "instruction comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_instruction_1=instruction comment eol
+               var n2 = parser.pop.as(Neol)
+               var n1 = parser.pop.as(Ncomment)
+               var n0 = parser.pop.as(Ninstruction)
+               var p1 = new Nline_instruction(null, n0, n1, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State directive comment eol
+private class LRStatedirective_32dcomment_32deol
+       super LRState
+       redef fun to_s do return "directive comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_directive_1=directive comment eol
+               var n2 = parser.pop.as(Neol)
+               var n1 = parser.pop.as(Ncomment)
+               var n0 = parser.pop.as(Ndirective)
+               var p1 = new Nline_directive(null, n0, n1, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State label_decl instruction comment eol
+private class LRStatelabel_decl_32dinstruction_32dcomment_32deol
+       super LRState
+       redef fun to_s do return "label_decl instruction comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_instruction_0=label_decl instruction comment eol
+               var n3 = parser.pop.as(Neol)
+               var n2 = parser.pop.as(Ncomment)
+               var n1 = parser.pop.as(Ninstruction)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_instruction(n0, n1, n2, n3)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State label_decl directive comment eol
+private class LRStatelabel_decl_32ddirective_32dcomment_32deol
+       super LRState
+       redef fun to_s do return "label_decl directive comment eol"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE line::line_directive_0=label_decl directive comment eol
+               var n3 = parser.pop.as(Neol)
+               var n2 = parser.pop.as(Ncomment)
+               var n1 = parser.pop.as(Ndirective)
+               var n0 = parser.pop.as(Nlabel_decl)
+               var p1 = new Nline_directive(n0, n1, n2, n3)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Nline)
+       end
+end
+# State id value comma id
+private class LRStateid_32dvalue_32dcomma_32did
+       super LRState
+       redef fun to_s do return "id value comma id"
+       redef fun error_msg do return ""
+       redef fun action(parser) do
+               # REDUCE operand::operand_any=value comma id
+               var n2 = parser.pop.as(Nid)
+               var n1 = parser.pop.as(Ncomma)
+               var n0 = parser.pop.as(Nvalue)
+               var p1 = new Noperand_any(n0, n1, n2)
+               var prod = p1
+               parser.node_stack.push prod
+               parser.goto(goto_Noperand)
+       end
+end
diff --git a/contrib/pep8analysis/src/parser/pep8_test_parser.nit b/contrib/pep8analysis/src/parser/pep8_test_parser.nit
new file mode 100644 (file)
index 0000000..9f015d0
--- /dev/null
@@ -0,0 +1,12 @@
+# Generated by nitcc for the language pep8
+import nitcc_runtime
+import pep8_lexer
+import pep8_parser
+class MyTest
+       super TestParser
+       redef fun name do return "pep8"
+       redef fun new_lexer(text) do return new MyLexer(text)
+       redef fun new_parser do return new MyParser
+end
+var t = new MyTest
+t.main
diff --git a/contrib/pep8analysis/src/parser/prescc.pl b/contrib/pep8analysis/src/parser/prescc.pl
new file mode 100755 (executable)
index 0000000..debd2f8
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/perl -w
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.org>
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
+#
+# 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.
+
+# prescc, a Sablecc preprocessor.
+#
+# Synopsis
+#
+#   Extends a sablecc grammar with parametrized productions and other syntactic stuff.
+#
+# Description
+#
+#   A production named foo~bar~baz semantically correspond to a production foo with two boolean parameters bar and baz
+#   In fact foo is a family of 4 distinct productions: foo, foo_bar, foo_baz and foo_bar_baz
+#   In a parametrized production with a parameter ~xxx:
+#    * parameters (~xxx) are substituted with _xxx if the parameter is true and removed if the parameter is false
+#    * guarded alternatives (!xxx) are disabled if the parameter is true
+#
+# Limitations
+#
+#   prescc is badly implemented in perl and is not robust.
+#   Users must remember the following:
+#    * parametrized productions MUST be terminated with a line containing only a single semicolon (;)
+#    * parameters (~) and guards (!) in alternatives MUST correspond to a parameter of the enclosing production
+#    * if required, names in transformations MUST contain the full invocation name (with all parameters)
+#        foo bar_x~y~z_t baz {-> New p(foo, bar_x~y~z_t.q)}
+#    * guards do not understand grammar, they just remove the whole line
+#    * The AST MUST start with a line containing only "Abstract Syntax Tree"
+#
+# Example of the dangling else implementation:
+#
+#   stmt~withelse =
+#                'if' expr 'then' stmt_withelse 'else' stmt~withelse |
+#     !withelse  'if' expr 'then' stmt |
+#                nop
+#                ;
+
+while (<>) {
+       push @lines, $_;
+}
+$lines = join "", @lines;
+
+$current = "";
+for (@lines) {
+       if (/^.*{\s*->\s*(\w+)\s*}/) {
+               $current = $1;
+       }
+       $current = "" if /;/;
+       next if ($current eq "");
+       if (s/{\:(\w+)}/{$1}/) {
+               $alt = $1;
+               @newargs = ();
+               while (/((\[(\w*)\])?:)?([\w~]+)(})?/g) {
+                       $id=defined $3?$3:$4;
+                       next if ((defined $1) && !(defined $3));
+                       next if (defined $5);
+                       $4 =~ /([a-z]+)/;
+                       $argalt = $1;
+                       if ($id eq $argalt) {
+                               push @newargs, "$id";
+                       } else {
+                               push @newargs, "$id.$argalt";
+                       }
+               }
+               chomp;
+               $_ .= " {-> New $current.$alt(". join(", ", @newargs) .")}\n";
+               s/([^\]])\:(\w+)/$1$2/g;
+       }
+}
+
+# List all the available parameters in the extended grammar
+@params = ();
+while ($lines =~ /\~([a-zA-Z]+)/g) {
+       if (!$found{$1}) {
+               push @params, $1;
+               $found{$1}=1;
+       }
+}
+
+$ast = "Abstract Syntax Tree";
+@res = ();
+for $token (@params) {
+       print STDERR "Parameter ~$token\n";
+       #push @res, "//Start part $token\n";
+# first, sed starts from first line to the AST line and removes ~xxx and !xxx
+       for $l (@lines) {
+               $_ = $l;
+               last if (/^$ast/);
+               s/[~!]$token//g;
+               push @res, $_;
+       }
+       #push @res, "//Generated part $token\n";
+       # second, sed clones ~xxx parametrized productions, substitute ~xxx with _xxx and delete !xxx lines
+       $into = 0;
+       for $l (@lines) {
+               $_ = $l;
+               $into = 1 if (/~$token/);
+               next if (!$into);
+               s/~$token/_$token/g;
+               next if /!$token/;
+               push @res, $_;
+               $into = 0 if (/;/);
+       }
+       #push @res, "//End of generated part $token\n";
+
+       # third, sed continues fron AST line to last line and remove ~xxx and !xxx
+       $into = 0;
+       for (@lines) {
+               $into = 1 if (/^$ast/);
+               next if (!$into);
+               push @res, $_;
+       }
+       #push @res, "//End part $token\n";
+       @lines = @res;
+       @res = ();
+}
+print "/* This file is autogenerated, do not modify it */";
+print (join "", @lines);
diff --git a/contrib/pep8analysis/src/parser/prescc.sh b/contrib/pep8analysis/src/parser/prescc.sh
new file mode 100755 (executable)
index 0000000..e5ab277
--- /dev/null
@@ -0,0 +1,94 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.org>
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
+#
+# 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.
+
+# prescc, a Sablecc preprocessor.
+#
+# Synopsis
+#
+#   Extends a sablecc grammar with parametrized productions.
+#
+# Description
+#
+#   A production named foo~bar~baz semantically correspond to a production foo with two boolean parameters bar and baz
+#   In fact foo is a family of 4 distinct productions: foo, foo_bar, foo_baz and foo_bar_baz
+#   In a parametrized production with a parameter ~xxx:
+#    * parameters (~xxx) are substituted with _xxx if the parameter is true and removed if the parameter is false
+#    * guarded alternatives (!xxx) are disabled if the parameter is true
+#
+# Limitations
+#
+#   prescc is badly implemented with shell, sed and perl and is not robust.
+#   Users must remember the following:
+#    * parametrized productions MUST be terminated with a line containing only a single semicolon (;)
+#    * parameters (~) and guards (!) in alternatives MUST correspond to a parameter of the enclosing production
+#    * if required, names in transformations MUST contain the full invocation name (with all parameters)
+#        foo bar_x~y~z_t baz {-> New p(foo, bar_x~y~z_t.q)}
+#    * guards do not understand grammar, they just remove the whole line
+#    * The AST MUST start with a line containing only "Abstract Syntax Tree"
+#
+# Example of the dangling else implementation:
+#
+#   stmt~withelse =
+#                'if' expr 'then' stmt_withelse 'else' stmt~withelse |
+#     !withelse  'if' expr 'then' stmt |
+#                nop
+#                ;
+
+
+case $# in
+       2);;
+       *) echo "Usage: prescc infile outfile"; exit
+esac
+
+
+infile=$1
+outfile=$2
+tmpfile=`mktemp "$2.XXXXXX"`
+
+printf "/* This file is autogenerated, do not modify it */" > "$outfile"
+cat "$infile" >> "$outfile"
+
+# The perl code is used to list all the available parameters in the extended grammar
+for token in `perl -ne 'while (/\~([a-zA-Z]+)/g) {if (!$found{$1}) {print "$1\n"; $found{$1}=1}}' "$infile"`
+do
+       echo "Parameter ~$token"
+       # first, sed starts from first line to the AST line and removes ~xxx and !xxx
+       sed -n -e "
+               1,/^Abstract Syntax Tree/{
+                       /^Abstract Syntax Tree/b
+                       s/[\~!]$token//g
+                       p
+               }
+       " "$outfile" > "$tmpfile"
+       # second, sed clones ~xxx parametrized productions, substitute ~xxx with _xxx and delete !xxx lines
+       sed -n -e "
+               /\~$token/,/;/{
+                       s/\~$token/_$token/g
+                       /!$token/d
+                       p
+               }
+       " "$outfile" >> "$tmpfile"
+       # third, sed continues fron AST line to last line and remove ~xxx and !xxx
+       sed -n -e "
+               /^Abstract Syntax Tree/,\${
+                       s/[\~!]$token//g
+                       p
+               }
+       " "$outfile" >> "$tmpfile"
+       mv "$tmpfile" "$outfile"
+done
+
diff --git a/contrib/pep8analysis/src/parser/tables.nit b/contrib/pep8analysis/src/parser/tables.nit
new file mode 100644 (file)
index 0000000..54b7b59
--- /dev/null
@@ -0,0 +1,34 @@
+# 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.
+
+# Module that interfaces the parsing tables.
+module tables
+
+# Interface allowing the acces of the tables used during the parsing.
+interface TablesCapable
+       # The goto value of the lexer at row i, column j-1
+       # Note that the length of the row r is stored at (r, 0)
+       fun lexer_goto(i, j: Int): Int is extern "lexer_goto"
+
+       # The accept value of the lexer at i
+       fun lexer_accept(i: Int): Int is extern "lexer_accept"
+
+       # The goto value of the parser at row i, column j-1
+       # Note that the length of the row r is stored at (r, 0)
+       fun parser_goto(i, j: Int): Int is extern "parser_goto"
+
+       # The action value of the parser at row i, column j-1
+       # Note that the length of the row r is stored at (r, 0)
+       fun parser_action(i, j: Int): Int is extern "parser_action"
+end
diff --git a/contrib/pep8analysis/src/parser/tables_nit.c b/contrib/pep8analysis/src/parser/tables_nit.c
new file mode 100644 (file)
index 0000000..675e3b1
--- /dev/null
@@ -0,0 +1,1077 @@
+/* This file was generated by SableCC (http://www.sablecc.org/). */
+#include <stdlib.h>
+#include "tables_nit.h"
+
+static const int lexer_goto_row1[] = {
+       16,
+       9, 9, 1,
+       10, 10, 2,
+       13, 13, 3,
+       32, 32, 4,
+       34, 34, 5,
+       39, 39, 6,
+       44, 44, 7,
+       45, 45, 8,
+       46, 46, 9,
+       48, 48, 10,
+       49, 57, 11,
+       58, 58, 12,
+       59, 59, 13,
+       65, 90, 14,
+       95, 95, 15,
+       97, 122, 16
+};
+static const int lexer_goto_row2[] = {
+       2,
+       9, 9, 1,
+       32, 32, 4
+};
+static const int lexer_goto_row4[] = {
+       1,
+       10, 10, 17
+};
+static const int lexer_goto_row5[] = {
+       1,
+       9, 32, -3
+};
+static const int lexer_goto_row6[] = {
+       7,
+       0, 9, 18,
+       11, 12, 18,
+       14, 33, 18,
+       34, 34, 19,
+       35, 91, 18,
+       92, 92, 20,
+       93, 255, 18
+};
+static const int lexer_goto_row7[] = {
+       6,
+       0, 9, 21,
+       11, 12, 21,
+       14, 38, 21,
+       40, 91, 21,
+       92, 92, 22,
+       93, 255, 21
+};
+static const int lexer_goto_row9[] = {
+       1,
+       48, 57, 23
+};
+static const int lexer_goto_row10[] = {
+       9,
+       48, 57, 24,
+       65, 65, 25,
+       66, 66, 26,
+       69, 69, 27,
+       87, 87, 28,
+       97, 97, 29,
+       98, 98, 30,
+       101, 101, 31,
+       119, 119, 32
+};
+static const int lexer_goto_row11[] = {
+       9,
+       46, 46, 33,
+       48, 57, 11,
+       65, 87, 14,
+       88, 88, 34,
+       89, 90, 14,
+       95, 95, 15,
+       97, 119, 16,
+       120, 120, 35,
+       121, 122, 16
+};
+static const int lexer_goto_row12[] = {
+       2,
+       46, 57, -12,
+       65, 122, -2
+};
+static const int lexer_goto_row14[] = {
+       3,
+       0, 9, 36,
+       11, 12, 36,
+       14, 255, 36
+};
+static const int lexer_goto_row15[] = {
+       2,
+       48, 57, 37,
+       65, 122, -2
+};
+static const int lexer_goto_row16[] = {
+       1,
+       48, 122, -16
+};
+static const int lexer_goto_row17[] = {
+       1,
+       48, 122, -16
+};
+static const int lexer_goto_row19[] = {
+       1,
+       0, 255, -7
+};
+static const int lexer_goto_row21[] = {
+       7,
+       0, 9, 38,
+       11, 12, 38,
+       14, 33, 38,
+       34, 34, 39,
+       35, 91, 38,
+       92, 92, 40,
+       93, 255, 38
+};
+static const int lexer_goto_row22[] = {
+       1,
+       39, 39, 41
+};
+static const int lexer_goto_row23[] = {
+       5,
+       0, 9, 42,
+       11, 12, 42,
+       14, 119, 42,
+       120, 120, 43,
+       121, 255, 42
+};
+static const int lexer_goto_row24[] = {
+       1,
+       48, 57, 23
+};
+static const int lexer_goto_row25[] = {
+       1,
+       48, 57, 24
+};
+static const int lexer_goto_row26[] = {
+       4,
+       68, 68, 44,
+       83, 83, 45,
+       100, 100, 46,
+       115, 115, 47
+};
+static const int lexer_goto_row27[] = {
+       6,
+       76, 76, 48,
+       85, 85, 49,
+       89, 89, 50,
+       108, 108, 51,
+       117, 117, 52,
+       121, 121, 53
+};
+static const int lexer_goto_row28[] = {
+       4,
+       78, 78, 54,
+       81, 81, 55,
+       110, 110, 56,
+       113, 113, 57
+};
+static const int lexer_goto_row29[] = {
+       2,
+       79, 79, 58,
+       111, 111, 59
+};
+static const int lexer_goto_row30[] = {
+       1,
+       68, 115, -27
+};
+static const int lexer_goto_row31[] = {
+       1,
+       76, 121, -28
+};
+static const int lexer_goto_row32[] = {
+       1,
+       78, 113, -29
+};
+static const int lexer_goto_row33[] = {
+       1,
+       79, 111, -30
+};
+static const int lexer_goto_row34[] = {
+       1,
+       48, 57, 24
+};
+static const int lexer_goto_row35[] = {
+       6,
+       48, 57, 60,
+       65, 70, 61,
+       71, 90, 14,
+       95, 95, 15,
+       97, 102, 62,
+       103, 122, 16
+};
+static const int lexer_goto_row36[] = {
+       1,
+       48, 122, -36
+};
+static const int lexer_goto_row37[] = {
+       1,
+       0, 255, -15
+};
+static const int lexer_goto_row38[] = {
+       1,
+       48, 122, -16
+};
+static const int lexer_goto_row39[] = {
+       1,
+       0, 255, -7
+};
+static const int lexer_goto_row40[] = {
+       1,
+       0, 255, -7
+};
+static const int lexer_goto_row41[] = {
+       1,
+       0, 255, -22
+};
+static const int lexer_goto_row43[] = {
+       1,
+       39, 39, 63
+};
+static const int lexer_goto_row44[] = {
+       4,
+       39, 39, 63,
+       48, 57, 64,
+       65, 70, 65,
+       97, 102, 66
+};
+static const int lexer_goto_row45[] = {
+       2,
+       68, 68, 67,
+       100, 100, 68
+};
+static const int lexer_goto_row46[] = {
+       2,
+       67, 67, 69,
+       99, 99, 70
+};
+static const int lexer_goto_row47[] = {
+       1,
+       68, 100, -46
+};
+static const int lexer_goto_row48[] = {
+       1,
+       67, 99, -47
+};
+static const int lexer_goto_row49[] = {
+       2,
+       79, 79, 71,
+       111, 111, 72
+};
+static const int lexer_goto_row50[] = {
+       2,
+       82, 82, 73,
+       114, 114, 74
+};
+static const int lexer_goto_row51[] = {
+       2,
+       84, 84, 75,
+       116, 116, 76
+};
+static const int lexer_goto_row52[] = {
+       1,
+       79, 111, -50
+};
+static const int lexer_goto_row53[] = {
+       1,
+       82, 114, -51
+};
+static const int lexer_goto_row54[] = {
+       1,
+       84, 116, -52
+};
+static const int lexer_goto_row55[] = {
+       2,
+       68, 68, 77,
+       100, 100, 78
+};
+static const int lexer_goto_row56[] = {
+       2,
+       85, 85, 79,
+       117, 117, 80
+};
+static const int lexer_goto_row57[] = {
+       1,
+       68, 100, -56
+};
+static const int lexer_goto_row58[] = {
+       1,
+       85, 117, -57
+};
+static const int lexer_goto_row59[] = {
+       2,
+       82, 82, 81,
+       114, 114, 82
+};
+static const int lexer_goto_row60[] = {
+       1,
+       82, 114, -60
+};
+static const int lexer_goto_row61[] = {
+       1,
+       48, 122, -36
+};
+static const int lexer_goto_row62[] = {
+       1,
+       48, 122, -36
+};
+static const int lexer_goto_row63[] = {
+       1,
+       48, 122, -36
+};
+static const int lexer_goto_row65[] = {
+       3,
+       48, 57, 83,
+       65, 70, 84,
+       97, 102, 85
+};
+static const int lexer_goto_row66[] = {
+       1,
+       48, 102, -66
+};
+static const int lexer_goto_row67[] = {
+       1,
+       48, 102, -66
+};
+static const int lexer_goto_row68[] = {
+       2,
+       82, 82, 86,
+       114, 114, 87
+};
+static const int lexer_goto_row69[] = {
+       1,
+       82, 114, -69
+};
+static const int lexer_goto_row70[] = {
+       2,
+       73, 73, 88,
+       105, 105, 89
+};
+static const int lexer_goto_row71[] = {
+       1,
+       73, 105, -71
+};
+static const int lexer_goto_row72[] = {
+       2,
+       67, 67, 90,
+       99, 99, 91
+};
+static const int lexer_goto_row73[] = {
+       1,
+       67, 99, -73
+};
+static const int lexer_goto_row74[] = {
+       2,
+       78, 78, 92,
+       110, 110, 93
+};
+static const int lexer_goto_row75[] = {
+       1,
+       78, 110, -75
+};
+static const int lexer_goto_row76[] = {
+       2,
+       69, 69, 94,
+       101, 101, 95
+};
+static const int lexer_goto_row77[] = {
+       1,
+       69, 101, -77
+};
+static const int lexer_goto_row78[] = {
+       5,
+       0, 9, 96,
+       10, 10, 97,
+       11, 12, 96,
+       13, 13, 98,
+       14, 255, 96
+};
+static const int lexer_goto_row79[] = {
+       1,
+       0, 255, -79
+};
+static const int lexer_goto_row80[] = {
+       2,
+       65, 65, 99,
+       97, 97, 100
+};
+static const int lexer_goto_row81[] = {
+       1,
+       65, 97, -81
+};
+static const int lexer_goto_row82[] = {
+       2,
+       68, 68, 101,
+       100, 100, 102
+};
+static const int lexer_goto_row83[] = {
+       1,
+       68, 100, -83
+};
+static const int lexer_goto_row84[] = {
+       1,
+       39, 39, 103
+};
+static const int lexer_goto_row85[] = {
+       1,
+       39, 39, 103
+};
+static const int lexer_goto_row86[] = {
+       1,
+       39, 39, 103
+};
+static const int lexer_goto_row87[] = {
+       2,
+       83, 83, 104,
+       115, 115, 105
+};
+static const int lexer_goto_row88[] = {
+       1,
+       83, 115, -88
+};
+static const int lexer_goto_row89[] = {
+       2,
+       73, 73, 106,
+       105, 105, 107
+};
+static const int lexer_goto_row90[] = {
+       1,
+       73, 105, -90
+};
+static const int lexer_goto_row91[] = {
+       2,
+       75, 75, 108,
+       107, 107, 109
+};
+static const int lexer_goto_row92[] = {
+       1,
+       75, 107, -92
+};
+static const int lexer_goto_row97[] = {
+       1,
+       0, 255, -79
+};
+static const int lexer_goto_row98[] = {
+       1,
+       0, 255, -79
+};
+static const int lexer_goto_row99[] = {
+       3,
+       0, 9, 96,
+       10, 10, 110,
+       11, 255, -79
+};
+static const int lexer_goto_row100[] = {
+       2,
+       84, 84, 111,
+       116, 116, 112
+};
+static const int lexer_goto_row101[] = {
+       1,
+       84, 116, -101
+};
+static const int lexer_goto_row105[] = {
+       2,
+       83, 83, 113,
+       115, 115, 114
+};
+static const int lexer_goto_row106[] = {
+       1,
+       83, 115, -106
+};
+static const int lexer_goto_row111[] = {
+       1,
+       0, 255, -79
+};
+static const int lexer_goto_row112[] = {
+       2,
+       69, 69, 115,
+       101, 101, 116
+};
+static const int lexer_goto_row113[] = {
+       1,
+       69, 101, -113
+};
+static const int lexer_goto_row_null[] = {0};
+const int* const lexer_goto_table[] = {
+       lexer_goto_row1,
+       lexer_goto_row2,
+       lexer_goto_row_null,
+       lexer_goto_row4,
+       lexer_goto_row5,
+       lexer_goto_row6,
+       lexer_goto_row7,
+       lexer_goto_row_null,
+       lexer_goto_row9,
+       lexer_goto_row10,
+       lexer_goto_row11,
+       lexer_goto_row12,
+       lexer_goto_row_null,
+       lexer_goto_row14,
+       lexer_goto_row15,
+       lexer_goto_row16,
+       lexer_goto_row17,
+       lexer_goto_row_null,
+       lexer_goto_row19,
+       lexer_goto_row_null,
+       lexer_goto_row21,
+       lexer_goto_row22,
+       lexer_goto_row23,
+       lexer_goto_row24,
+       lexer_goto_row25,
+       lexer_goto_row26,
+       lexer_goto_row27,
+       lexer_goto_row28,
+       lexer_goto_row29,
+       lexer_goto_row30,
+       lexer_goto_row31,
+       lexer_goto_row32,
+       lexer_goto_row33,
+       lexer_goto_row34,
+       lexer_goto_row35,
+       lexer_goto_row36,
+       lexer_goto_row37,
+       lexer_goto_row38,
+       lexer_goto_row39,
+       lexer_goto_row40,
+       lexer_goto_row41,
+       lexer_goto_row_null,
+       lexer_goto_row43,
+       lexer_goto_row44,
+       lexer_goto_row45,
+       lexer_goto_row46,
+       lexer_goto_row47,
+       lexer_goto_row48,
+       lexer_goto_row49,
+       lexer_goto_row50,
+       lexer_goto_row51,
+       lexer_goto_row52,
+       lexer_goto_row53,
+       lexer_goto_row54,
+       lexer_goto_row55,
+       lexer_goto_row56,
+       lexer_goto_row57,
+       lexer_goto_row58,
+       lexer_goto_row59,
+       lexer_goto_row60,
+       lexer_goto_row61,
+       lexer_goto_row62,
+       lexer_goto_row63,
+       lexer_goto_row_null,
+       lexer_goto_row65,
+       lexer_goto_row66,
+       lexer_goto_row67,
+       lexer_goto_row68,
+       lexer_goto_row69,
+       lexer_goto_row70,
+       lexer_goto_row71,
+       lexer_goto_row72,
+       lexer_goto_row73,
+       lexer_goto_row74,
+       lexer_goto_row75,
+       lexer_goto_row76,
+       lexer_goto_row77,
+       lexer_goto_row78,
+       lexer_goto_row79,
+       lexer_goto_row80,
+       lexer_goto_row81,
+       lexer_goto_row82,
+       lexer_goto_row83,
+       lexer_goto_row84,
+       lexer_goto_row85,
+       lexer_goto_row86,
+       lexer_goto_row87,
+       lexer_goto_row88,
+       lexer_goto_row89,
+       lexer_goto_row90,
+       lexer_goto_row91,
+       lexer_goto_row92,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row97,
+       lexer_goto_row98,
+       lexer_goto_row99,
+       lexer_goto_row100,
+       lexer_goto_row101,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row105,
+       lexer_goto_row106,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row111,
+       lexer_goto_row112,
+       lexer_goto_row113,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null,
+       lexer_goto_row_null
+};
+
+const int lexer_accept_table[] = {
+       -1,0,1,1,0,-1,-1,8,-1,-1,2,2,7,9,18,18,18,1,-1,5,-1,-1,-1,2,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,18,9,18,-1,5,-1,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,6,6,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,17,17,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,16,16,10,10,17,17,17,-1,-1,11,11,4,-1,-1,13,13,12,12,17,-1,-1,14,14,15,15
+};
+
+static int parser_action_row1[] = {
+       12,
+       -1, 3, 0,
+       0, 0, 1,
+       8, 0, 2,
+       9, 0, 3,
+       10, 0, 4,
+       11, 0, 5,
+       12, 0, 6,
+       13, 0, 7,
+       14, 0, 8,
+       15, 0, 9,
+       16, 0, 10,
+       17, 0, 11
+};
+static int parser_action_row2[] = {
+       1,
+       -1, 1, 4
+};
+static int parser_action_row3[] = {
+       2,
+       -1, 3, 2,
+       0, 0, 18
+};
+static int parser_action_row4[] = {
+       6,
+       -1, 3, 3,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row5[] = {
+       6,
+       -1, 3, 4,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row6[] = {
+       6,
+       -1, 3, 5,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row7[] = {
+       6,
+       -1, 3, 6,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row8[] = {
+       6,
+       -1, 3, 7,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row9[] = {
+       6,
+       -1, 3, 8,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row10[] = {
+       6,
+       -1, 3, 9,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row11[] = {
+       1,
+       -1, 1, 0
+};
+static int parser_action_row12[] = {
+       7,
+       -1, 1, 17,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       6, 0, 31,
+       17, 0, 23
+};
+static int parser_action_row13[] = {
+       2,
+       -1, 3, 12,
+       18, 2, -1
+};
+static int parser_action_row14[] = {
+       1,
+       -1, 1, 33
+};
+static int parser_action_row15[] = {
+       12,
+       -1, 3, 14,
+       0, 0, 34,
+       8, 0, 35,
+       9, 0, 3,
+       10, 0, 4,
+       11, 0, 5,
+       12, 0, 6,
+       13, 0, 7,
+       14, 0, 8,
+       15, 0, 9,
+       16, 0, 36,
+       17, 0, 37
+};
+static int parser_action_row16[] = {
+       3,
+       -1, 3, 15,
+       0, 0, 40,
+       8, 0, 41
+};
+static int parser_action_row17[] = {
+       3,
+       -1, 3, 16,
+       0, 0, 42,
+       8, 0, 43
+};
+static int parser_action_row18[] = {
+       12,
+       -1, 3, 17,
+       0, 0, 1,
+       8, 0, 2,
+       9, 0, 3,
+       10, 0, 4,
+       11, 0, 5,
+       12, 0, 6,
+       13, 0, 7,
+       14, 0, 8,
+       15, 0, 9,
+       16, 0, 44,
+       17, 0, 11
+};
+static int parser_action_row19[] = {
+       1,
+       -1, 1, 6
+};
+static int parser_action_row20[] = {
+       1,
+       -1, 1, 22
+};
+static int parser_action_row21[] = {
+       1,
+       -1, 1, 23
+};
+static int parser_action_row22[] = {
+       1,
+       -1, 1, 24
+};
+static int parser_action_row23[] = {
+       1,
+       -1, 1, 25
+};
+static int parser_action_row24[] = {
+       1,
+       -1, 1, 21
+};
+static int parser_action_row25[] = {
+       1,
+       -1, 1, 26
+};
+static int parser_action_row26[] = {
+       1,
+       -1, 1, 27
+};
+static int parser_action_row27[] = {
+       1,
+       -1, 1, 28
+};
+static int parser_action_row28[] = {
+       1,
+       -1, 1, 29
+};
+static int parser_action_row29[] = {
+       1,
+       -1, 1, 30
+};
+static int parser_action_row30[] = {
+       1,
+       -1, 1, 31
+};
+static int parser_action_row31[] = {
+       1,
+       -1, 1, 32
+};
+static int parser_action_row32[] = {
+       1,
+       -1, 1, 16
+};
+static int parser_action_row33[] = {
+       1,
+       -1, 1, 18
+};
+static int parser_action_row34[] = {
+       2,
+       -1, 1, 19,
+       7, 0, 47
+};
+static int parser_action_row35[] = {
+       1,
+       -1, 1, 5
+};
+static int parser_action_row36[] = {
+       2,
+       -1, 3, 35,
+       0, 0, 48
+};
+static int parser_action_row37[] = {
+       1,
+       -1, 1, 2
+};
+static int parser_action_row38[] = {
+       6,
+       -1, 1, 17,
+       1, 0, 19,
+       3, 0, 20,
+       4, 0, 21,
+       5, 0, 22,
+       17, 0, 23
+};
+static int parser_action_row39[] = {
+       3,
+       -1, 3, 38,
+       0, 0, 49,
+       8, 0, 50
+};
+static int parser_action_row40[] = {
+       3,
+       -1, 3, 39,
+       0, 0, 51,
+       8, 0, 52
+};
+static int parser_action_row41[] = {
+       1,
+       -1, 1, 8
+};
+static int parser_action_row42[] = {
+       2,
+       -1, 3, 41,
+       0, 0, 53
+};
+static int parser_action_row43[] = {
+       1,
+       -1, 1, 12
+};
+static int parser_action_row44[] = {
+       2,
+       -1, 3, 43,
+       0, 0, 54
+};
+static int parser_action_row45[] = {
+       1,
+       -1, 1, 1
+};
+static int parser_action_row46[] = {
+       1,
+       -1, 1, 34
+};
+static int parser_action_row47[] = {
+       12,
+       -1, 3, 46,
+       0, 0, 34,
+       8, 0, 35,
+       9, 0, 3,
+       10, 0, 4,
+       11, 0, 5,
+       12, 0, 6,
+       13, 0, 7,
+       14, 0, 8,
+       15, 0, 9,
+       16, 0, 55,
+       17, 0, 37
+};
+static int parser_action_row48[] = {
+       2,
+       -1, 3, 47,
+       17, 0, 56
+};
+static int parser_action_row49[] = {
+       1,
+       -1, 1, 7
+};
+static int parser_action_row50[] = {
+       1,
+       -1, 1, 9
+};
+static int parser_action_row51[] = {
+       2,
+       -1, 3, 50,
+       0, 0, 57
+};
+static int parser_action_row52[] = {
+       1,
+       -1, 1, 13
+};
+static int parser_action_row53[] = {
+       2,
+       -1, 3, 52,
+       0, 0, 58
+};
+static int parser_action_row54[] = {
+       1,
+       -1, 1, 10
+};
+static int parser_action_row55[] = {
+       1,
+       -1, 1, 14
+};
+static int parser_action_row56[] = {
+       1,
+       -1, 1, 3
+};
+static int parser_action_row57[] = {
+       1,
+       -1, 1, 20
+};
+static int parser_action_row58[] = {
+       1,
+       -1, 1, 11
+};
+static int parser_action_row59[] = {
+       1,
+       -1, 1, 15
+};
+
+const int* const parser_action_table[] = {
+       parser_action_row1,
+       parser_action_row2,
+       parser_action_row3,
+       parser_action_row4,
+       parser_action_row5,
+       parser_action_row6,
+       parser_action_row7,
+       parser_action_row8,
+       parser_action_row9,
+       parser_action_row10,
+       parser_action_row11,
+       parser_action_row12,
+       parser_action_row13,
+       parser_action_row14,
+       parser_action_row15,
+       parser_action_row16,
+       parser_action_row17,
+       parser_action_row18,
+       parser_action_row19,
+       parser_action_row20,
+       parser_action_row21,
+       parser_action_row22,
+       parser_action_row23,
+       parser_action_row24,
+       parser_action_row25,
+       parser_action_row26,
+       parser_action_row27,
+       parser_action_row28,
+       parser_action_row29,
+       parser_action_row30,
+       parser_action_row31,
+       parser_action_row32,
+       parser_action_row33,
+       parser_action_row34,
+       parser_action_row35,
+       parser_action_row36,
+       parser_action_row37,
+       parser_action_row38,
+       parser_action_row39,
+       parser_action_row40,
+       parser_action_row41,
+       parser_action_row42,
+       parser_action_row43,
+       parser_action_row44,
+       parser_action_row45,
+       parser_action_row46,
+       parser_action_row47,
+       parser_action_row48,
+       parser_action_row49,
+       parser_action_row50,
+       parser_action_row51,
+       parser_action_row52,
+       parser_action_row53,
+       parser_action_row54,
+       parser_action_row55,
+       parser_action_row56,
+       parser_action_row57,
+       parser_action_row58,
+       parser_action_row59
+};
+
+static int parser_goto_row1[] = {
+       1,
+       -1, 12
+};
+static int parser_goto_row2[] = {
+       2,
+       -1, 13,
+       17, 45
+};
+static int parser_goto_row3[] = {
+       2,
+       -1, 14,
+       17, 46
+};
+static int parser_goto_row4[] = {
+       3,
+       -1, 15,
+       14, 38,
+       46, 38
+};
+static int parser_goto_row5[] = {
+       1,
+       -1, 32
+};
+static int parser_goto_row6[] = {
+       8,
+       -1, 33,
+       3, 24,
+       4, 25,
+       5, 26,
+       6, 27,
+       7, 28,
+       8, 29,
+       9, 30
+};
+static int parser_goto_row7[] = {
+       3,
+       -1, 16,
+       14, 39,
+       46, 39
+};
+static int parser_goto_row8[] = {
+       1,
+       -1, 17
+};
+
+const int* const parser_goto_table[] = {
+       parser_goto_row1,
+       parser_goto_row2,
+       parser_goto_row3,
+       parser_goto_row4,
+       parser_goto_row5,
+       parser_goto_row6,
+       parser_goto_row7,
+       parser_goto_row8
+};
similarity index 55%
rename from tests/test_ni_inits.nit.h
rename to contrib/pep8analysis/src/parser/tables_nit.h
index 9d0b8aa..990189f 100644 (file)
@@ -1,7 +1,7 @@
+#ifndef TABLE_NIT_H
+#define TABLE_NIT_H
 /* This file is part of NIT ( http://www.nitlanguage.org ).
  *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
  * This file is free software, which comes along with NIT.  This software is
  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
  * another product.
  */
 
-#ifndef test_ni_inits_IMPL_NIT_H
-#define test_ni_inits_IMPL_NIT_H
+extern const int* const lexer_goto_table[];
+extern const int lexer_accept_table[];
 
-#define A char*
+#define lexer_goto(o,i,j) (lexer_goto_table[(i)][(j)])
+#define lexer_accept(o,i) (lexer_accept_table[(i)])
 
-#include <test_ni_inits._nitni.h>
+extern const int* const parser_action_table[];
+extern const int* const parser_goto_table[];
 
-A new_A_with_b___impl(  );
-A new_A_alloc___impl(  );
-void A_set___impl( A recv, char v );
-String A_to_s___impl( A recv );
+#define parser_action(o,i,j) (parser_action_table[(i)][(j)])
+#define parser_goto(o,i,j) (parser_goto_table[(i)][(j)])
 
 #endif
diff --git a/contrib/pep8analysis/src/parser/xss/lexer.xss b/contrib/pep8analysis/src/parser/xss/lexer.xss
new file mode 100644 (file)
index 0000000..6a4d1d0
--- /dev/null
@@ -0,0 +1,252 @@
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.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.
+
+$ template make_lexer()
+
+# The lexer extract NIT tokens from an input stream.
+# It is better user with the Parser
+class Lexer
+       super TablesCapable
+       # Last peeked token
+       var _token: nullable Token
+
+       # Lexer current state
+       var _state: Int = 0
+
+       # The source file
+       readable var _file: SourceFile
+
+       # Current character in the stream
+       var _stream_pos: Int = 0
+
+       # Current line number in the input stream
+       var _line: Int = 0
+
+       # Current column in the input stream
+       var _pos: Int = 0
+
+       # Was the last character a cariage-return?
+       var _cr: Bool = false
+
+$ foreach {lexer_data/state}
+       # Constante state values
+       private fun state_${translate(@name,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}: Int do return @id end
+$ end foreach
+
+       # Create a new lexer for a stream (and a name)
+       init(file: SourceFile)
+       do
+               _file = file
+       end
+
+       # The last peeked token to chain them
+       private var last_token: nullable Token = null
+
+       # Give the next token (but do not consume it)
+       fun peek: Token
+       do
+               var t = _token
+               if t != null then return t
+
+               t = get_token
+               while t == null do t = get_token
+
+               var l = last_token
+               if l != null then
+                       l.next_token = t
+                       t.prev_token = l
+               end
+
+               last_token = t
+               _token = t
+               return t
+       end
+
+       # Give and consume the next token
+       fun next: Token
+       do
+               var result = peek
+               _token = null
+               return result
+       end
+
+       # Primitive method to return a token, or return null if it is discarded
+       # Is used to implement `peek` and `next`
+       protected fun get_token: nullable Token
+       do
+               var dfa_state = 0
+
+               var sp = _stream_pos
+               var start_stream_pos = sp
+               var start_pos = _pos
+               var start_line = _line
+               var string = _file.string
+               var string_len = string.length
+
+               var accept_state = -1
+               var accept_token = -1
+               var accept_length = -1
+               var accept_pos = -1
+               var accept_line = -1
+
+               loop
+                       if sp >= string_len then
+                               dfa_state = -1
+                       else
+                               var c = string[sp].ascii
+                               sp += 1
+
+                               var cr = _cr
+                               var line = _line
+                               var pos = _pos
+                               if c == 10 then
+                                       if cr then
+                                               cr = false
+                                               _file.line_starts[line] = sp
+                                       else
+                                               line = line + 1
+                                               pos = 0
+                                               _file.line_starts[line] = sp
+                                       end
+                               else if c == 13 then
+                                       line = line + 1
+                                       pos = 0
+                                       cr = true
+                                       _file.line_starts[line] = sp
+                               else
+                                       pos = pos + 1
+                                       cr = false
+                               end
+
+                               loop
+                                       var old_state = dfa_state
+                                       if dfa_state < -1 then
+                                               old_state = -2 - dfa_state
+                                       end
+
+                                       dfa_state = -1
+
+                                       var low = 0
+                                       var high = lexer_goto(old_state, 0) - 1
+
+                                       if high >= 0 then
+                                               while low <= high do
+                                                       var middle = (low + high) / 2
+                                                       var offset = middle * 3 + 1 # +1 because length is at 0
+
+                                                       if c < lexer_goto(old_state, offset) then
+                                                               high = middle - 1
+                                                       else if c > lexer_goto(old_state, offset+1) then
+                                                               low = middle + 1
+                                                       else
+                                                               dfa_state = lexer_goto(old_state, offset+2)
+                                                               break
+                                                       end
+                                               end
+                                       end
+                                       if dfa_state > -2 then break
+                               end
+
+                               _cr = cr
+                               _line = line
+                               _pos = pos
+                       end
+
+                       if dfa_state >= 0 then
+                               var tok = lexer_accept(dfa_state)
+                               if tok != -1 then
+                                       accept_state = dfa_state
+                                       accept_token = tok
+                                       accept_length = sp - start_stream_pos
+                                       accept_pos = _pos
+                                       accept_line = _line
+                               end
+                       else
+                               if accept_state != -1 then
+                                       var location = new Location(_file, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
+                                       _pos = accept_pos
+                                       _line = accept_line
+                                       _stream_pos = start_stream_pos + accept_length
+$ foreach {//token}
+                                       if accept_token == ${position()-1} then
+$    if {count(transition[@from!=@to])!=0}
+                                               var state_id = _state
+$        foreach transition in {transition[@from!=@to]}
+                                               if state_id == ${/parser/lexer_data/state[@name=$transition/@from]/@id} then
+                                                       _state = state_${translate(@to,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+                                               end
+$        end
+$    end if
+$    if {@parser_index}
+                                               return new @ename.init_tk(location)
+$    else
+                                               return null
+$    end
+                                       end
+$ end foreach
+                               else
+                                       _stream_pos = sp
+                                       var location = new Location(_file, start_line + 1, start_line + 1, start_pos + 1, start_pos + 1)
+                                       if sp > start_stream_pos then
+                                               var text = string.substring(start_stream_pos, sp-start_stream_pos)
+                                               var token = new PLexerError.init_lexer_error("Syntax error: unknown token {text}.", location, text)
+                                               return token
+                                       else
+                                               var token = new EOF.init_tk(location)
+                                               return token
+                                       end
+                               end
+                       end
+               end
+       end
+end
+
+$ end template
+
+
+
+$ template make_lexer_table()
+$ foreach {lexer_data/goto_table/state}
+$     foreach {row}
+$         if {count(goto)!=0}
+static const int lexer_goto_row${position()}[] = {
+       ${count(goto)},
+$             foreach {goto}
+       @low, @high, @state[-sep ','-]
+$             end foreach
+};
+$         end
+$     end foreach
+static const int lexer_goto_row_null[] = {0};
+const int* const lexer_goto_table[] = {
+$     foreach {row}
+$         if {count(goto)!=0}
+       lexer_goto_row${position()}[-sep ','-]
+$         else
+       lexer_goto_row_null[-sep ','-]
+$         end
+$     end foreach
+};
+$ end foreach
+
+$ foreach {lexer_data/accept_table/state}
+const int lexer_accept_table[] = {
+       [-foreach {i}-]${.}[-sep ','-][-end foreach-]
+};
+$ end foreach
+
+$ end template
diff --git a/contrib/pep8analysis/src/parser/xss/main.xss b/contrib/pep8analysis/src/parser/xss/main.xss
new file mode 100644 (file)
index 0000000..db69a01
--- /dev/null
@@ -0,0 +1,82 @@
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.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.
+
+$ include 'lexer.xss'
+$ include 'parser.xss'
+$ include 'tokens.xss'
+$ include 'prods.xss'
+
+$ output 'parser_abs.nit'
+# Raw AST node hierarchy.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser_abs
+
+import location
+
+$ call make_abs_tokens()
+$ call make_abs_prods()
+$ end output
+
+$ output 'lexer.nit'
+# Lexer and its tokens.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module lexer
+
+$ if $usermodule
+intrude import $usermodule
+$ else
+intrude import parser_abs
+$ end
+private import tables
+$ call make_tokens()
+$ call make_lexer()
+$ end output
+
+$ output 'parser_prod.nit'
+# Production AST nodes full definition.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser_prod
+
+import lexer
+$ if $usermodule
+intrude import $usermodule
+$ else
+intrude import parser_abs
+$ end
+private import tables
+
+$ call make_prods()
+$ end output
+
+$ output 'parser.nit'
+# Parser.
+# This file was generated by SableCC (http://www.sablecc.org/).
+module parser
+
+intrude import parser_prod
+import tables
+$ call make_parser()
+$ end output
+
+$ output 'tables_nit.c'
+/* This file was generated by SableCC (http://www.sablecc.org/). */
+#include <stdlib.h>
+#include "tables_nit.h"
+
+$ call make_lexer_table()
+$ call make_parser_table()
+$ end output
diff --git a/contrib/pep8analysis/src/parser/xss/parser.xss b/contrib/pep8analysis/src/parser/xss/parser.xss
new file mode 100644 (file)
index 0000000..7e24374
--- /dev/null
@@ -0,0 +1,353 @@
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.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.
+
+$ template make_parser()
+
+# State of the parser automata as stored in the parser stack.
+private class State
+       # The internal state number
+       readable writable var _state: Int
+
+       # The node stored with the state in the stack
+       readable writable var _nodes: nullable Object
+
+       init(state: Int, nodes: nullable Object)
+       do
+               _state = state
+               _nodes = nodes
+       end
+end
+
+class Parser
+       super TablesCapable
+       # Associated lexer
+       var _lexer: Lexer
+
+       # Stack of pushed states and productions
+       var _stack: Array[State]
+
+       # Position in the stack
+       var _stack_pos: Int
+
+       # Create a new parser based on a given lexer
+       init(lexer: Lexer)
+       do
+               _lexer = lexer
+               _stack = new Array[State]
+               _stack_pos = -1
+               build_reduce_table
+       end
+
+       # Do a transition in the automata
+       private fun go_to(index: Int): Int
+       do
+               var state = state
+               var low = 1
+               var high = parser_goto(index, 0) - 1
+
+               while low <= high do
+                       var middle = (low + high) / 2
+                       var subindex = middle * 2 + 1 # +1 because parser_goto(index, 0) is the length
+
+                       var goal = parser_goto(index, subindex)
+                       if state < goal then
+                               high = middle - 1
+                       else if state > goal then
+                               low = middle + 1
+                       else
+                               return parser_goto(index, subindex+1)
+                       end
+               end
+
+               return parser_goto(index, 2) # Default value
+       end
+
+       # Push someting in the state stack
+       private fun push(numstate: Int, list_node: nullable Object)
+       do
+               var pos = _stack_pos + 1
+               _stack_pos = pos
+               if pos < _stack.length then
+                       var state = _stack[pos]
+                       state.state = numstate
+                       state.nodes = list_node
+               else
+                       _stack.push(new State(numstate, list_node))
+               end
+       end
+
+       # The current state
+       private fun state: Int
+       do
+               return _stack[_stack_pos].state
+       end
+
+       # Pop something from the stack state
+       private fun pop: nullable Object
+       do
+               var res = _stack[_stack_pos].nodes
+               _stack_pos = _stack_pos -1
+               return res
+       end
+
+       # Build and return a full AST.
+       fun parse: Start
+       do
+               push(0, null)
+
+               var lexer = _lexer
+               loop
+                       var token = lexer.peek
+                       if token isa PError then
+                               return new Start(null, token)
+                       end
+
+                       var state = self.state
+                       var index = token.parser_index
+                       var action_type = parser_action(state, 2)
+                       var action_value = parser_action(state, 3)
+
+                       var low = 1
+                       var high = parser_action(state, 0) - 1
+
+                       while low <= high do
+                               var middle = (low + high) / 2
+                               var subindex = middle * 3 + 1 # +1 because parser_action(state, 0) is the length
+
+                               var goal = parser_action(state, subindex)
+                               if index < goal then
+                                       high = middle - 1
+                               else if index > goal then
+                                       low = middle + 1
+                               else
+                                       action_type = parser_action(state, subindex+1)
+                                       action_value = parser_action(state, subindex+2)
+                                       break
+                               end
+                       end
+
+                       if action_type == 0 then # SHIFT
+                               push(action_value, lexer.next)
+                       else if action_type == 1 then # REDUCE
+                               _reduce_table[action_value].action(self)
+                       else if action_type == 2 then # ACCEPT
+                               var node2 = lexer.next
+                               assert node2 isa EOF
+                               var node1 = pop
+                               assert node1 isa ${/parser/prods/prod/@ename}
+                               var node = new Start(node1, node2)
+                               (new ComputeProdLocationVisitor).enter_visit(node)
+                               return node
+                       else if action_type == 3 then # ERROR
+                               var node2 = new PParserError.init_parser_error("Syntax error: unexpected {token}.", token.location, token)
+                               var node = new Start(null, node2)
+                               return node
+                       end
+               end
+       end
+
+       var _reduce_table: Array[ReduceAction]
+       private fun build_reduce_table
+       do
+               _reduce_table = new Array[ReduceAction].with_items(
+$ foreach {rules/rule}
+                       new ReduceAction@index(@leftside)[-sep ','-]
+$ end foreach
+               )
+       end
+end
+
+redef class Prod
+       # Location on the first token after the start of a production
+       # So outside the production for epilon production
+       var _first_location: nullable Location
+end
+
+# Find location of production nodes
+# Uses existing token locations to infer location of productions.
+private class ComputeProdLocationVisitor
+       super Visitor
+       # Currenlty visited productions that need a first token
+       var _need_first_prods: Array[Prod] = new Array[Prod]
+
+       # Already visited epsilon productions that waits something after them
+       var _need_after_epsilons: Array[Prod] = new Array[Prod]
+
+       # Location of the last visited token in the current production
+       var _last_location: nullable Location = null
+
+       redef fun visit(n: ANode)
+       do
+               if n isa Token then
+                       var loc = n.location
+                       _last_location = loc
+
+                       # Add a first token to productions that need one
+                       if not _need_first_prods.is_empty then
+                               for no in _need_first_prods do
+                                       no._first_location = loc
+                               end
+                               _need_first_prods.clear
+                       end
+
+                       # Find location for already visited epsilon production that need one
+                       if not _need_after_epsilons.is_empty then
+                               var loco = new Location(loc.file, loc.line_start, loc.line_start, loc.column_start, loc.column_start) 
+                               for no in _need_after_epsilons do
+                                       no.location = loco
+                               end
+                               _need_after_epsilons.clear
+                       end
+               else
+                       assert n isa Prod
+                       _need_first_prods.add(n)
+
+                       n.visit_all(self)
+
+                       var startl = n._first_location
+                       if startl != null then
+                               # Non-epsilon production
+                               var endl = _last_location
+                               assert endl != null
+
+                               n.location = new Location(startl.file, startl.line_start, endl.line_end, startl.column_start, endl.column_end)
+
+                               if not _need_after_epsilons.is_empty then
+                                       var loc = new Location(endl.file, endl.line_end, endl.line_end, endl.column_end, endl.column_end)
+                                       for no in _need_after_epsilons do
+                                               # Epsilon production that finishes the current non-epsilon production
+                                               no.location = loc
+                                       end
+                                       _need_after_epsilons.clear
+                               end
+                       else
+                               # Epsilon production in the middle or that finishes a parent non-epsilon production
+                               _need_after_epsilons.add(n)
+                       end
+               end
+       end
+
+       init do end
+end
+
+# Each reduca action has its own class, this one is the root of the hierarchy.
+private abstract class ReduceAction
+       fun action(p: Parser) is abstract
+       fun concat(l1, l2 : Array[Object]): Array[Object]
+       do
+               if l1.is_empty then return l2
+               l1.append(l2)
+               return l1
+       end
+       var _goto: Int
+       init(g: Int) do _goto = g
+end
+
+$ foreach {rules/rule}
+private class ReduceAction@index
+       super ReduceAction
+       redef fun action(p: Parser)
+       do
+                                       var node_list: nullable Object = null
+$   foreach {action}
+$   choose
+$     when {@cmd='POP'}
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} = p.pop
+$     end
+$     when {@cmd='FETCHLIST'}
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} = ${translate(@from,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+                                       assert ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} isa Array[Object]
+$     end
+$     when {@cmd='FETCHNODE'}
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} = ${translate(@from,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+                                       assert ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} isa nullable @etype
+$     end
+$     when {@cmd='ADDNODE'}
+                                       if ${translate(@node,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} != null then
+                                               ${translate(@tolist,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}.add(${translate(@node,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")})
+                                       end
+$     end
+$     when {@cmd='ADDLIST'}
+                                       ${translate(@tolist,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} = concat(${translate(@tolist,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}, ${translate(@fromlist,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")})
+$     end
+$     when {@cmd='MAKELIST'}
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} = new Array[Object]
+$     end
+$     when {@cmd='MAKENODE'}
+$      if {count(arg)!=0}
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}: nullable @etype = new @etype.init_${translate(@etype,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}(
+$       foreach {arg}
+$           if @null
+                                               null[-sep ','-]
+$           else
+                                               ${translate(.,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}[-sep ','-]
+$           end
+$       end foreach
+                                       )
+$      else
+                                       var ${translate(@result,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}: nullable @etype = new @etype.init_${translate(@etype,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+$      end
+$     end
+$     when {@cmd='RETURNNODE'}
+$       if @null
+                                       node_list = null
+$       else
+                                       node_list = ${translate(@node,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+$       end
+$     end
+$     when {@cmd='RETURNLIST'}
+                                       node_list = ${translate(@list,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+$     end
+$   end choose
+$   end foreach
+                                       p.push(p.go_to(_goto), node_list)
+       end
+end
+$ end foreach
+$ end template
+
+$ template make_parser_table()
+$ foreach {parser_data/action_table/row}
+static int parser_action_row${position()}[] = {
+       ${count(action)},
+$   foreach {action}
+       @from, @action, @to[-sep ','-]
+$   end foreach
+};
+$ end foreach
+
+const int* const parser_action_table[] = {
+$ foreach {parser_data/action_table/row}
+       parser_action_row${position()}[-sep ','-]
+$ end foreach
+};
+
+$ foreach {parser_data/goto_table/row}
+static int parser_goto_row${position()}[] = {
+       ${count(goto)},
+$   foreach {goto}
+       @from, @to[-sep ','-]
+$   end foreach
+};
+$ end foreach
+
+const int* const parser_goto_table[] = {
+$ foreach {parser_data/goto_table/row}
+       parser_goto_row${position()}[-sep ','-]
+$ end foreach
+};
+$ end template
diff --git a/contrib/pep8analysis/src/parser/xss/prods.xss b/contrib/pep8analysis/src/parser/xss/prods.xss
new file mode 100644 (file)
index 0000000..a1d34a1
--- /dev/null
@@ -0,0 +1,196 @@
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.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.
+
+$ template make_abs_prods()
+$ set baseprod = {//prod/@ename}
+
+$ foreach {//prod}
+class @ename super Prod end
+$ end
+
+$ foreach {//alt}
+class @ename
+       super ${../@ename}
+$ foreach {elem}
+$   if @is_list
+    readable var _n_@name: List[@etype] = new List[@etype]
+$   else
+$   if @modifier
+    readable var _n_@name: nullable @etype = null
+$   else
+    readable var _n_@name: @etype
+$   end
+$   end
+$ end
+end
+$ end
+
+class Start
+       super Prod
+    readable var _n_base: nullable $baseprod
+    readable var _n_eof: EOF
+    init(
+        n_base: nullable $baseprod,
+        n_eof: EOF)
+    do
+        _n_base = n_base
+        _n_eof = n_eof
+    end
+
+end
+$ end template
+
+$ template make_prods()
+$ set baseprod = {//prod/@ename}
+$ foreach {//alt}
+redef class @ename
+    private init empty_init do end
+
+$ if {count(elem)!=0}
+    init init_${translate(@ename,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")} (
+$ foreach {elem}
+$   if {@is_list}
+            n_@{name}: Collection[Object][-sep ','-] # Should be Collection[@etype]
+$   else
+            n_@{name}: nullable @etype[-sep ','-]
+$   end
+$ end
+    )
+$ else
+    init init_${translate(@ename,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")}
+$ end
+    do
+        empty_init
+$ foreach {elem}
+$   if @is_list
+       for n in n_@{name} do
+               assert n isa @{etype}
+               _n_@{name}.add(n)
+               n.parent = self
+       end
+$   else
+$   if {@modifier}
+        _n_@name = n_@{name}
+       if n_@{name} != null then
+               n_@{name}.parent = self
+       end
+$   else
+        _n_@name = n_@{name}.as(not null)
+       n_@{name}.parent = self
+$   end
+$   end
+$ end
+    end
+
+    redef fun replace_child(old_child: PNode, new_child: nullable PNode)
+    do
+$ foreach {elem}
+$   if @is_list
+        for i in [0.._n_@{name}.length[ do
+            if _n_@{name}[i] == old_child then
+                if new_child != null then
+                   assert new_child isa @etype
+                    _n_@{name}[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_@{name}.remove_at(i)
+                end
+                return
+            end
+        end
+$   else
+        if _n_@{name} == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa @etype
+                _n_@{name} = new_child
+           else
+$   if @modifier
+               _n_@{name} = null
+$   else
+               abort
+$   end
+            end
+            return
+       end
+$   end
+$ end foreach
+    end
+
+$   foreach {elem}
+$     if @is_list
+$     else
+               redef fun n_@{name}=(node)
+               do
+                       _n_@{name} = node
+$       if @modifier
+                       if node != null then
+                               node.parent = self
+                       end
+$       else
+                       node.parent = self
+$       end
+               end
+$     end
+$   end foreach
+
+
+    redef fun visit_all(v: Visitor)
+    do
+$   foreach {elem}
+$     if @is_list
+            for n in _n_@{name} do
+                v.enter_visit(n)
+           end
+$     else
+$       if @modifier
+        if _n_@{name} != null then
+            v.enter_visit(_n_@{name}.as(not null))
+        end
+$       else
+        v.enter_visit(_n_@{name})
+$       end
+$     end
+$   end foreach
+    end
+end
+$ end foreach
+
+redef class Start
+    redef fun replace_child(old_child: PNode, new_child: nullable PNode)
+    do
+        if _n_base == old_child then
+            if new_child == null then
+            else
+                new_child.parent = self
+               assert new_child isa $baseprod
+                _n_base = new_child
+            end
+            old_child.parent = null
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        if _n_base != null then
+            v.enter_visit(_n_base.as(not null))
+        end
+       v.enter_visit(_n_eof)
+    end
+end
+$ end template
diff --git a/contrib/pep8analysis/src/parser/xss/tokens.xss b/contrib/pep8analysis/src/parser/xss/tokens.xss
new file mode 100644 (file)
index 0000000..0b84e09
--- /dev/null
@@ -0,0 +1,121 @@
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.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.
+
+$ template make_abs_tokens()
+$ foreach {//token}
+$ if {@parser_index}    
+class @ename
+       super Token
+end
+$ end
+$ end
+class EOF
+       super Token
+end
+class PError
+       super EOF
+end
+class PLexerError
+       super PError
+end
+class PParserError
+       super PError
+end
+$ end template
+
+$ template make_tokens()
+
+redef class Token
+    var _text: nullable String
+
+    redef fun text
+    do
+        var res = _text
+        if res != null then return res
+        res = location.text
+       _text = res
+       return res
+    end
+
+    redef fun text=(text)
+    do
+        _text = text
+    end
+
+    fun parser_index: Int is abstract
+end
+
+$ foreach {//token}
+$ if {@parser_index}
+redef class @ename
+    redef fun parser_index: Int
+    do
+       return @parser_index
+    end
+
+    init init_tk(loc: Location)
+    do
+               _location = loc
+    end
+end
+
+$ end if
+$ end foreach
+
+redef class EOF
+    redef fun parser_index: Int
+    do
+       return ${tokens/eof/@parser_index}
+    end
+
+    init init_tk(loc: Location)
+    do
+        _text = ""
+               _location = loc
+    end
+end
+
+redef class PError
+    readable var _message: String
+
+    init init_error(message: String, loc: Location)
+    do
+               init_tk(loc)
+               _message = message
+    end
+end
+
+redef class PLexerError
+    readable var _string: String
+
+    init init_lexer_error(message: String, loc: Location, string: String)
+    do
+               init_error(message, loc)
+               _string = string
+    end
+end
+
+redef class PParserError
+    readable var _token: Token
+
+    init init_parser_error(message: String, loc: Location, token: Token)
+    do
+               init_error(message, loc)
+               _token = token
+    end
+end
+$ end template
diff --git a/contrib/pep8analysis/src/pep8analysis.nit b/contrib/pep8analysis/src/pep8analysis.nit
new file mode 100644 (file)
index 0000000..1c334e6
--- /dev/null
@@ -0,0 +1,112 @@
+module pep8analysis
+
+import backbone
+import ast
+import model
+import cfg
+import flow_analysis
+
+redef class AnalysisManager
+       var opt_help = new OptionBool("Display this help message", "--help","-h")
+       var opt_quiet = new OptionBool("Do not show notes", "--quiet","-q")
+       fun quiet: Bool do return opt_quiet.value
+       fun verbose: Bool do return not opt_quiet.value
+
+       var opt_output = new OptionString("Output directory", "--output", "-o")
+
+       redef init
+       do
+               super
+
+               opts.add_option(opt_help)
+               opts.add_option(opt_quiet)
+               opts.add_option(opt_output)
+       end
+
+       fun run
+       do
+               opts.parse(args)
+               var files = opts.rest
+
+               if files.is_empty or opt_help.value then
+                       print "Usage: pep8analysis [options] file.pep [other_file.pep [...]]"
+                       print "Options:"
+                       opts.usage
+                       return
+               end
+
+               var dir = opt_output.value
+               if dir == null then dir = "out"
+               if not dir.file_exists then dir.mkdir
+
+               # Parsing
+               for filename in files do
+                       reset # noter
+
+                       if verbose then print "Analyzing {filename}"
+                       if not filename.file_exists then
+                                       print "Target file \"{filename}\" does not exist."
+                                       exit 1
+                       end
+                       var ast = build_ast( filename )
+                       assert ast != null
+
+                       if failed then continue
+
+                       var mangled_filename = filename.replace("/","-").replace("..","up")
+                       if opt_ast.value then
+                               var printer = new ASTPrinter
+                               printer.enter_visit(ast)
+                               var of = new OFStream.open("{dir}/{mangled_filename.replace(".pep", ".ast.dot")}")
+                               of.write printer.str
+                               of.close
+                       end
+
+                       # Build program model
+                       var model = build_model(ast)
+
+                       if failed then continue
+
+                       if model.lines.is_empty then
+                               fatal_error( ast, "This programs appears empty" )
+                               continue
+                       end
+
+                       # Create CFG
+                       var cfg = build_cfg(model)
+
+                       if opt_cfg.value or opt_cfg_long.value then
+                               var of = new OFStream.open("{dir}/{mangled_filename.replace(".pep", ".cfg.dot")}")
+                               cfg.print_dot(of, opt_cfg_long.value)
+                               of.close
+                       end
+
+                       if failed then continue
+
+                       # Run analyses
+
+                       ## Reaching defs
+                       do_reaching_defs_analysis(cfg)
+
+                       ## Range
+                       do_range_analysis(ast, cfg)
+
+                       ## Types
+                       do_types_analysis(ast, cfg)
+
+                       # Print results
+                       var of = new OFStream.open("{dir}/{mangled_filename.replace(".pep",".analysis.dot")}")
+                       cfg.print_dot(of, true)
+                       of.close
+               end
+               if not opt_quiet.value then
+                       print_notes
+               end
+       end
+end
+
+redef class Object
+       redef fun manager do return once new AnalysisManager
+end
+
+manager.run
diff --git a/contrib/pep8analysis/tests/micro/directive-in-code.pep b/contrib/pep8analysis/tests/micro/directive-in-code.pep
new file mode 100644 (file)
index 0000000..480fc60
--- /dev/null
@@ -0,0 +1,6 @@
+        CHARO   '\n',i
+err0:   .WORD  0
+        STOP
+err1:   CHARO   '\n',i
+        .WORD  1
+        .END
diff --git a/contrib/pep8analysis/tests/micro/range.pep b/contrib/pep8analysis/tests/micro/range.pep
new file mode 100644 (file)
index 0000000..6bd9e1c
--- /dev/null
@@ -0,0 +1,15 @@
+     DECI  in,d
+     LDA   in,d
+     CPA   10,i 
+     BRGT  eq
+neq: LDA   4,i
+     ADDA  1,i
+     BR    end
+eq:  LDA   16,i
+end: SUBA  1,i
+     STA   aff,d
+     DECO  aff,d
+     STOP
+in: .WORD  0
+aff:.BLOCK 0
+    .END
diff --git a/contrib/pep8analysis/tests/micro/to-graph.pep b/contrib/pep8analysis/tests/micro/to-graph.pep
new file mode 100644 (file)
index 0000000..7642d80
--- /dev/null
@@ -0,0 +1,7 @@
+               LDA             0,i
+while: CPA             10,i
+               BREQ    end
+               ADDA    1,i
+               BR              while
+end:   STOP
+               .END
diff --git a/contrib/pep8analysis/tests/micro/types.pep b/contrib/pep8analysis/tests/micro/types.pep
new file mode 100644 (file)
index 0000000..a20f7d1
--- /dev/null
@@ -0,0 +1,9 @@
+               ADDA    123,d ; use of unitialized data
+               LDBYTEA 12,d
+               ADDA    123,d ; use of partially uninitialized data
+               LDA     12,d
+               LDBYTEA 12,d
+               ADDA    123,d ; use of partial word partial byte
+        STOP
+        .WORD  1
+        .END
diff --git a/contrib/pep8analysis/tests/privat/02-fibo.pep b/contrib/pep8analysis/tests/privat/02-fibo.pep
new file mode 100644 (file)
index 0000000..28470f7
--- /dev/null
@@ -0,0 +1,24 @@
+;    Trouve et imprime le premier terme de la suite de Fibonacci
+;    supérieur à 500.
+;       Ph. Gabrini    septembre 2005
+;
+               STA dernier,d
+Fibo:   LDA     somme,d    ;
+Boucle: CPA     500,i      ; while(somme < 500)
+        BRGE    Affiche    ; {
+        LDA     dernier,d  ;
+        STA     avant,d    ;   avant = dernier;
+        LDA     somme,d    ;
+        STA     dernier,d  ;   dernier = somme;
+        ADDA    avant,d    ;
+        STA     somme,d    ;   somme = avant + dernier;
+        BR      Boucle     ; }//while
+Affiche:STRO    msg1,d     ; cout << "Premier ... "
+        DECO    somme,d    ;      << somme
+        CHARO   '\n',i     ;      << endl;
+        STOP
+avant:  .WORD  0        ; int avant = 0;
+dernier:.WORD  1        ; int dernier = 1;
+somme:  .WORD  1        ; int somme = 1;  
+msg1:   .ASCII  "Premier terme de la suite de Fibonacci > 500: \x00"
+        .END
diff --git a/contrib/pep8analysis/tests/privat/04-abc.pep b/contrib/pep8analysis/tests/privat/04-abc.pep
new file mode 100644 (file)
index 0000000..9b3ed22
--- /dev/null
@@ -0,0 +1,18 @@
+; Programme qui calcule a = 7 + (b+5) - (c-4)
+         LDA     7,i         
+         ADDA    b,d         
+         ADDA    5,i         
+         SUBA    c,d         
+         ADDA    4,i         
+         STA     a,d         
+; Meme chose mais regroupe les litéraux
+         LDA     16,i        
+         ADDA    b,i         
+         SUBA    c,d         
+         ADDA    4,i         
+         STA     a,d         
+         STOP                
+a:       .BLOCK  2           ;#2a
+b:       .WORD   1           
+c:       .WORD   2           
+         .END                
diff --git a/contrib/pep8analysis/tests/privat/04-leplusgrand.pep b/contrib/pep8analysis/tests/privat/04-leplusgrand.pep
new file mode 100644 (file)
index 0000000..578133c
--- /dev/null
@@ -0,0 +1,14 @@
+; Programme qui attends deux nombre et affiche le plus grand
+; Jean Privat (c) 2010
+         DECI    x,d         ; x = getInt();
+         DECI    y,d         ; y = getInt();
+         LDA     x,d         
+         CPA     y,d         
+         BRLE    out_y       ; if (x > y) {
+         DECO    x,d         ;   print x;
+         STOP                ;   exit();
+out_y:   DECO    y,d         ; } else { print y;
+         STOP                ;   exit(); }
+x:       .BLOCK  2           ; Premier nombre saisi
+y:       .BLOCK  2           ; Second nombre saisi
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-0et100.pep b/contrib/pep8analysis/tests/privat/05-0et100.pep
new file mode 100644 (file)
index 0000000..c88db52
--- /dev/null
@@ -0,0 +1,28 @@
+; Semaine 5
+; Programme qui demande (poliment) un nombre ;
+; indique s'il est négatif, compris entre 0 et 100 ou plus grand que 100 ;
+; puis dit au revoir.
+; Jean Privat (C) 2010
+         STRO    bjourMsg,d  ; print ...
+         DECI    nb,d        
+         LDA     nb,d        ; A = readInt();
+         CPA     min,i       
+         BRGE    pasNeg      ; if (A<min) {
+         STRO    negMsg,d    ;   print ...
+         BR      bye         
+pasNeg:  CPA     max,i       
+         BRGT    pasMoyen    ; } else if (a<=max) {
+         STRO    moyenMsg,d  ;   print...
+         BR      bye         ; } else {
+pasMoyen:STRO    grandMsg,d  ;   print ... }
+bye:     STRO    byeMsg,d    ; print ...
+         STOP                
+bjourMsg:.ASCII  "Entrez un nombre (SVP) : \x00"
+moyenMsg:.ASCII  "Compris entre 0 et 100\n\x00"
+grandMsg:.ASCII  "Plus grand que 100\n\x00"
+negMsg:  .ASCII  "Négatif\n\x00"
+byeMsg:  .ASCII  "Au revoir.\n\x00"
+nb:      .BLOCK  2           
+min:     .EQUATE 0           
+max:     .EQUATE 100         
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-1a100.pep b/contrib/pep8analysis/tests/privat/05-1a100.pep
new file mode 100644 (file)
index 0000000..fd6ec4b
--- /dev/null
@@ -0,0 +1,14 @@
+; Semaine 5
+; Programme qui compte de 1 jusqu'à 100
+; Jean Privat (C) 2010
+         LDA     1,i         
+loop:    CPA     100,i       
+         BRGT    fin         ; for(val=1; val<=100; val++) {
+         STA     val,d       
+         DECO    val,d       
+         CHARO   '\n',i      ;   print(val, "\n");
+         ADDA    1,d         
+         BR      loop        ; } // end of for
+fin:     STOP                
+val:     .BLOCK  2           
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-aei.pep b/contrib/pep8analysis/tests/privat/05-aei.pep
new file mode 100644 (file)
index 0000000..7db90e1
--- /dev/null
@@ -0,0 +1,24 @@
+; Semaine 5
+; Programme qui lit un ligne et transforme les 'a' en 4, les 'e' en '3' et les 'i' en '1'.
+; Jean Privat (C) 2010
+lit_char:LDA     0,i         ; do {
+         CHARI   c,d         
+         LDBYTEA c,d         ;   A = getChar();
+         CPA     'a',i       
+         BRNE    pas_a       ;   if (A == 'a') {
+         CHARO   '4',i       ;     print('4');
+         BR      lit_char    
+pas_a:   CPA     'e',i       
+         BRNE    pas_e       ;   } else if (A == 'e') {
+         CHARO   '3',i       ;     print('3');
+         BR      lit_char    
+pas_e:   CPA     'i',i       
+         BRNE    pas_i       ;   } else if (A == 'i') {
+         CHARO   '1',i       ;     print('1');
+         BR      lit_char    
+pas_i:   CHARO   c,d         ;   } else print(A);
+         CPA     '\n',i      
+         BRNE    lit_char    ; } while (A != '\n');
+         STOP                ; exit;
+c:       .BLOCK  1           ; #1c Caractère lu et éventuellemet écrit
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-otan.pep b/contrib/pep8analysis/tests/privat/05-otan.pep
new file mode 100644 (file)
index 0000000..2806a7f
--- /dev/null
@@ -0,0 +1,74 @@
+loop:    LDX     0,i         ; do {
+         CHARI   c,d         
+         LDBYTEX c,d         ; X = getChar();
+         CPX     '\n',i      
+         BREQ    fin         ; if (X == '\n') break;
+         CPX     'a',i       
+         BRLT    error       
+         CPX     'z',i       
+         BRGT    error       ; if (X < 'a' || X > 'z') throws error;
+         SUBX    'a',i       ; X -= 'a'; // X = rang dans l'alphabet
+         ASLX                
+         LDA     table,x     
+         STA     case,d      ; case = table[X*2]; //*x car un pointeur est un mot
+         STRO    case,n      
+         CHARO   '\n',i      ; print(*case, "\n")
+         BR      loop        ; }
+error:   STRO    errMsg,d    ; catch error: print errMsg
+fin:     STOP                
+errMsg:  .ASCII  "Caractère invalide\n\x00"
+c:       .BLOCK  1           ; #1c
+case:    .BLOCK  2           ; #2h
+table:   .ADDRSS sa          
+         .ADDRSS sb          
+         .ADDRSS sc          
+         .ADDRSS sd          
+         .ADDRSS se          
+         .ADDRSS sf          
+         .ADDRSS sg          
+         .ADDRSS sh          
+         .ADDRSS si          
+         .ADDRSS sj          
+         .ADDRSS sk          
+         .ADDRSS sl          
+         .ADDRSS sm          
+         .ADDRSS sn          
+         .ADDRSS so          
+         .ADDRSS sp          
+         .ADDRSS sq          
+         .ADDRSS sr          
+         .ADDRSS ss          
+         .ADDRSS st          
+         .ADDRSS su          
+         .ADDRSS sv          
+         .ADDRSS sw          
+         .ADDRSS sx          
+         .ADDRSS sy          
+         .ADDRSS sz          
+sa:      .ASCII  "alpha\x00" 
+sb:      .ASCII  "bravo\x00" 
+sc:      .ASCII  "charlie\x00"
+sd:      .ASCII  "delta\x00" 
+se:      .ASCII  "echo\x00"  
+sf:      .ASCII  "fox-trot\x00"
+sg:      .ASCII  "golf\x00"  
+sh:      .ASCII  "hotel\x00" 
+si:      .ASCII  "india\x00" 
+sj:      .ASCII  "juliet\x00"
+sk:      .ASCII  "kilo\x00"  
+sl:      .ASCII  "lima\x00"  
+sm:      .ASCII  "mike\x00"  
+sn:      .ASCII  "november\x00"
+so:      .ASCII  "oscar\x00" 
+sp:      .ASCII  "papa\x00"  
+sq:      .ASCII  "quebec\x00"
+sr:      .ASCII  "romeo\x00" 
+ss:      .ASCII  "sierra\x00"
+st:      .ASCII  "tango\x00" 
+su:      .ASCII  "uniform\x00"
+sv:      .ASCII  "victor\x00"
+sw:      .ASCII  "whiskey\x00"
+sx:      .ASCII  "x-ray\x00" 
+sy:      .ASCII  "yankee\x00"
+sz:      .ASCII  "zulu\x00"  
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-simul_3n.pep b/contrib/pep8analysis/tests/privat/05-simul_3n.pep
new file mode 100644 (file)
index 0000000..6f41ebe
--- /dev/null
@@ -0,0 +1,28 @@
+; Semaine 5
+; Simulation de l'adressage indirect triple
+; Jean Privat (C) 2010
+;
+; Expression à simuler (n'existe pas en Pep/8)
+; CHARO b,3n ; mem[mem[mem[mem[b]]]]
+;
+; Simulation avec adressages immédiats et indexés
+         LDX     b,i         ; X <- b
+         LDX     0,x         ; X <- mem[X+0] = mem[b] = c
+         LDX     0,x         ; X <- mem[X+0] = mem[c] = d
+         LDX     0,x         ; X <- mem[X+0] = mem[d] = e
+         CHARO   0,x         ; mem[X+0] = mem[e] = '!'
+;
+; Simulation avec adressages directs et indirects
+         LDA     b,n         ; A <- mem[mem[b]] = mem[c] = d
+         STA     ptr,d       ; mem[ptr] <- A = d
+         LDA     ptr,n       ; A <- mem[mem[ptr]] = mem[d] = e
+         STA     ptr,d       ; mem[ptr] <- A = e
+         CHARO   ptr,n       ; mem[mem[ptr]] = mem[e] = '!'
+;
+         STOP                
+b:       .ADDRSS c           
+c:       .ADDRSS d           
+d:       .ADDRSS e           
+e:       .BYTE   '!'         
+ptr:     .BLOCK  2           ; #2h
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-simul_n.pep b/contrib/pep8analysis/tests/privat/05-simul_n.pep
new file mode 100644 (file)
index 0000000..544be0a
--- /dev/null
@@ -0,0 +1,13 @@
+; Semaine 5
+; Simulation de l'adressage indirect avec l'adressage indexé
+; Jean Privat (C) 2010
+;
+; Version originale
+         CHARO   b,n         ; A <- mem[mem[b]] = mem[c] = '!'
+; Version simulée
+         LDX     b,d         ; X <- mem[b] = c
+         CHARO   0,x         ; A <- mem[0+X] = mem[c] = '!'
+         STOP                
+b:       .ADDRSS c           ; mem[b] contient l'adresse de c (sur 2 octets)
+c:       .BYTE   '!'         
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-simul_x.pep b/contrib/pep8analysis/tests/privat/05-simul_x.pep
new file mode 100644 (file)
index 0000000..4c8d1a0
--- /dev/null
@@ -0,0 +1,17 @@
+; Semaine 5
+; Simulation de l'adressage indexé avec l'adressage indirect
+; Jean Privat (C) 2010
+;
+; Version originale
+         LDX     index,d     ; X = mem[index] = 4
+         CHARO   mot,x       ; mem[mot+X] = mem[mot+4] = 'X'
+; Version simulée
+         LDA     mot,i       ; A <- mot
+         ADDA    index,d     ; A <- A+mem[index] = mot+4
+         STA     ptr,d       ; mem[ptr] <- A = mot+4
+         CHARO   ptr,n       ; mem[mem[ptr]] = mem[mot+4] = 'X'
+         STOP                
+index:   .WORD   4           
+mot:     .ASCII  "....X...." 
+ptr:     .BLOCK  2           ; #2h
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/05-sommeVec.pep b/contrib/pep8analysis/tests/privat/05-sommeVec.pep
new file mode 100644 (file)
index 0000000..3ca8c30
--- /dev/null
@@ -0,0 +1,20 @@
+; Semaine 5
+; Programme qui calcule la somme des éléments d'un tableau
+; Jean Privat (C) 2010
+         LDA     0,i         ; somme = 0
+         LDX     0,i         ; X = 0
+loop:    ADDA    vecteur,x   ; do{ somme += vecteur[X]
+         ADDX    2,i         ;   X++;
+         CPX     lenVec,i    
+         BRLT    loop        ; } while (X<lenVec);
+         STA     somme,d     
+         DECO    somme,d     ; print(somme);
+         STOP                
+vecteur: .WORD   5           ; un vecteur d'octets
+         .WORD   6           
+         .WORD   2           
+         .WORD   7           
+         .WORD   8           
+lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
+somme:   .BLOCK  2           ; #2d somme calculée du vecteur
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-calc-non-pur.pep b/contrib/pep8analysis/tests/privat/06-calc-non-pur.pep
new file mode 100644 (file)
index 0000000..8ab5a39
--- /dev/null
@@ -0,0 +1,33 @@
+; Semaine 6
+; Programme non pur qui fait des opérations multiples
+; Jean Privat (C) 2010
+         DECI    num,d       
+         LDX     num,d       ; X = nombre opération = getNombre();
+         CHARI   op,d        
+         LDA     0,i         
+         LDBYTEA op,d        ; A = op = getChar()
+         CPA     '+',i       ; if (A == '+') ;
+         BREQ    loop        
+         CPA     '-',i       
+         BRNE    error       ; else if (A == '-') {
+         LDBYTEA subad,d     
+         STBYTEA instr,d     ;   remplace l'instruction à instr par SUBA
+         BR      loop        ; } else {
+error:   STRO    errMsg,d    ;   print error;
+         STOP                ;   exit; }
+loop:    SUBX    1,i         ; while(--X >= 0) {
+         BRLT    fin         
+         DECI    num,d       
+         LDA     num,d       
+         DECI    num,d       
+instr:   ADDA    num,d       ;   num = getInt() + getInt() // ou - si remplassage
+         STA     num,d       
+         DECO    num,d       
+         CHARO   '\n',i      ;   print(num, "\n")
+         BR      loop        ; } // fin while
+fin:     STOP                
+op:      .BLOCK  1           ; #1c symbole de l'opération
+num:     .BLOCK  2           ; nombre entrée, calculé et affiché
+errMsg:  .ASCII  "Attendu '+' ou '-'\x00"
+subad:   SUBA    0,d         ; code opération instruction
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-compte1.pep b/contrib/pep8analysis/tests/privat/06-compte1.pep
new file mode 100644 (file)
index 0000000..9b42f00
--- /dev/null
@@ -0,0 +1,19 @@
+; Semaine 6
+; Programme qui compte le nombre de bits à 1
+; Jean Privat (C) 2010
+         LDX     0,i         ; cpt = 0;
+         DECI    num,d       
+         LDA     num,d       ; num = getNumber();
+loop:    BREQ    fin         ; while (num!=0) {
+         ASLA                ;   num<<1
+         BRC     un          ;   if (bit perdu == 1) {
+         BR      loop        
+un:      ADDX    1,i         ;     cpt++; }
+         BR      loop        ; } // fin while
+fin:     STX     num,d       
+         DECO    num,d       
+         STRO    msg,d       ; print ...
+         STOP                
+num:     .BLOCK  2           
+msg:     .ASCII  " un(s) trouvé(s).\n\x00"
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-majuscules.pep b/contrib/pep8analysis/tests/privat/06-majuscules.pep
new file mode 100644 (file)
index 0000000..1da4e34
--- /dev/null
@@ -0,0 +1,18 @@
+; Semaine 6
+; Programme qui transforme les minuscules en majuscules
+; Jean Privat (C) 2010
+loop:    CHARI   c,d         ; do {
+         LDA     0,i         
+         LDBYTEA c,d         ; c = getChar();
+         CPA     'a',i       
+         BRLT    out         
+         CPA     'z',i       
+         BRGT    out         ; if (c>='a' && c<='z') {
+         ANDA    0x00DF,i    
+         STBYTEA c,d         ; c = c & 0xDF; // mise en majuscule }
+out:     CHARO   c,d         ; print(c);
+         CPA     '\n',i      
+         BRNE    loop        ; } while (c != '\n')
+fin:     STOP                
+c:       .BLOCK  1           ; #1c
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-menu.pep b/contrib/pep8analysis/tests/privat/06-menu.pep
new file mode 100644 (file)
index 0000000..b4cc508
--- /dev/null
@@ -0,0 +1,40 @@
+; Semaine 6
+; Programme qui affiche un menu
+; Jean Privat (C) 2010
+menu:    STRO    menuTxt,d   ; print(menu)
+         DECI    opt,d       ; opt = readNumber()
+         LDX     opt,d       
+         CPX     1,i         
+         BRLT    err         
+         CPX     5,i         
+         BRGT    err         ; if (opt<1 || opt>5) throws new Error();
+         SUBX    1,i         
+         ASLX                
+         BR      case,x      ; switch(opt) { // X = (opt-1)*2
+case:    .ADDRSS cas1        
+         .ADDRSS cas2        
+         .ADDRSS cas3        
+         .ADDRSS cas4        
+cas1:    STRO    cas1Msg,d   ; case 1: ...
+         BR      menu        ; break;
+cas2:    STRO    cas2Msg,d   ; case 2: ...
+         BR      menu        ; break;
+cas3:    STRO    cas3Msg,d   ; case 3: ...
+         BR      menu        ; break;
+cas4:    STOP                ; case 4: ...
+err:     STRO    errMsg,d    
+         BR      menu        
+menuTxt: .ASCII  "******************\n"
+         .ASCII  "*     M E N U    *\n"
+         .ASCII  "* [1]-raz        *\n"
+         .ASCII  "* [2]-ajouter    *\n"
+         .ASCII  "* [3]-soustraire *\n"
+         .ASCII  "* [4]-quitter    *\n"
+         .ASCII  "******************\n"
+         .ASCII  "Votre choix : \x00"
+opt:     .BLOCK  2           
+errMsg:  .ASCII  "Erreur: Option invalide\n\x00"
+cas1Msg: .ASCII  "RAZ\n\x00" 
+cas2Msg: .ASCII  "...\n\x00" 
+cas3Msg: .ASCII  "...\n\x00" 
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-print-non-pur.pep b/contrib/pep8analysis/tests/privat/06-print-non-pur.pep
new file mode 100644 (file)
index 0000000..eadafd4
--- /dev/null
@@ -0,0 +1,17 @@
+; Semaine 6
+; Programme non pur qui affiche une chaîne
+; Jean Privat (C) 2010
+loop:    LDA     0,i         
+         LDBYTEA msg,d       
+         BREQ    fin         ; while(msg[0]!=0) {
+         CHARO   msg,d       ;   print msg[0];
+         LDA     op1,d       
+         ADDA    1,i         
+         STA     op1,d       
+         STA     op2,d       ;   msg++;
+         BR      loop        ; }
+fin:     STOP                
+msg:     .ASCII  "Hello World\x00"
+op1:     .EQUATE 0x0004      ; Adresse de l'opérande du LDBYTEA msg
+op2:     .EQUATE 0x000A      ; Adresse de l'opérande du CHARO msg
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-processVec.pep b/contrib/pep8analysis/tests/privat/06-processVec.pep
new file mode 100644 (file)
index 0000000..3ca8c30
--- /dev/null
@@ -0,0 +1,20 @@
+; Semaine 5
+; Programme qui calcule la somme des éléments d'un tableau
+; Jean Privat (C) 2010
+         LDA     0,i         ; somme = 0
+         LDX     0,i         ; X = 0
+loop:    ADDA    vecteur,x   ; do{ somme += vecteur[X]
+         ADDX    2,i         ;   X++;
+         CPX     lenVec,i    
+         BRLT    loop        ; } while (X<lenVec);
+         STA     somme,d     
+         DECO    somme,d     ; print(somme);
+         STOP                
+vecteur: .WORD   5           ; un vecteur d'octets
+         .WORD   6           
+         .WORD   2           
+         .WORD   7           
+         .WORD   8           
+lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
+somme:   .BLOCK  2           ; #2d somme calculée du vecteur
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-puissance2.pep b/contrib/pep8analysis/tests/privat/06-puissance2.pep
new file mode 100644 (file)
index 0000000..b179cdf
--- /dev/null
@@ -0,0 +1,20 @@
+; Semaine 6
+; Programme qui vérifie si un nombre est une puissance de 2
+; Jean Privat (C) 2010
+         DECI    num,d       
+         LDA     num,d       ; num = getNombre()
+         BREQ    non         ; if (num == 0) pas puissance de 2
+         BRGE    positif     ; if (num < 0) {
+         NEGA                
+         STA     num,d       ; num = -num; }
+positif: SUBA    1,i         
+         ANDA    num,d       ; A = num & num-1
+         BRNE    non         ; if (A != 0) pas puissance de 2
+         STRO    puiMsg,d    ; print ...
+         STOP                
+non:     STRO    pasMsg,d    ; print ...
+         STOP                
+num:     .BLOCK  2           ; #2d
+pasMsg:  .ASCII  "Pas une puissance de 2.\n\x00"
+puiMsg:  .ASCII  "C'est une puissance de 2.\n\x00"
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-sommes1.pep b/contrib/pep8analysis/tests/privat/06-sommes1.pep
new file mode 100644 (file)
index 0000000..b3b4bd1
--- /dev/null
@@ -0,0 +1,37 @@
+; Semaine 6
+; Programme calcule et compare deux sommes
+; Version sans sous-programme
+; Jean Privat (C) 2010
+         STRO    msgNum1,d   
+         DECI    num,d       
+         LDA     num,d       
+         STRO    msgNum2,d   
+         DECI    num,d       
+         ADDA    num,d       
+         STA     num,d       
+         STRO    msgSomme,d  
+         DECO    num,d       
+         CHARO   '\n',i      ; Lecture, calcul et affichage somme 1
+         STA     sum1,d      ; sauvegarde somme 1
+         STRO    msgNum1,d   
+         DECI    num,d       
+         LDA     num,d       
+         STRO    msgNum2,d   
+         DECI    num,d       
+         ADDA    num,d       
+         STA     num,d       
+         STRO    msgSomme,d  
+         DECO    num,d       
+         CHARO   '\n',i      ; Lecture, calcul et affichage somme 2
+         CPA     sum1,d      ; if (somme2>somme1) {
+         BRGT    plus        
+         STOP                
+plus:    STRO    msgPlus,d   ;   print ... }
+         STOP                ; exit;
+num:     .BLOCK  2           ; #2d
+sum1:    .BLOCK  2           ; #2d
+msgNum1: .ASCII  "Entrez un nombre : \x00"
+msgNum2: .ASCII  "Entrez un autre nombre : \x00"
+msgSomme:.ASCII  "Leur somme est : \x00"
+msgPlus: .ASCII  "Celle-ci est plus grande.\x00"
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/06-sommes2.pep b/contrib/pep8analysis/tests/privat/06-sommes2.pep
new file mode 100644 (file)
index 0000000..1b098f5
--- /dev/null
@@ -0,0 +1,33 @@
+; Semaine 6
+; Programme calcule et compare deux sommes
+; Version sans sous-programme + pseudo-boucle (variable étape)
+; Jean Privat (C) 2010
+debut:   STRO    msgNum1,d   ; do {
+         DECI    num,d       
+         LDA     num,d       
+         STRO    msgNum2,d   
+         DECI    num,d       
+         ADDA    num,d       
+         STA     num,d       
+         STRO    msgSomme,d  
+         DECO    num,d       
+         CHARO   '\n',i      ;   Lecture, calcul et affichage somme 1
+         LDA     etape,d     ;   if (etape == 0) {
+         BRNE    fin         
+         STA     sum1,d      ;     sauvegarde somme 1;
+         LDA     1,i         
+         STA     etape,d     ;     etape = 1; }
+         BR      debut       ; } while(etape==0);
+fin:     CPA     sum1,d      ; if (somme2>somme1) {
+         BRGT    plus        
+         STOP                
+plus:    STRO    msgPlus,d   ;   print ... }
+         STOP                ; exit;
+num:     .BLOCK  2           ; #2d
+sum1:    .BLOCK  2           ; #2d
+etape:   .BLOCK  2           ; #2d 0=on calcule la premier somme, 1=on cacule la 2eme somme
+msgNum1: .ASCII  "Entrez un nombre : \x00"
+msgNum2: .ASCII  "Entrez un autre nombre : \x00"
+msgSomme:.ASCII  "Leur somme est : \x00"
+msgPlus: .ASCII  "Celle-ci est plus grande.\x00"
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/06-sommes3.pep b/contrib/pep8analysis/tests/privat/06-sommes3.pep
new file mode 100644 (file)
index 0000000..94626a4
--- /dev/null
@@ -0,0 +1,33 @@
+; Semaine 6
+; Programme calcule et compare deux sommes
+; Version avec sous-programme
+; Jean Privat (C) 2010
+         CALL    getSomme    
+         STA     sum1,d      ; sauvegarde somme 1;
+         CALL    getSomme    
+fin:     CPA     sum1,d      ; if (somme2>somme2) {
+         BRGT    plus        
+         STOP                
+plus:    STRO    msgPlus,d   ;   print ... }
+         STOP                ; exit;
+sum1:    .BLOCK  2           ; #2d
+;
+; getSomme: Demande deux nombres et affiche leur somme
+; OUT: A=somme des nombres
+getSomme:STRO    msgNum1,d   ; do {
+         DECI    num,d       
+         LDA     num,d       
+         STRO    msgNum2,d   
+         DECI    num,d       
+         ADDA    num,d       
+         STA     num,d       
+         STRO    msgSomme,d  
+         DECO    num,d       
+         CHARO   '\n',i      
+         RET0                
+num:     .BLOCK  2           ; #2d
+msgNum1: .ASCII  "Entrez un nombre : \x00"
+msgNum2: .ASCII  "Entrez un autre nombre : \x00"
+msgSomme:.ASCII  "Leur somme est : \x00"
+msgPlus: .ASCII  "Celle-ci est plus grande.\x00"
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/06-x100.pep b/contrib/pep8analysis/tests/privat/06-x100.pep
new file mode 100644 (file)
index 0000000..bb1d27b
--- /dev/null
@@ -0,0 +1,22 @@
+; Semaine 6
+; Programme qui multiplie un nombre par 100
+; Jean Privat (C) 2010
+         DECI    num,d       
+         LDA     num,d       ; num = getNumber()
+         ASLA                
+         ASLA                
+         STA     x4,d        ; x4 = num*4
+         ASLA                
+         ASLA                
+         ASLA                
+         STA     x32,d       ; x32 = num*32
+         ASLA                
+         ADDA    x4,d        
+         ADDA    x32,d       
+         STA     num,d       ; num = num*64 + x4 + x32; // = num*100
+         DECO    num,d       ; print num
+         STOP                
+num:     .BLOCK  2           
+x4:      .BLOCK  2           
+x32:     .BLOCK  2           
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/07-matrice.pep b/contrib/pep8analysis/tests/privat/07-matrice.pep
new file mode 100644 (file)
index 0000000..4755a18
--- /dev/null
@@ -0,0 +1,37 @@
+; Semaine 7
+; Programme qui lit un matrice 4x3 d'entiers et affiche la transposée
+; Jean Privat (c) 2010
+;
+; Attention, 2 octets par mot.
+         LDX     0,i         
+in_loop: CPX     24,i        
+         BRGE    afficher    ; for(X=0;X<24;X+=2) {
+         DECI    vecteur,x   ;   vecteur[X] = getInt();
+         ADDX    2,i         
+         BR      in_loop     ; } // fin for
+afficher:LDX     0,i         
+         STX     ix,d        
+loop_ix: CPX     8,i         
+         BRGE    fin         ; for(ix=0;ix<8;ix+=2) {
+         LDX     0,i         
+         STX     jx,d        
+loop_jx: CPX     24,i        
+         BRGE    next_ix     ;   for(jx=0;jx<24;jx+=8) {
+         ADDX    ix,d        
+         DECO    vecteur,x   
+         CHARO   ' ',i       ;     print(vecteur[ix+jx], " ");
+         LDX     jx,d        
+         ADDX    8,i         
+         STX     jx,d        
+         BR      loop_jx     ;   } // fin for jx
+next_ix: CHARO   '\n',i      ;
+         LDX     ix,d        
+         ADDX    2,i         
+         STX     ix,d        
+         BR      loop_ix     ; } // fin for ix
+fin:     STOP                ; exit();
+; Variables globales
+vecteur: .BLOCK  24          ; #2d12a vecteur de 10 entiers
+ix:      .BLOCK  2           ; #2d itérateur ix pour tri
+jx:      .BLOCK  2           ; #2d itérateur jx pour tri
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/07-stri.pep b/contrib/pep8analysis/tests/privat/07-stri.pep
new file mode 100644 (file)
index 0000000..c1bb08f
--- /dev/null
@@ -0,0 +1,46 @@
+; Semaine 7
+; Programme qui lit une chaîne de caractère (et l'affiche deux fois)
+; Jean Privat (c) 2010
+         LDA     buffer,i    
+         LDX     size,i      
+         CALL    STRI        ; STRI(buffer,size);
+         STRO    buffer,d    
+         CHARO   '\n',i      
+         STRO    buffer,d    ; print(buffer + '\n' + buffer);
+         STOP                ; exit();
+buffer:  .BLOCK  20          ; Buffer for the string
+size:    .EQUATE 20          ; Size of the buffer
+;
+; STRI: lit une ligne dans un tampon et place '\x00' à la fin
+; In:  A=Adresse du tampon
+;      X=Taille du tampon en octet
+; Out: A=Adresse du tampon (inchangé)
+;      X=Nombre de caractères lu (ou offset du '\x00')
+; Err: Avorte si le tampon n'est pas assez grand pour
+;      stocker la ligne et le '\0' final
+STRI:    STA     striPtr,d   ; sauve A;
+         ADDX    striPtr,d   
+         STX     striPtr2,d  ; striPtr2 = A+X;
+         LDX     striPtr,d   ; X = striPtr;
+striLoop:CPX     striPtr2,d  ; while(true) {
+         BRGE    striErr     ;   if(X>=striPtr2) throws new Error();
+         CHARI   0,x         ;   *X = getChar();
+         LDA     0,i         
+         LDBYTEA 0,x         
+         CPA     '\n',i      
+         BREQ    striFin     
+         CPA     '\x00',i    
+         BREQ    striFin     ;   if(*X=='\n' || *X=='\x00') break;
+         ADDX    1,i         ;   X++;
+         BR      striLoop    ; } // fin boucle infinie
+striFin: LDBYTEA 0,i         
+         STBYTEA 0,x         ; *X='\x00';
+         SUBX    striPtr,d   ; X = X-striPtr
+         LDBYTEA striPtr,d   ; restaure A;
+         RET0                ; return;
+striErr: STRO    striEMsg,d  
+         STOP                
+striEMsg:.ASCII  "STRI erreur: débordement de capacité\n\x00"
+striPtr: .BLOCK  2           ; #2d adresse de début du tampon
+striPtr2:.BLOCK  2           ; #2d adresse de fin de tampon (à ne pas écrire)
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/07-stris.pep b/contrib/pep8analysis/tests/privat/07-stris.pep
new file mode 100644 (file)
index 0000000..5152da7
--- /dev/null
@@ -0,0 +1,82 @@
+; Semaine 7
+; Programme qui lit une chaîne de caractère (et l'affiche deux fois)
+; Jean Privat (c) 2010
+         LDX     0,i
+         STX     il,d
+in_loop:         CPX     nblines,i 
+         BRGE    afficher ; for(il=0;il<nblines;il++) {
+         LDA     cursor,d    
+         LDX     size,d      
+         CALL    STRI        ;   X = STRI(cursor,size);
+         CPX     0,i
+         BREQ    afficher    ;   if (X==0) break;
+         ADDX    1,i
+         STX     used,d      ;   used = X + 1; 
+         ADDX    cursor,d
+         STX     cursor,d    ;   cursor += used;
+         LDX     size,d
+         SUBX    used,d
+         STX     size,d      ;   size -= used;
+         LDX     il,d
+         ASLX
+         STA     lines,x     ;   lines[il*2] = A; // old cursor
+         ASRX
+         ADDX    1,i
+         STX     il,d        
+         BR in_loop          ; } // fin for il
+afficher: LDX    il,d
+         SUBX 1,i
+         ASLX
+aff_loop:         BRLT fin ; for(X=(il-1)*2; X<=0; X-=2) {
+         LDA lines,x
+         STA cursor,d
+         STRO cursor,n   
+         CHARO '\n',i ;   print(lines[X] + "\n");
+         SUBX 2,i 
+         BR aff_loop ; } // fin for 
+fin: STOP ; exit();
+
+         STOP                ; exit();
+;
+buffer:  .BLOCK  200         ; Tampon pour les chaînes
+cursor:  .ADDRSS buffer      ; Pointeur vers la partie libre du tampon
+size:    .WORD   200         ; Nombre d'octets libres dans le tampon
+used:    .BLOCK  2           ; Nombre d'octets utilisés par la dernière lecture
+;
+lines:   .BLOCK  20          ; Tableau de lignes
+nblines: .EQUATE 20          ; Nombre maximum de lignes
+il:      .BLOCK  2           ; #2d Index de boucle pour parcourir 'lines'
+;
+; STRI: lit une ligne dans un tampon et place '\x00' à la fin
+; In:  A=Adresse du tampon
+;      X=Taille du tampon en octet
+; Out: A=Adresse du tampon (inchangé)
+;      X=Nombre de caractères lu (ou offset du '\x00')
+; Err: Avorte si le tampon n'est pas assez grand pour
+;      stocker la ligne et le '\0' final
+STRI:    STA     striPtr,d   ; sauve A;
+         ADDX    striPtr,d   
+         STX     striPtr2,d  ; striPtr2 = A+X;
+         LDX     striPtr,d   ; X = striPtr;
+striLoop:CPX     striPtr2,d  ; while(true) {
+         BRGE    striErr     ;   if(X>=striPtr2) throws new Error();
+         CHARI   0,x         ;   *X = getChar();
+         LDA     0,i         
+         LDBYTEA 0,x         
+         CPA     '\n',i      
+         BREQ    striFin     
+         CPA     '\x00',i    
+         BREQ    striFin     ;   if(*X=='\n' || *X=='\x00') break;
+         ADDX    1,i         ;   X++;
+         BR      striLoop    ; } // fin boucle infinie
+striFin: LDBYTEA 0,i         
+         STBYTEA 0,x         ; *X='\x00';
+         SUBX    striPtr,d   ; X = X-striPtr
+         LDA     striPtr,d   ; restaure A;
+         RET0                ; return;
+striErr: STRO    striEMsg,d  
+         STOP                
+striEMsg:.ASCII  "STRI erreur: débordement de capacité\n\x00"
+striPtr: .BLOCK  2           ; #2d adresse de début du tampon
+striPtr2:.BLOCK  2           ; #2d adresse de fin de tampon (à ne pas écrire)
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/07-tri.pep b/contrib/pep8analysis/tests/privat/07-tri.pep
new file mode 100644 (file)
index 0000000..865f3a5
--- /dev/null
@@ -0,0 +1,54 @@
+; Semaine 7
+; Programme qui trie un tableau de 10 entiers
+; Jean Privat (c) 2010
+;
+; Attention, 2 octets par mot.
+; Étape 1 : lit 10 entier et les range dans vecteur
+         LDX     0,i         
+in_loop: CPX     20,i        
+         BRGE    trier       ; for(X=0;X<20;X+=2) {
+         DECI    vecteur,x   ;   vecteur[X] = getInt();
+         ADDX    2,i         
+         BR      in_loop     ; } // fin for
+; Étape 2 : trie le vecteur (algo: tri par permutation)
+trier:   LDX     18,i        
+         STX     ix,d        
+loop_ix: BRLT    afficher    ; for(ix=18;ix>=0;ix-=2) {
+         SUBX    2,i         
+         STX     jx,d        ;   for(jx=ix-2;jx>=0;jx-=2) {
+loop_jx: BRLT    next_ix     
+         LDA     vecteur,x   
+         LDX     ix,d        
+         CPA     vecteur,x   
+         BRLE    next_jx     ;     if (vecteur[jx] > vecteur[ix]) {
+         STA     tmp,d       ;       tmp = vecteur[jx];
+         LDX     ix,d        
+         LDA     vecteur,x   
+         LDX     jx,d        
+         STA     vecteur,x   ;       vecteur[jx] = vecteur[ix];
+         LDA     tmp,d       
+         LDX     ix,d        
+         STA     vecteur,x   ;       vecteur[ix] = tmp;
+next_jx: LDX     jx,d        
+         SUBX    2,i         
+         STX     jx,d        
+         BR      loop_jx     ;     } // fin for jx
+next_ix: LDX     ix,d        
+         SUBX    2,i         
+         STX     ix,d        
+         BR      loop_ix     ;   } // fin for ix
+; Étape 3 : affiche le tableau trié
+afficher:LDX     0,i         
+out_loop:CPX     20,i        
+         BRGE    fin         ; for(X=0;X<20;X++) {
+         DECO    vecteur,x   
+         CHARO   '\n',i      ;   print(vecteur[X], "\n");
+         ADDX    2,i         
+         BR      out_loop    ; } // fin for
+fin:     STOP                ; exit();
+; Variables globales
+vecteur: .BLOCK  20          ; #2d10a vecteur de 10 entiers
+ix:      .BLOCK  2           ; #2d itérateur ix pour tri
+jx:      .BLOCK  2           ; #2d itérateur jx pour tri
+tmp:     .BLOCK  2           ; #2d variable temporaire pour échange
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/07-tri2.pep b/contrib/pep8analysis/tests/privat/07-tri2.pep
new file mode 100644 (file)
index 0000000..ec915ce
--- /dev/null
@@ -0,0 +1,93 @@
+; Programme qui lit 10 entiers, les trie et les affiche
+; (c) Jean Privat 2012
+; Note: Ce programme essaye d'être aussi lisible que possible, donc aucune optimisation assembleur n'est faite
+;
+; progamme princial
+; le programme est découpé en trois étapes : - la lecture ; 2 - le tri ; 3 - l'affichage.
+; Théoriquement, le tri et l'afichage aurait pu etre fusionés, mais cela compexifie la lecture et le gain en performance est minime.
+         CALL    lire        ;
+         CALL    trier       ;
+         CALL    ecrire      ;
+         STOP                
+tab:     .BLOCK  20          ; int[10] tab // #2d10a Tableau de 10 entiers (1 mot par entier)
+tablen:  .EQUATE 20          ; // taille du tableau (en octets)
+;
+;
+;lire: lit les entiers de l'input et les range dans le tableau.
+; l'algo utilise une simple boucle sur X pour lire toutes les cases
+lire:    LDX     0,i         
+lire_bcl:CPX     tablen,i    
+         BRGE    lire_fin    ; for (X=0; X<tablen; X+=2) { // 2 car on compte les octets
+         DECI    tab,x       ;   tab[X] = DECI();
+         ADDX    2,i         
+         BR      lire_bcl    ; } // fin for
+lire_fin:RET0                ; return;
+;
+;
+;ecrire: ecrit les entiers du tableau sur l'output en les séparants par des espaces et en terminant la ligne par un retour chariot.
+; l'algo utilise une simple boucle sur X pour écrire toutes les cases
+ecrire:  LDX     0,i         
+ecri_bcl:CPX     tablen,i    
+         BRGE    ecri_fin    ; for (X=0; X<tablen; X+=2) { // 2 car on compte les octets
+         DECO    tab,x       
+         CHARO   ' ',i       ;   print(tab[X], ' ');
+         ADDX    2,i         
+         BR      ecri_bcl    ; } // fin for
+ecri_fin:CHARO   '\n',i      
+         RET0                ; return;
+;
+;
+;trier: trie par permutation du tableau.
+; l'algo utilise deux boucles impriquées
+trier:   LDX     0,i         
+         STX     i,d         
+tri_bcl1:LDX     i,d         
+         CPX     tablen,i    
+         BRGE    trie_fin    ; for(i=0; i<tablen; i+=2) { // grande boucle
+;                            ;   // l'objectif de cette grande boucle est de mettre dans tab[i] le plus petit element restant
+;                            ;   // l'invariant de boucle est que les éléments avant i sont déjà bien placés (triés)
+;
+         LDX     i,d         
+         ADDX    2,i         
+         STX     j,d         
+tri_blc2:LDX     j,d         
+         CPX     tablen,i    
+         BRGE    blc2_fin    ;   for(j=i+2; j<tablen; j+=2) { // petite boucle
+;                            ;     // l'objectif de cette petite boucle est de chercher via tab[j] le plus petit élément restant
+;                            ;     // l'invariant de boucle est que tout élément entre i et j est plus grand que tab[i]
+         LDX     i,d         
+         LDA     tab,x       
+         LDX     j,d         
+         CPA     tab,x       
+         BRLE    noswitch    ;     if (tab[i] > tab[j]) {
+;                            ;       // pour respecter l'ordre, il faut inverser tab[i] et tab[j]
+         LDX     i,d         
+         LDA     tab,x       
+         STA     tmp,d       ;       tmp = tab[i];
+         LDX     j,d         
+         LDA     tab,x       
+         LDX     i,d         
+         STA     tab,x       ;       tab[i] = tab[j];
+         LDA     tmp,d       
+         LDX     j,d         
+         STA     tab,x       ;       tab[j] = tmp;
+noswitch:NOP0                ;     } // fin if
+;
+         LDX     j,d         
+         ADDX    2,i         
+         STX     j,d         
+         BR      tri_blc2    
+blc2_fin:NOP0                ;   } // fin boucle j (cat j+=2)
+;
+         LDX     i,d         
+         ADDX    2,i         
+         STX     i,d         
+         BR      tri_bcl1    ; } // fin boucle i (cad i+=2)
+;
+trie_fin:RET0                ; return;
+; variables utiliées par la fonction `trier':
+i:       .BLOCK  2           ; indice de la grande boucle
+j:       .BLOCK  2           ; indice de la petite boucle
+tmp:     .BLOCK  2           ; valeur temporaire pour la permutation
+;
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-abus.pep b/contrib/pep8analysis/tests/privat/08-abus.pep
new file mode 100644 (file)
index 0000000..613ba76
--- /dev/null
@@ -0,0 +1,11 @@
+; Programme qui abuse de la pile
+; Jean Privat (c) 2010
+         CALL    la          
+         STOP                
+la:      LDA     ici,i       
+         STA     0,s         
+         RET0                
+         STOP                
+ici:     CHARO   '*',i       
+         STOP                
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-div-stack.pep b/contrib/pep8analysis/tests/privat/08-div-stack.pep
new file mode 100644 (file)
index 0000000..6eb3809
--- /dev/null
@@ -0,0 +1,50 @@
+; Passage des arguments et résultats par registres
+; Utilisation d'une variable globale
+         DECI    num,d       
+         LDA     num,d       
+         DECI    num,d       
+         LDX     num,d       
+;
+         SUBSP   8,i         ; réserve params #divreste #divquoti #dividend #diviseur
+         STX     0,s         ; empile #diviseur
+         STA     2,s         ; empile #dividend
+         CALL    div         
+         LDX     4,s         ; recupère #divquoti
+         LDA     6,s         ; recupère #divreste
+         ADDSP   8,i         ; libère params #divreste #divquoti #dividend #diviseur
+;
+         STA     num,d       
+         DECO    num,d       
+         CHARO   ' ',i       
+         STX     num,d       
+         DECO    num,d       
+         STOP                
+num:     .BLOCK  2           ; #2d
+;
+; div: calcule le quotient et le reste d'une division
+; IN:  PP+0=diviseur
+;      PP+2=dividend
+; OUT: PP+4=divquoti
+;      PP+6=divreste
+divreste:.EQUATE 12          ; Résultat #2d
+divquoti:.EQUATE 10          ; Résultat #2d
+dividend:.EQUATE 8           ; Paramètre #2d
+diviseur:.EQUATE 6           ; Paramètre #2d
+divsavA: .EQUATE 2           ; Variable locale #2d
+divsavX: .EQUATE 0           ; Variable locale #2d
+div:     SUBSP   4,i         ; empile #divsavA #divsavX
+         STA     divsavA,s   ; sauve A
+         STX     divsavX,s   ; sauve X
+         LDA     dividend,s  ; A = dividende
+         LDX     0,i         ; X = 0
+div_loop:CPA     diviseur,s  
+         BRLT    div_fin     ; while(A>=diviseur) {
+         SUBA    diviseur,s  ;   A -= diviseur;
+         ADDX    1,i         ;   X++;
+         BR      div_loop    ; } // fin while
+div_fin: STA     divreste,s  ; divreste = A
+         STX     divquoti,s  ; divquoti = X
+         LDA     divsavA,s   ; restaure A
+         LDX     divsavX,s   ; restaure X
+         RET4                ; depile #divsavA #divsavX
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-div-vars.pep b/contrib/pep8analysis/tests/privat/08-div-vars.pep
new file mode 100644 (file)
index 0000000..50899fc
--- /dev/null
@@ -0,0 +1,33 @@
+; Programme et sous programme de division entière
+; Jean Privat (c) 2010
+         DECI    num,d       
+         LDA     num,d       
+         DECI    num,d       
+         LDX     num,d       
+         CALL    div         
+         STA     num,d       
+         DECO    num,d       
+         CHARO   ' ',i       
+         STX     num,d       
+         DECO    num,d       
+         STOP                
+num:     .BLOCK  2           ; #2d
+;
+; div: calcule le quotient et le reste d'une division
+; Passage des arguments et résultats par registres
+; Utilisation d'une variable locale dans la pile
+; IN:  A=dividende
+;      X=diviseur
+; OUT: A=reste
+;      X=quotient
+div:     SUBSP   2,i         ; réserve #diviseur
+         STX     diviseur,s  
+         LDX     0,i         ; X = 0
+div_loop:CPA     diviseur,s  
+         BRLT    div_fin     ; while(A>=diviseur) {
+         SUBA    diviseur,s  ;   A -= diviseur;
+         ADDX    1,i         ;   X++;
+         BR      div_loop    ; } // fin while
+div_fin: RET2                ; libère #diviseur
+diviseur:.EQUATE 0           ; Variable locale #2d
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-div.pep b/contrib/pep8analysis/tests/privat/08-div.pep
new file mode 100644 (file)
index 0000000..af88478
--- /dev/null
@@ -0,0 +1,32 @@
+; Programme et sous programme de division entière
+; Jean Privat (c) 2010
+         DECI    num,d       
+         LDA     num,d       
+         DECI    num,d       
+         LDX     num,d       
+         CALL    div         
+         STA     num,d       
+         DECO    num,d       
+         CHARO   ' ',i       
+         STX     num,d       
+         DECO    num,d       
+         STOP                
+num:     .BLOCK  2           ; #2d
+;
+; div: calcule le quotient et le reste d'une division
+; Passage des arguments et résultats par registres
+; Utilisation d'une variable globale
+; IN:  A=dividende
+;      X=diviseur
+; OUT: A=reste
+;      X=quotient
+div:     STX     diviseur,d  
+         LDX     0,i         ; X = 0
+div_loop:CPA     diviseur,d  
+         BRLT    div_fin     ; while(A>=diviseur) {
+         SUBA    diviseur,d  ;   A -= diviseur;
+         ADDX    1,i         ;   X++;
+         BR      div_loop    ; } // fin while
+div_fin: RET0                
+diviseur:.BLOCK  2           ; Variable globale #2d
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/08-fib.pep b/contrib/pep8analysis/tests/privat/08-fib.pep
new file mode 100644 (file)
index 0000000..12d4fdb
--- /dev/null
@@ -0,0 +1,28 @@
+; Programme qui affiche un nombre dans la séquence de Fibonacci
+         DECI    num,d       
+         LDA     num,d       
+         CALL    fib         
+         STA     num,d       
+         DECO    num,d       
+         STOP                
+num:     .BLOCK  2           
+;
+;fib: calcule le nième nombre de la séquence de Fibonacci de façon récursive
+;     Hint: fib(0) = 0; fib(1) = 1; fib(n) = fib(n-1) + fib(n-2)
+;IN:  A=rang dans la séquence
+;OUT: A=nombre de fibonacci
+fib:     SUBSP   4,i         ; reserve #fibN #fibTmp
+         CPA     1,i         
+         BRLE    fib_fin     ; if (A<=1) return A;
+         STA     fibN,s      ; fibN = A;
+         SUBA    1,i         
+         CALL    fib         
+         STA     fibTmp,s    ; fibTmp = fib(fibN-1);
+         LDA     fibN,s      
+         SUBA    2,i         
+         CALL    fib         
+         ADDA    fibTmp,s    ; A = fib(fibN-2) + fibTmp;
+fib_fin: RET4                ; libère #fibN #fibTmp
+fibN:    .EQUATE 0           ; variable locale: le paramètre de la fonction #2d
+fibTmp:  .EQUATE 2           ; variable locale: le résultat du premier appel récursif #2d
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-incr.pep b/contrib/pep8analysis/tests/privat/08-incr.pep
new file mode 100644 (file)
index 0000000..7f3250e
--- /dev/null
@@ -0,0 +1,29 @@
+; Sous-programme qui incrémente un mot passé par référence
+; Jean Privat (c) 2010
+         LDA     5,i         
+         STA     mot,d       ; mot = 5;
+         DECO    mot,d       ; print(mot);
+         SUBSP   2,i         ; réserve #incrVar
+         LDA     mot,i       
+         STA     0,s         ; incrVar = &mot
+         CALL    incr        
+         ADDSP   2,i         ; libère #incrVar
+         CHARO   ' ',i       
+         DECO    mot,d       ; print(' '+mot);
+         STOP                
+mot:     .BLOCK  2           ; #2d un mot
+;
+; incr: incrémente un mot passé par référence
+; IN : PP+0=l'adresse du mot à incrémenter (#2h)
+incrVar: .EQUATE 4           ; #2h le paramètre
+incrA:   .EQUATE 0           ; #2d variable locale : sauvegarde de A
+incr:    SUBSP   2,i         ; réserve #incrA
+         STA     incrA,s     ; sauve A
+;                            ; // incrémentation : (*incrVar)++
+         LDA     incrVar,sf  ; A = *incrVar
+         ADDA    1,i         ; A++
+         STA     incrVar,sf  ; *incrVar = A
+;                            ; // fin sous-programme
+         LDA     incrA,s     ; restaure A
+         RET2                ; libère #incrA
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-liretab-stack.pep b/contrib/pep8analysis/tests/privat/08-liretab-stack.pep
new file mode 100644 (file)
index 0000000..6b46612
--- /dev/null
@@ -0,0 +1,33 @@
+; Sous-programme qui lit un tableau d'entier
+; -> utilise des vraies variables locales
+; Jean Privat (c) 2011
+;
+; Programme principal. Invoque simplement la fonction.
+         LDA     tab,i       
+         LDX     tabLen,i    
+         CALL    readTab     
+         STOP                
+tab:     .BLOCK  10          ; un tableau d'entiers #2d5a
+tabLen:  .EQUATE 10          ; taille de tab en octets
+;
+; readTab: lit un tableau d'entiers (de l'input)
+; IN: A=tableau d'entiers (mots signés #2d)
+;     X=taille du tableau en octets
+; En cas de probleme de lecture, le programme s'arrete
+readTab: SUBSP   6,i         ; reserve var locales #taille #addrt #addrfin
+         STA     addrt,s     ; sauvegarde le parametre A
+         STX     taille,s    ; sauvegarde le parametre X
+         ADDX    addrt,s     
+         STX     addrfin,s   ; addrfin = addrt + taille
+         LDX     addrt,s     ; for (X=addrt; X<addrfin; X+=2) {
+readLoop:CPX     addrfin,s   
+         BRGE    rTfin       
+         DECI    0,x         ;   *addrt = readInt();
+         ADDX    2,i         
+         BR      readLoop    ; } // fin for
+rTfin:   LDX     taille,s    ; restaure X
+         RET6                ; libere #taille #addrt #addrfin
+taille:  .EQUATE 4           ; la taille du tableau en octets #2d
+addrt:   .EQUATE 2           ; l'adresse du tableau #2h
+addrfin: .EQUATE 0           ; l'adresse de fin du tableau #2h
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-liretab.pep b/contrib/pep8analysis/tests/privat/08-liretab.pep
new file mode 100644 (file)
index 0000000..61daf4b
--- /dev/null
@@ -0,0 +1,33 @@
+; Sous-programme qui lit un tableau d'entier
+; -> utilise des variables globales (c'est pas bien)
+; Jean Privat (c) 2011
+;
+; Programme principal. Invoque simplement la fonction.
+         LDA     tab,i       
+         LDX     tabLen,i    
+         CALL    readTab     
+         STOP                
+tab:     .BLOCK  10          ; un tableau d'entiers #2d5a
+tabLen:  .EQUATE 10          ; taille de tab en octets
+;
+; readTab: lit un tableau d'entiers (de l'input)
+; IN: A=tableau d'entiers (mots signés #2d)
+;     X=taille du tableau en octets
+; En cas de probleme de lecture, le programme s'arrete.
+readTab: STA     addrt,d     ; sauvegarde le parametre A
+         STX     taille,d    ; sauvegarde le parametre X
+         ADDX    addrt,d     
+         STX     addrfin,d   ; addrfin = addrt + taille
+         LDX     addrt,d     ; for (X=addrt; X<addrfin; X+=2) {
+readLoop:CPX     addrfin,d   
+         BRGE    rTfin       
+         DECI    0,x         ;   *addrt = readInt();
+         ADDX    2,i         
+         BR      readLoop    ; } // fin for
+rTfin:   LDX     taille,d    ; restaure X
+         RET0                
+; variables ``locales'' du sous-programme
+taille:  .BLOCK  2           ; la taille du tableau en octets #2d
+addrt:   .BLOCK  2           ; l'adresse du tableau #2h
+addrfin: .BLOCK  2           ; l'adresse de fin du tableau #2h
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/08-pile.pep b/contrib/pep8analysis/tests/privat/08-pile.pep
new file mode 100644 (file)
index 0000000..fab77b9
--- /dev/null
@@ -0,0 +1,23 @@
+; Exemple simple d'empilage et de dépilage
+; Jean Privat (c) 2011
+         CALL    main        
+         STOP                
+main:    SUBSP   2,i         ; empile un mot #a
+         LDA     10,i        
+         STA     0,s         
+;
+         SUBSP   2,i         ; empile un autre mot #b
+         LDA     20,i        
+         STA     0,s         
+;
+         DECO    0,s         
+         DECO    2,s         
+;
+         ADDSP   2,i         ; dépile un mot #b
+         DECO    0,s         
+;
+         ADDSP   2,i         ; dépile un mot #a
+         RET0                
+a:       .EQUATE 0           ; #2d symbole utilisé pour activer le débogueur de Pep/8
+b:       .EQUATE 0           ; #2d symbole utilisé pour activer le débogueur de Pep/8
+         .END                  
diff --git a/contrib/pep8analysis/tests/privat/08-tab.pep b/contrib/pep8analysis/tests/privat/08-tab.pep
new file mode 100644 (file)
index 0000000..d9fb6bd
--- /dev/null
@@ -0,0 +1,59 @@
+; Programme qui alloue un tableau dans la pile
+; Jean Privat (c) 2010
+         CALL    main        
+         STOP                
+;
+; main: programme principal
+main:    SUBSP   len,i       ; réserve le tableau #tab
+;                            ; // initialise le tableau à partir de l'input
+         LDX     0,i         
+lit_loop:CPX     len,i       
+         BRGE    affich      ; for(X=0; X<len; X+=2) {
+         DECI    tab,sx      ;   tab[X] = getInt();
+         ADDX    2,i         
+         BR      lit_loop    ; } // fin for
+;
+;                            ; // affiche a l'envers
+affich:  LDX     len,i       
+aff_loop:SUBX    2,i         
+         BRLT    somme       ; for(X=len-2; X>=0; X-=2) {
+         DECO    tab,sx      
+         CHARO   ' ',i       ;   print(tab[X] + " ");
+         BR      aff_loop    ; } // fin for
+;
+;                            ; // calcule la somme des éléments du tableau
+somme:   MOVSPA              
+         ADDA    tab,i       ; A = adresse du tableau
+         SUBSP   2,i         ; // réserve #sumTab
+         STA     0,s         
+         CALL    sum         
+         ADDSP   2,i         ; // déréserve #sumTab
+         STA     num,d       ; num = sum(A)
+         CHARO   '=',i       
+         DECO    num,d       ; print("=" + num);
+;
+fin:     ADDSP   len,i       ; déréserve #tab
+         RET0                
+;
+; variables globales
+tab:     .EQUATE 0           ; variable locale: tableau de 4 mots #2d4a
+len:     .EQUATE 8           ; taille du tableau #tab en octets
+num:     .BLOCK  2           ; variable pour affichage
+;
+; sum: calcule la somme d'un tableau de 4 mots
+; IN : PP+0=l'addresse du tableau (#2h)
+; OUT: A=somme du tableau (#2d)
+sumTab:  .EQUATE 4           ; #2h paramètre
+sumX:    .EQUATE 0           ; #2d sauvegarde X
+sum:     SUBSP   2,i         ; réserve #sumX
+         STX     sumX,s      ; sauve X
+         LDA     0,i         ; A = 0
+         LDX     0,i         
+sum_loop:CPX     len,i       
+         BRGE    sum_fin     ; for(X=0; X<len; X+=2) {
+         ADDA    sumTab,sxf  ;   A += sumTab[X];
+         ADDX    2,i         
+         BR      sum_loop    ; } // fin for
+sum_fin: LDX     sumX,s      ; restaure X
+         RET2                ; déréserve #sumX
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-triforce.pep b/contrib/pep8analysis/tests/privat/08-triforce.pep
new file mode 100644 (file)
index 0000000..4676df0
--- /dev/null
@@ -0,0 +1,15 @@
+; Programme simple qui triforce
+; Jean Privat (c) 2010
+         CALL    force       
+         CALL    force       
+         CALL    force       
+         STOP                
+;
+force:   STRO    f1,d        
+         STRO    f2,d        
+         STRO    f3,d        
+         RET0                
+f1:      .ASCII  "  *\n\x00" 
+f2:      .ASCII  " ***\n\x00"
+f3:      .ASCII  "*****\n\x00"
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/08-varlocales.pep b/contrib/pep8analysis/tests/privat/08-varlocales.pep
new file mode 100644 (file)
index 0000000..68d6e89
--- /dev/null
@@ -0,0 +1,16 @@
+; Programme qui réserve des variables locales
+; Jean Privat (c) 2010
+         LDA     1,i         
+         LDX     2,i         
+         CALL    fun         
+         STOP                
+;
+fun:     SUBSP   4,i         ; réserver #funVar1 #funVar2
+         STA     funVar1,s   ; funVar1 = A
+         STX     funVar2,s   ; funVar2 = X
+;        ...
+         ADDSP   4,i         ; réréserver #funVar1 #funVar2
+         RET0                
+funVar1: .EQUATE 2           ; variable locale #2d
+funVar2: .EQUATE 0           ; variable locale #2d
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/09-liste.pep b/contrib/pep8analysis/tests/privat/09-liste.pep
new file mode 100644 (file)
index 0000000..351c0a1
--- /dev/null
@@ -0,0 +1,50 @@
+; Programme qui manipule une liste chaînée
+; Jean Privat (c) 2010
+;
+;                            ; // Lit la liste (à l'envers)
+         LDA     10,i        
+         STA     cpt,d       
+loop_in: CPA     0,i         
+         BRLE    out         ; for(cpt=10; cpt>0; cpt--) {
+         LDA     mLength,i   
+         CALL    new         ;   X = new Maillon(); #mVal #mNext
+         DECI    mVal,x      ;   X.val = getInt();
+         LDA     head,d      
+         STA     mNext,x     ;   X.next = head;
+         STX     head,d      ;   head = X;
+         LDA     cpt,d       
+         SUBA    1,i         
+         STA     cpt,d       
+         BR      loop_in     ; } // fin for
+;
+;                            ; // Affiche la liste
+out:     LDX     head,d      
+loop_out:CPX     0,i         
+         BREQ    fin         ; for (X=head; X!=null; X=X.next) {
+         DECO    mVal,x      
+         CHARO   ' ',i       ;   print(X.val + " ");
+         LDX     mNext,x     
+         BR      loop_out    ; } // fin for
+fin:     STOP                
+head:    .BLOCK  2           ; #2h tête de liste (null (aka 0) si liste vide)
+cpt:     .BLOCK  2           ; #2d compteur de boucle
+;
+;******* Structure de liste d'entiers
+; Une liste est constituée d'une chaîne de maillons.
+; Chaque maillon contient une valeur et l'adresse du maillon suivant
+; La fin de la liste est marquée arbitrairement par l'adresse 0
+mVal:    .EQUATE 0           ; #2d valeur de l'élément dans le maillon
+mNext:   .EQUATE 2           ; #2h maillon suivant (null (aka 0) pour fin de liste)
+mLength: .EQUATE 4           ; taille d'un maillon en octets
+;
+;
+;******* operator new
+;        Precondition: A contains number of bytes
+;        Postcondition: X contains pointer to bytes
+new:     LDX     hpPtr,d     ;returned pointer
+         ADDA    hpPtr,d     ;allocate from heap
+         STA     hpPtr,d     ;update hpPtr
+         RET0                
+hpPtr:   .ADDRSS heap        ;address of next free byte
+heap:    .BLOCK  1           ;first byte in the heap
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/09-produit.pep b/contrib/pep8analysis/tests/privat/09-produit.pep
new file mode 100644 (file)
index 0000000..b5e6ae2
--- /dev/null
@@ -0,0 +1,98 @@
+; Programme qui manipule des produits
+; Jean Privat (c) 2010
+;
+; Programme principal
+         CALL    main1       
+         CALL    main2       
+         CALL    main3       
+         STOP                
+;
+; ****** main1: Initialise et affiche un produit global
+main1:   LDA     1,i         
+         LDX     prCode,i    
+         STA     produitA,x  ; produitA->code = 1;
+         LDA     1495,i      
+         LDX     prPrix,i    
+         STA     produitA,x  ; produitA->prix = 1495;
+         LDA     nomA,i      
+         LDX     prNom,i     
+         STA     produitA,x  ; produitA->nom = nomA;
+         LDA     produitA,i  
+         CALL    prprod      ; prprod(produitA);
+         RET0                ; return;
+produitA:.BLOCK  6           ; #prCode #prPrix #prNom
+nomA:    .ASCII  "Un clavier\x00"
+;
+; ****** main2: Initialise et affiche un produit local (dans la pile)
+main2:   SUBSP   6,i         ; #prNom #prPrix #prCode
+         LDA     2,i         
+         LDX     prCode,i    
+         STA     produitB,sx ; produitB->code = 2;
+         LDA     1395,i      
+         LDX     prPrix,i    
+         STA     produitB,sx ; produitB->prix = 1395;
+         LDA     nomB,i      
+         LDX     prNom,i     
+         STA     produitB,sx ; produitB->nom = nomB;
+         MOVSPA              
+         ADDA    produitB,i  
+         CALL    prprod      ; prprod(produitB);
+         RET6                ; #prNom #prPrix #prCode
+produitB:.EQUATE 0           ; #prCode #prPrix #prNom
+nomB:    .ASCII  "Une souris\x00"
+;
+; ****** main3: Initialise et affiche un produit dans le tas
+main3:   SUBSP   2,i         ; #produitC
+         LDA     6,i         
+         CALL    new         ; produitC = malloc(6) #prCode #prPrix #prNom
+         STX     produitC,s  
+         LDA     3,i         
+         STA     prCode,x    ; produitC->code = 3;
+         LDA     1995,i      
+         STA     prPrix,x    ; procduitC->prix = 1995;
+         LDA     nomC,i      
+         STA     prNom,x     ; produitC->nom = nomC;
+         LDA     produitC,s  
+         CALL    prprod      ; prprod(produitC);
+         RET2                ; #produitC
+produitC:.EQUATE 0           ; #2h
+nomC:    .ASCII  "Clé usb\x00"
+; ****** Structure produit
+prCode:  .EQUATE 0           ; #2d code du produit
+prPrix:  .EQUATE 2           ; #2d prix du produit en cents
+prNom:   .EQUATE 4           ; #2h nom du produit (pointeur vers chaîne)
+;
+; ****** prprod: Affiche un produit
+; IN A=adresse du produit (#2h)
+prprodA: .EQUATE 0           ; #2h paramètre A
+prprodX: .EQUATE 2           ; #2h sauve X
+prprdstr:.EQUATE 4           ; #2h adresse du nom du produit (pour STRO)
+prprod:  SUBSP   6,i         ; #prprdstr #prprodX #prprodA
+         STA     prprodA,s   ; range A
+         STX     prprodX,s   ; sauve X
+         LDX     prCode,i    
+         DECO    prprodA,sxf ; print(prprodA->prCode)
+         CHARO   ':',i       ; print(":")
+         LDX     prNom,i     
+         LDA     prprodA,sxf 
+         STA     prprdstr,s  
+         STRO    prprdstr,sf ; print(prprodA->prNom)
+         CHARO   ' ',i       ; print(" ")
+         LDX     prPrix,i    
+         DECO    prprodA,sxf ; print(prprodA->prPrix)
+         CHARO   '\n',i      ; print("\n")
+         LDA     prprodA,s   ; restaure A
+         LDX     prprodX,s   ; restaure X
+         RET6                ; #prprdstr #prprodX #prprodA
+;
+;
+;******* operator new
+;        Precondition: A contains number of bytes
+;        Postcondition: X contains pointer to bytes
+new:     LDX     hpPtr,d     ;returned pointer
+         ADDA    hpPtr,d     ;allocate from heap
+         STA     hpPtr,d     ;update hpPtr
+         RET0                
+hpPtr:   .ADDRSS heap        ;address of next free byte
+heap:    .BLOCK  1           ;first byte in the heap
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/privat/fib.pep b/contrib/pep8analysis/tests/privat/fib.pep
new file mode 100644 (file)
index 0000000..efc872f
--- /dev/null
@@ -0,0 +1,23 @@
+;    Trouve et imprime le premier terme de la suite de Fibonacci
+;    supérieur à 500.
+;       Ph. Gabrini    septembre 2005
+;
+Fibo:   LDA     somme,d    ;
+Boucle: CPA     500,i      ; while(somme < 500)
+        BRGE    Affiche    ; {
+        LDA     dernier,d  ;
+        STA     avant,d    ;   avant = dernier;
+        LDA     somme,d    ;
+        STA     dernier,d  ;   dernier = somme;
+        ADDA    avant,d    ;
+        STA     somme,d    ;   somme = avant + dernier;
+        BR      Boucle     ; }//while
+Affiche:STRO    msg1,d     ; cout << "Premier ... "
+        DECO    somme,d    ;      << somme
+        CHARO   '\n',i     ;      << endl;
+        STOP
+avant:  .WORD  0        ; int avant = 0;
+dernier:.WORD  1        ; int dernier = 1;
+somme:  .WORD  1        ; int somme = 1;  
+msg1:   .ASCII  "Premier terme de la suite de Fibonacci > 500: \x00"
+        .END 
diff --git a/contrib/pep8analysis/tests/terrasa/addition_stro.pep b/contrib/pep8analysis/tests/terrasa/addition_stro.pep
new file mode 100644 (file)
index 0000000..0341e03
--- /dev/null
@@ -0,0 +1,24 @@
+; Introduction à PEP8
+; Programme qui calcule la somme de deux nombres saisis par l'utilisateur
+; et affiche le resultat.
+;
+; Alexandre Terrasa (c) 2013            
+
+         stro    msgIn, d         ; print(mshIn)
+         deci    nb, d            ; nb = deci()
+         lda     nb, d            ; A = nb
+         deci    nb, d            ; nb = deci()
+         adda    nb, d            ; A += nb
+         sta     nb, d            ; nb = A
+         stro    msgOut, d        ; print(msgOut)
+         deco    nb, d            ; print(nb)
+
+         stop
+
+msgIn:   .ASCII  "Veuillez saisir deux nombres: \n\x00"  ; \x00 permet d'indiquer la fin de la chaîne
+msgOut:  .ASCII  "La somme de"                         ; Ainsi, on peut ecrire un message
+         .ASCII  " ces deux nombres est \x00"            ; sur plusieurs lignes...
+
+nb:      .BLOCK  2                ; utilisé pour stocker les nombres saisis puis la somme pour l'affichage
+
+         .END
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/boucle.pep b/contrib/pep8analysis/tests/terrasa/boucle.pep
new file mode 100644 (file)
index 0000000..6b727c9
--- /dev/null
@@ -0,0 +1,40 @@
+; Branchements
+; Programme qui toutes les valeurs entières entre deux valeurs saisies par l'utilisateur
+; LIMITE: min <= max sinon erreur
+;
+; Alexandre Terrasa (c) 2013
+
+         stro    strMin, d   ; print(strMin)
+         deci    min, d      ; min = deci() 
+         stro    strMax, d   ; print(strMax)
+         deci    max, d      ; max = deci()
+         stro    strLoop, d  ; print(strLoop)
+         ldx     min, d      ; X = min
+         lda     min, d      ; A = min
+
+         cpa     max, d      ;
+         brle    loop        ; if ( A > max ) {
+         stro    strErr, d   ;    print(strErr)
+         stop                ; }
+         
+loop:    cpx     max, d      ;
+         breq    end         ; while(X != max) {
+         stx     tmp, d      ;    tmp = X
+         deco    tmp, d      ;    print(tmp)
+         addx    1, i        ;    X ++
+         charo   "\n", i     ;    print("\n")
+         br      loop        ; }
+end:     deco    max, d      ; print(max)
+         stop
+
+; variables
+min:     .block  2           ; pour stocker le minimum saisi
+max:     .block  2           ; pour stocker le maximum saisi
+tmp:     .block  2           ; pour stocker la valeur a afficher
+         
+strMin:  .ascii  "Minimum ?\n\x00"
+strMax:  .ascii  "Maximum ?\n\x00"
+strLoop: .ascii  "Boucle :\n\x00"
+strErr:  .ascii  "Erreur: Le minimum doit être inférieur ou égal au maximum !\x00"
+
+         .END
diff --git a/contrib/pep8analysis/tests/terrasa/chari_charo.pep b/contrib/pep8analysis/tests/terrasa/chari_charo.pep
new file mode 100644 (file)
index 0000000..c1ea528
--- /dev/null
@@ -0,0 +1,17 @@
+; Introduction à PEP8
+; Programme qui affiche le caractère saisi par l'utilisateur
+;
+; Alexandre Terrasa (c) 2013     
+
+         stro    msg1, d     ; print(msg1)
+         chari   char, d     ; char = chari()
+         stro    msg2, d     ; print(msg2)
+         charo   char, d     ; print(char)
+         stop
+
+char:    .BYTE   0           ; on réserve un octet (initialisé à 0) pour stocker le caractère
+
+msg1:    .ASCII  "Veuillez saisir un caractère: \x00"
+msg2:    .ASCII  "\nLe caractère saisi est: \"\x00"
+
+         .END
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/division.pep b/contrib/pep8analysis/tests/terrasa/division.pep
new file mode 100644 (file)
index 0000000..44984db
--- /dev/null
@@ -0,0 +1,56 @@
+; Branchements
+; Programme qui calcule une division entière entre deux nombres
+; puis affiche le quotient et le reste
+; LIMITE: a >= 0
+; LIMITE: b > 0
+;
+; Alexandre Terrasa (c) 2013
+
+         stro    strA, d     ; print(strA)
+         deci    a, d        ; a = deci()
+
+         ldx     a, d        ; X = a
+         cpx     0, i        ;
+         brgt    notErrA     ; if( X < 0 ) {
+         stro    strErrA, d  ;    print(strErrA)
+         stop                ; }
+
+notErrA: stro    strB, d     ; print(strB)
+         deci    b, d        ; b = deci()
+
+         ldx     b, d        ; X = a
+         cpx     0, i        ;
+         brgt    notErrB      ; if( X < 0 ) {
+         stro    strErrB, d   ;    print(strErrB)
+         stop                ; }
+
+notErrB: lda     a, d        ; A = a
+         ldx     0, i        ; X = 0
+sub:     cpa     b, d        
+         brlt    end         ; while(A >= b) {
+         suba    b, d        ;   A = A - b
+         addx    1, i        ;   X++
+         br      sub         ; }
+
+end:     sta     r, d        ; r = A     
+         stx     q, d        ; q = X
+         stro    strQ, d     ; print(strQ)
+         deco    q, d        ; print(q)
+         stro    strR, d     ; print(strR)
+         deco    r, d        ; print(r)
+         stop
+
+; variables
+strA:    .ASCII "a = \x00"
+strB:    .ASCII "b = \x00"
+strQ:    .ASCII "a / b = \x00"
+strR:    .ASCII " reste \x00"
+strErrA: .ASCII "Erreur: a doit etre strictement positif\x00"
+strErrB: .ASCII "Erreur: b doit etre strictement supperieur a 0\x00"
+
+a:       .BLOCK 2
+b:       .BLOCK 2
+q:       .BLOCK 2
+r:       .BLOCK 2
+
+         .END
diff --git a/contrib/pep8analysis/tests/terrasa/hello.pep b/contrib/pep8analysis/tests/terrasa/hello.pep
new file mode 100644 (file)
index 0000000..86f43ee
--- /dev/null
@@ -0,0 +1,10 @@
+; Hello World en PEP8\r
+                \r
+         stro msg, d              \r
+         stop                     ; Arrete l'execution ici pour eviter de traiter les variables comme des instructions\r
+\r
+msg:     .ASCII "Hello World\x00" ; Le \x00 represente le caractere null\r
+\r
+         .END\r
+\r
+Tout ce qui se trouve apres le .END est considere comme du commentaire.
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/if_else.pep b/contrib/pep8analysis/tests/terrasa/if_else.pep
new file mode 100644 (file)
index 0000000..5510073
--- /dev/null
@@ -0,0 +1,17 @@
+; Branchements
+; Programme qui affiche si le nombre saisi par l'utilisateur est égal à 0 ou non
+;
+; Alexandre Terrasa (c) 2013
+
+         DECI    nb,d        ; nb = deci()
+         LDA     nb,d        ; A = nb
+         BREQ    eq0         ; if( A != 0 ) {
+         STRO    strNot0,d   ;    print(strNot0)
+         STOP                ; } else {
+eq0:     STRO    strEq0,d    ;    print(strEq0)
+         STOP                ; }
+; variables
+nb:      .BLOCK  2           ; on reserve 2 block pour l'entier saisi
+strNot0: .ASCII  "Different de 0\x00"
+strEq0:  .ASCII  "Egal a 0\x00"
+         .END
diff --git a/contrib/pep8analysis/tests/terrasa/if_elseif_else.pep b/contrib/pep8analysis/tests/terrasa/if_elseif_else.pep
new file mode 100644 (file)
index 0000000..3baf9b7
--- /dev/null
@@ -0,0 +1,29 @@
+; Branchements
+; Programme qui affiche si le nombre saisi par l'utilisateur est égal à 0 ou non
+;
+; Alexandre Terrasa (c) 2013
+
+         deci    nb, d       ; nb = deci()
+         lda     nb, d       ; A = nb
+         deco    nb, d       ; print(nb)
+         
+         cpa     zero, i     ;
+         breq    eq0         ; if( A != 0 ) {
+         cpa     zero, i     ;
+         brgt    gt0         ;    if( A < 0 ) {
+         stro    strLt0, d   ;        print(strLt0)
+         stop                ;    } else {
+gt0:     stro    strGt0, d   ;        print(strGt0)
+         stop                ;    }
+                             ; } else {
+eq0:     stro    strEq0, d   ;    print(strEq0)
+         stop                ; }
+
+; variables
+nb:      .block  2           ; on reserve 2 block pour l'entier saisi
+strLt0:  .ascii  " est negatif\x00"
+strEq0:  .ascii  " est nul\x00"
+strGt0:  .ascii  " est positif\x00"
+zero:    .equate 0           ; constante pour le test de branchement
+
+         .END
diff --git a/contrib/pep8analysis/tests/terrasa/lecture_chaine.pep b/contrib/pep8analysis/tests/terrasa/lecture_chaine.pep
new file mode 100644 (file)
index 0000000..f5423f6
--- /dev/null
@@ -0,0 +1,20 @@
+; Programme qui lit une chaine caractère par caractère
+; et s'arrête au premier caractère nul trouvé
+;
+; Alexandre Terrasa (c) 2012
+
+         ldx     0,i          ; X = 0
+
+rep:     ldbytea chaine, x    ; do { A = chaine[X] // if chaine[X] == null then Z = 1
+         breq    fin          ;   if( A != null ) {
+         charo   chaine,x     ;       print(chaine[X])
+         charo   "\n",i       ;       print("\n")
+         addx    1,i          ;       X++
+                              ;   } else { break }
+         br      rep          ; }
+
+fin:     stop
+
+chaine:  .ASCII  "Bonjour\x00" ; La chaine à lire en ASCII (1 caractère = 1 octet)
+
+         .END
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/matrice.pep b/contrib/pep8analysis/tests/terrasa/matrice.pep
new file mode 100644 (file)
index 0000000..621f752
Binary files /dev/null and b/contrib/pep8analysis/tests/terrasa/matrice.pep differ
diff --git a/contrib/pep8analysis/tests/terrasa/max_tableau.pep b/contrib/pep8analysis/tests/terrasa/max_tableau.pep
new file mode 100644 (file)
index 0000000..035b727
--- /dev/null
@@ -0,0 +1,37 @@
+; Programme qui trouve le plus grand élément d'un tableau d'entiers positifs
+; LIMITES: Les valeurs stockées dans le tableaux doivent être positives
+;
+; Alexandre Terrasa (c) 2012
+
+         STRO    strStart, d ; print(strStart) 
+         LDX     0,i         ; X = 0
+                             ; 
+loop:    LDA     vecteur, x  ; do { A = vecteur[X]
+         DECO    vecteur, x  ; print(vecteur[X])
+         CHARO   " ", i      ; print(" ")
+         CPA     max, d      ; 
+         BRLE    next        ;   if(vecteur[X] > max) {
+         STA     max, d      ;        max = vecteur[X] 
+                             ;   }
+next:    ADDX    2,i         ;   X++
+         CPX     lenVec,i    
+         BRLT    loop        ; } while (X < lenVec);
+         
+         STRO    strMax, d   ; print(strMax); 
+         DECO    max,d       ; print(max);
+         STOP       
+
+; Déclaration du tableau         
+vecteur: .WORD   5           ; un vecteur d'octets
+         .WORD   6           
+         .WORD   12           
+         .WORD   7           
+         .WORD   8           
+lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
+
+; Autres variables
+max:     .WORD   -1        ; #2d max du vecteur
+strStart:.ASCII  "Valeurs contenues dans le tableau: \x00"
+strMax:  .ASCII  "\nMax: \x00"
+
+         .END                  
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/multiplication.pep b/contrib/pep8analysis/tests/terrasa/multiplication.pep
new file mode 100644 (file)
index 0000000..afbca24
--- /dev/null
@@ -0,0 +1,51 @@
+; Branchements
+; Programme qui calcule le produit de deux nombres saisis par l'utilisateur
+; LIMITE: a >= 0 && b >= 0
+;
+; Alexandre Terrasa (c) 2013
+
+         stro    strA, d     ; print(strA)
+         deci    a, d        ; a = deci()
+
+         ldx     a, d        ; X = a
+         cpx     0, i        ;
+         brge    notErrA     ; if( X < 0 ) {
+         stro    strErr, d   ;    print(strErr)
+         stop                ; }
+
+notErrA: stro    strB, d     ; print(strB)
+         deci    b, d        ; b = deci()
+
+         ldx     b, d        ; X = b
+         cpx     0, i        ;
+         brge    notErrB     ; if( X < 0 ) {
+         stro    strErr, d   ;    print(strErr)
+         stop                ; }
+
+notErrB: lda     0, i        ; A = 0
+         ldx     a, d        ; X = a
+add:     cpx     0, i         
+         breq    end         ; if(X !=0 ) {
+                             ;   do {
+         adda    b, d        ;     A = A + b
+         subx    1, i        ;     X = X - 1
+         cpx     0, i         
+         brne    add         ;   } while(X != 0)
+                                ; }
+
+end:     sta     p, d        ; p = A
+         stro    strP, d     ; print(strP)
+         deco    p, d        ; print(p)
+         stop
+
+; variables
+strA:    .ASCII "a = \x00"
+strB:    .ASCII "b = \x00"
+strP:    .ASCII "a * b = \x00"
+strErr:  .ASCII "Erreur: La valeur saisie doit etre positive\x00"
+
+a:       .BLOCK 2            ; a
+b:       .BLOCK 2            ;
+p:       .BLOCK 2            ; pour stocker le produit avant affichage
+
+         .END
diff --git a/contrib/pep8analysis/tests/terrasa/reverse_tableau.pep b/contrib/pep8analysis/tests/terrasa/reverse_tableau.pep
new file mode 100644 (file)
index 0000000..5950194
--- /dev/null
@@ -0,0 +1,36 @@
+; Semaine 5
+; Programme qui lit un tableau à l'envers
+; Alexandre Terrasa (C) 2012
+
+         STRO    strF, d     ; print(strF)
+         LDX     0, i        ; X = 0
+loopf:   DECO    vecteur, x  ; do { print(vecteur[X])
+         CHARO   " ", i      ; print(" ")
+         CPX     lenVec, i   ; 
+         ADDX    2,i         ;   X++
+         CPX     lenVec,i    
+         BRLT    loopf       ; } while (X < lenVec); 
+
+         STRO    strB, d     ; print(strB)
+         LDX     lenVec,i    ; X = lenVec
+loopb:   SUBX    2, i        ; do { X--
+         DECO    vecteur,x   ;    print(vecteur[X])
+         CHARO   ' ', i      ;    print(" ")
+         CPX     0,i    
+         BRGT    loopb       ; } while (X > 0)
+         
+         STOP       
+
+; Déclaration du tableau
+vecteur: .WORD   5           ; un vecteur d'octets
+         .WORD   6           
+         .WORD   2           
+         .WORD   7           
+         .WORD   8           
+lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
+
+; Autres variables
+strF:    .ASCII "Valeurs à l'endroit: \x00"
+strB:    .ASCII "\nValeurs à l'envers: \x00"
+
+         .END             
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/somme_tableau.pep b/contrib/pep8analysis/tests/terrasa/somme_tableau.pep
new file mode 100644 (file)
index 0000000..8b65a71
--- /dev/null
@@ -0,0 +1,37 @@
+; Semaine 5
+; Programme qui calcule la somme des éléments d'un tableau
+; Jean Privat (C) 2010
+; Alexandre Terrasa (C) 2012
+
+         STRO    strStart, d ; print(strStart)
+
+         LDA     0,i         ; somme = 0
+         LDX     0,i         ; X = 0
+loop:    ADDA    vecteur,x   ; do{ somme += vecteur[X]
+         DECO    vecteur,x   ;   print(vecteur[X]);
+         CHARO   ' ', i      ;   print(" ");
+         ADDX    2,i         ;   X++;
+         CPX     lenVec,i    
+         BRLT    loop        ; } while (X < lenVec);
+         
+         CHARO   0x0A, i     ; print("\n");
+         STRO    strSum, d   ; print(strSum);
+         STA     somme,d     
+         DECO    somme,d     ; print(somme);
+         STOP       
+
+; Déclaration du tableau         
+vecteur: .WORD   5           ; un vecteur d'octets
+         .WORD   6           
+         .WORD   2           
+         .WORD   7           
+         .WORD   8           
+lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
+
+; Autres variables
+somme:   .BLOCK  2           ; #2d somme calculée du vecteur
+
+strStart:.ASCII  "Valeurs contenues dans le tableau: \x00"
+strSum:  .ASCII  "Somme: \x00"
+
+         .END             
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/soustraction.pep b/contrib/pep8analysis/tests/terrasa/soustraction.pep
new file mode 100644 (file)
index 0000000..baf39b4
--- /dev/null
@@ -0,0 +1,24 @@
+; Introduction à PEP8
+; Programme qui calcule la différence de deux nombres saisis par l'utilisateur
+; et affiche le resultat.
+;
+; Alexandre Terrasa (c) 2013            
+
+         stro    msgIn, d         ; print(mshIn)
+         deci    nb, d            ; nb = deci()
+         lda     nb, d            ; A = nb
+         deci    nb, d            ; nb = deci()
+         suba    nb, d            ; A -= nb
+         sta     nb, d            ; nb = A
+         stro    msgOut, d        ; print(msgOut)
+         deco    nb, d            ; print(nb)
+
+         stop
+
+msgIn:   .ASCII  "Veuillez saisir deux nombres: \n\x00"  ; \x00 permet d'indiquer la fin de la chaîne
+msgOut:  .ASCII  "La différence de"                         ; Ainsi, on peut ecrire un message
+         .ASCII  " ces deux nombres est \x00"            ; sur plusieurs lignes...
+
+nb:      .BLOCK  2                ; utilisé pour stocker les nombres saisis puis le résultat pour l'affichage
+
+         .END
\ No newline at end of file
diff --git a/contrib/pep8analysis/tests/terrasa/tri_bulles.pep b/contrib/pep8analysis/tests/terrasa/tri_bulles.pep
new file mode 100644 (file)
index 0000000..f2ff55d
--- /dev/null
@@ -0,0 +1,69 @@
+; Ce programme prend 5 valeurs entières saisies par l'utilisateur
+; les stocke dans un tableau
+; trie le tableau
+; affiche le contenu du tableau trié
+
+; cas limites :
+; le programme retourne une erreur si l'utilisateur ne saisie pas 5 entiers
+; Alexandre Terrasa (c) 2012
+
+; init du programme
+         LDA     len, i      ; A = len
+         SUBA    2, i        ; A --
+         STA     maxlen, d   ; maxlen = A
+
+; saisie du tableau
+         LDX     0, i        ; X = 0
+saisie:  DECI    tab, x      ; do { tab[X] = getInt()
+         ADDX    2, i        ;    X++
+         CPX     len, i
+         BRLT    saisie      ; } while (X < len)
+
+; trie du tableau
+trie:    LDA     1, i        ; do { A = 1
+         STA     flag, d     ;    flag = A // init le flag à false
+
+; boucle interne
+         LDX     0, i        ;    do { X = 0
+loop:    LDA     tab, x      ;        A = tab[X]
+
+         ; comparer les valeurs
+         ADDX    2, i        ;        X ++
+         CPA     tab, x
+         BRLE    next        ;        if (A > tab[X]) {
+                             ;            // echanger les valeurs
+         STA     tmp, d      ;            tmp = A
+         LDA     tab, x      ;            A = tab[x]
+         SUBX    2, i        ;            X --
+         STA     tab, x      ;            tab[x] = A
+         ADDX    2, i        ;            X ++
+         LDA     tmp, d      ;            A = tmp
+         STA     tab, x      ;            tab[x] = A
+                             ;            // passer flag à 0
+         LDA     0, i        ;            A = 0
+         STA     flag, d     ;            flag = A
+                             ;        }
+
+next:    CPX     maxlen, d
+         BRLT    loop        ;    } while(X < maxlen)
+
+         LDA     flag, d     ;    A = flag
+         CPA     0, i
+         BREQ    trie        ; } while(flag == 0)
+
+; affichage le tableau
+         LDX     0, i        ; X = 0
+aff:     DECO    tab, x      ; do { print (tab[X])
+         ADDX    2, i        ;    X++
+         CPX     len, i
+         BRLT    aff         ; } while (X < len)
+
+         STOP
+
+tab:     .BLOCK  10          ; #2d5a tableau d'entiers
+len:     .EQUATE 10          ; taille du tableau
+maxlen:  .BLOCK  2           ; #2d case max - 1
+flag:    .BLOCK  2           ; #2d flag 'aucun_echange'
+tmp:     .BLOCK  2           ; #2d variable temporaire pour les permutations
+
+         .END
index a16090c..2b39b1b 100644 (file)
@@ -72,6 +72,15 @@ var configs = config_chooser.choose(egl_display)
 assert configs != null else print "choosing config failed: {egl_display.error}"
 assert not configs.is_empty else print "no EGL config"
 
+print "{configs.length} EGL configs available"
+for config in configs do
+       var attribs = config.attribs(egl_display)
+       print "* caveats: {attribs.caveat}"
+       print "  conformant to: {attribs.conformant}"
+       print "  size of RGBA: {attribs.red_size} {attribs.green_size} {attribs.blue_size} {attribs.alpha_size}"
+       print "  buffer, depth, stencil: {attribs.buffer_size} {attribs.depth_size} {attribs.stencil_size}"
+end
+
 var config = configs.first
 
 var format = config.attribs(egl_display).native_visual_id
index 38cd1f2..841d6f6 100644 (file)
@@ -164,7 +164,7 @@ extern class EGLDisplay `{ EGLDisplay `}
        end
 
        private fun query_string(name: Int): String import NativeString.to_s `{
-               return (void*)(long)NativeString_to_s(eglQueryString(recv, name));
+               return NativeString_to_s((char *)eglQueryString(recv, name));
        `}
 
        fun vendor: String do return query_string("3053".to_hex)
@@ -208,9 +208,81 @@ class EGLConfigAttribs
        var display: EGLDisplay
        var config: EGLConfig
 
+       fun buffer_size: Int do return display.config_attrib(config, "3020".to_hex)
        fun alpha_size: Int do return display.config_attrib(config, "3021".to_hex)
+       fun blue_size: Int do return display.config_attrib(config, "3022".to_hex)
+       fun green_size: Int do return display.config_attrib(config, "3023".to_hex)
+       fun red_size: Int do return display.config_attrib(config, "3024".to_hex)
+       fun depth_size: Int do return display.config_attrib(config, "3025".to_hex)
+       fun stencil_size: Int do return display.config_attrib(config, "3026".to_hex)
+
        fun native_visual_id: Int do return display.config_attrib(config, "302E".to_hex)
        fun native_visual_type: Int do return display.config_attrib(config, "302F".to_hex)
+
+       fun caveat: EGLConfigCaveat do
+               return new EGLConfigCaveat.from_i(display.config_attrib(config, "3027".to_hex))
+       end
+
+       fun conformant: EGLConformant do
+               return new EGLConformant.from_i(display.config_attrib(config, "3042".to_hex))
+       end
+end
+
+extern class EGLConfigCaveat `{ EGLint `}
+       new from_i(val: Int) `{ return (EGLint)val; `}
+       fun to_i: Int `{ return recv; `}
+
+       new none `{ return EGL_NONE; `}
+       fun is_none: Bool `{ return recv == EGL_NONE; `}
+
+       new dont_care `{ return EGL_DONT_CARE; `}
+       fun is_dont_care: Bool `{ return recv == EGL_DONT_CARE; `}
+
+       new slow `{ return EGL_SLOW_CONFIG; `}
+       fun is_slow: Bool `{ return recv == EGL_SLOW_CONFIG; `}
+
+       # Obselete since EGL 1.3, use EGL_CONFORMANT instead
+       new non_conformant `{ return EGL_NON_CONFORMANT_CONFIG; `}
+       fun is_non_conformant: Bool `{ return recv == EGL_NON_CONFORMANT_CONFIG; `}
+
+       redef fun to_s
+       do
+               if is_none then return "EGL_NONE"
+               if is_dont_care then return "EGL_DONT_CARE"
+               if is_slow then return "EGL_SLOW_CONFIG"
+               if is_non_conformant then return "EGL_NON_CONFORMANT"
+               return "Unknown or invalid value"
+       end
+end
+
+extern class EGLConformant `{ EGLint `}
+       new `{ return (EGLint)0; `}
+       new from_i(val: Int) `{ return (EGLint)val; `}
+       fun to_i: Int `{ return recv; `}
+
+       fun opengl: Bool `{ return recv & EGL_OPENGL_BIT; `}
+       fun with_opengl: EGLConformant `{ return recv | EGL_OPENGL_BIT; `}
+
+       fun opengl_es: Bool `{ return recv & EGL_OPENGL_ES_BIT; `}
+       fun with_opengl_es: EGLConformant `{ return recv | EGL_OPENGL_ES_BIT; `}
+
+       fun opengl_es2: Bool `{ return recv & EGL_OPENGL_ES2_BIT; `}
+       fun with_opengl_es2: EGLConformant `{ return recv | EGL_OPENGL_ES2_BIT; `}
+
+       fun openvg: Bool `{ return recv & EGL_OPENVG_BIT; `}
+       fun with_openvg: EGLConformant `{ return recv | EGL_OPENVG_BIT; `}
+
+       fun to_a: Array[String]
+       do
+               var features = new Array[String]
+               if opengl then features.add("OpenGL")
+               if opengl_es then features.add("OpenGL ES")
+               if opengl_es2 then features.add("OpenGL ES2")
+               if openvg then features.add("OpenVG")
+               return features
+       end
+
+       redef fun to_s do return to_a.join(", ")
 end
 
 # Attributes of a surface for a given EGL display
@@ -344,11 +416,16 @@ class EGLConfigChooser
        fun green_size=(size: Int) do insert_attrib_with_val("3023".to_hex, size)
        fun red_size=(size: Int) do insert_attrib_with_val("3024".to_hex, size)
 
+       fun buffer_size=(size: Int) do insert_attrib_with_val("3020".to_hex, size)
        fun alpha_size=(size: Int) do insert_attrib_with_val("3021".to_hex, size)
        fun depth_size=(size: Int) do insert_attrib_with_val("3025".to_hex, size)
        fun stencil_size=(size: Int) do insert_attrib_with_val("3026".to_hex, size)
        fun sample_buffers=(size: Int) do insert_attrib_with_val("3031".to_hex, size)
 
+       fun caveat=(caveat: EGLConfigCaveat) do insert_attrib_with_val("3050".to_hex, caveat.to_i)
+
+       fun conformant=(conformant: EGLConformant) do insert_attrib_with_val("3042".to_hex, conformant.to_i)
+
        fun choose(display: EGLDisplay): nullable Array[EGLConfig]
        do
                assert closed else print "EGLConfigChooser not closed."
index ea39ab3..20be476 100644 (file)
@@ -149,6 +149,9 @@ interface Iterator[E]
 
        # Is there a current item ?
        fun is_ok: Bool is abstract
+
+       # Iterate over `self`
+       fun iterator: Iterator[E] do return self
 end
 
 # A collection that contains only one item.
@@ -305,6 +308,25 @@ interface Set[E: Object]
                for e in self do res += res.hash
                return res
        end
+
+       # Returns the union of this set with the `other` set
+       fun union(other: Set[E]): Set[E]
+       do
+               var nhs = new_set
+               nhs.add_all self
+               nhs.add_all other
+               return nhs
+       end
+
+       # Returns the intersection of this set with the `other` set
+       fun intersection(other: Set[E]): Set[E]
+       do
+               var nhs = new_set
+               for v in self do if other.has(v) then nhs.add(v)
+               return nhs
+       end
+
+       protected fun new_set: Set[E] is abstract
 end
 
 # MapRead are abstract associative collections: `key` -> `item`.
@@ -507,22 +529,22 @@ end
 class MapKeysIterator[K: Object, V]
        super Iterator[K]
        # The original iterator
-       var iterator: MapIterator[K, V]
+       var original_iterator: MapIterator[K, V]
 
-       redef fun is_ok do return self.iterator.is_ok
-       redef fun next do self.iterator.next
-       redef fun item do return self.iterator.key
+       redef fun is_ok do return self.original_iterator.is_ok
+       redef fun next do self.original_iterator.next
+       redef fun item do return self.original_iterator.key
 end
 
 # Iterator on a 'values' point of view of a map
 class MapValuesIterator[K: Object, V]
        super Iterator[V]
        # The original iterator
-       var iterator: MapIterator[K, V]
+       var original_iterator: MapIterator[K, V]
 
-       redef fun is_ok do return self.iterator.is_ok
-       redef fun next do self.iterator.next
-       redef fun item do return self.iterator.item
+       redef fun is_ok do return self.original_iterator.is_ok
+       redef fun next do self.original_iterator.next
+       redef fun item do return self.original_iterator.item
 end
 
 # Sequences are indexed collections.
index 22da04e..6fe304e 100644 (file)
@@ -428,6 +428,8 @@ class ArraySet[E: Object]
 
        # Create an empty set with a given capacity.
        init with_capacity(i: Int) do _array = new Array[E].with_capacity(i)
+
+       redef fun new_set do return new ArraySet[E]
 end
 
 # Iterators on sets implemented with arrays.
index 0f2a0e2..5406f40 100644 (file)
@@ -441,6 +441,8 @@ class HashSet[E: Object]
                init
                add_all(coll)
        end
+
+       redef fun new_set do return new HashSet[E]
 end
 
 private class HashSetNode[E: Object]
index 1e772a5..c6a59d4 100644 (file)
 #include <sys/wait.h>
 #include <signal.h>
 
-#ifndef NONITCNI
-#include <exec._nitni.h>
-#endif
-
 typedef struct se_exec_data se_exec_data_t;
 struct se_exec_data {
        pid_t id;
index 90eb876..53648f4 100644 (file)
@@ -21,8 +21,8 @@ import literal
 import typing
 import auto_super_init
 import frontend
-import common_ffi
 import platform
+import c_tools
 
 # Add compiling options
 redef class ToolContext
@@ -204,11 +204,8 @@ class MakefileToolchain
 
                # FFI
                var m2m = toolcontext.modelbuilder.mmodule2nmodule
-               for m in compiler.mainmodule.in_importation.greaters do if m2m.keys.has(m) then
-                       var amodule = m2m[m]
-                       if m.uses_ffi or amodule.uses_legacy_ni then
-                               compiler.finalize_ffi_for_module(amodule)
-                       end
+               for m in compiler.mainmodule.in_importation.greaters do
+                       compiler.finalize_ffi_for_module(m)
                end
 
                # Copy original .[ch] files to compile_dir
@@ -307,9 +304,9 @@ class MakefileToolchain
 
                var linker_options = new HashSet[String]
                var m2m = toolcontext.modelbuilder.mmodule2nmodule
-               for m in mainmodule.in_importation.greaters do if m2m.keys.has(m) then
-                       var amod = m2m[m]
-                       linker_options.add(amod.c_linker_options)
+               for m in mainmodule.in_importation.greaters do
+                       var libs = m.collect_linker_libs
+                       if libs != null then linker_options.add_all(libs)
                end
 
                if not toolcontext.opt_no_stacktrace.value then linker_options.add("-lunwind")
@@ -322,29 +319,19 @@ class MakefileToolchain
                # Compile each generated file
                for f in cfiles do
                        var o = f.strip_extension(".c") + ".o"
-                       makefile.write("{o}: {f}\n\t$(CC) $(CFLAGS) $(CINCL) -D NONITCNI -c -o {o} {f}\n\n")
+                       makefile.write("{o}: {f}\n\t$(CC) $(CFLAGS) $(CINCL) -c -o {o} {f}\n\n")
                        ofiles.add(o)
                        dep_rules.add(o)
                end
 
                # Compile each required extern body into a specific .o
                for f in compiler.extern_bodies do
-                       if f isa ExternCFile then
-                               var basename = f.filename.basename(".c")
-                               var o = "{basename}.extern.o"
-                               var ff = f.filename.basename("")
-                               makefile.write("{o}: {ff}\n\t$(CC) $(CFLAGS) -D NONITCNI {f.cflags} -c -o {o} {ff}\n\n")
-                               ofiles.add(o)
-                               dep_rules.add(o)
-                       else
-                               var o = f.makefile_rule_name
-                               var ff = f.filename.basename("")
-                               makefile.write("{o}: {ff}\n")
-                               makefile.write("\t{f.makefile_rule_content}\n\n")
-                               dep_rules.add(f.makefile_rule_name)
-
-                               if f isa ExternCppFile then ofiles.add(o)
-                       end
+                       var o = f.makefile_rule_name
+                       var ff = f.filename.basename("")
+                       makefile.write("{o}: {ff}\n")
+                       makefile.write("\t{f.makefile_rule_content}\n\n")
+                       dep_rules.add(f.makefile_rule_name)
+                       ofiles.add(o)
                end
 
                # Link edition
@@ -749,6 +736,8 @@ abstract class AbstractCompiler
                end
        end
 
+       fun finalize_ffi_for_module(mmodule: MModule) do mmodule.finalize_ffi(self)
+
        # Division facility
        # Avoid division by zero by returning the string "n/a"
        fun div(a,b:Int):String
@@ -756,13 +745,6 @@ abstract class AbstractCompiler
                if b == 0 then return "n/a"
                return ((a*10000/b).to_f / 100.0).to_precision(2)
        end
-
-       fun finalize_ffi_for_module(nmodule: AModule)
-       do
-               var visitor = new_visitor
-               nmodule.finalize_ffi(visitor, modelbuilder)
-               nmodule.finalize_nitni(visitor)
-       end
 end
 
 # A file unit (may be more than one file if
@@ -2663,15 +2645,11 @@ redef class MModule
                return properties_cache[mclass]
        end
        private var properties_cache: Map[MClass, Set[MProperty]] = new HashMap[MClass, Set[MProperty]]
-end
-
-redef class AModule
-       # Does this module use the legacy native interface?
-       fun uses_legacy_ni: Bool is abstract
 
-       # Write FFI results to file
-       fun finalize_ffi(v: AbstractCompilerVisitor, modelbuilder: ModelBuilder) is abstract
+       # Write FFI and nitni results to file
+       fun finalize_ffi(c: AbstractCompiler) do end
 
-       # Write nitni results to file
-       fun finalize_nitni(v: AbstractCompilerVisitor) is abstract
+       # Give requided addinional system libraries (as given to LD_LIBS)
+       # Note: can return null instead of an empty set
+       fun collect_linker_libs: nullable Set[String] do return null
 end
index 5d9c634..9abb685 100644 (file)
@@ -98,3 +98,48 @@ class CFunction
                return w
        end
 end
+
+# An extern file to compile
+class ExternFile
+       # The filename of the file
+       var filename: String
+
+       # The name of the target in the Makefile
+       # Usually the produced .o file
+       fun makefile_rule_name: String is abstract
+
+       # The content of the rule in the make
+       # Usually the one-line shell command after the tabulation
+       fun makefile_rule_content: String is abstract
+end
+
+# An extern C file to compile
+class ExternCFile
+       super ExternFile
+
+       init (filename, cflags: String)
+       do
+               super filename
+
+               self.cflags = cflags
+       end
+
+       # Additionnal specific CC compiler -c flags
+       var cflags: String
+
+       redef fun hash do return filename.hash
+       redef fun ==(o) do return o isa ExternCFile and filename == o.filename
+
+       redef fun makefile_rule_name do
+               var basename = filename.basename(".c")
+               var res = "{basename}.extern.o"
+               return res
+       end
+
+       redef fun makefile_rule_content do
+               var ff = filename.basename("")
+               var o = makefile_rule_name
+               return "$(CC) $(CFLAGS) {self.cflags} -c -o {o} {ff}"
+       end
+end
+
index 661928c..17241bd 100644 (file)
@@ -71,29 +71,11 @@ redef class Location
        fun as_line_pragma: String do return "#line {line_start} \"{file.filename}\"\n"
 end
 
-redef class AModule
+redef class MModule
        var c_compiler_options writable = ""
        var c_linker_options writable = ""
 end
 
-# An extern C file to compile
-class ExternCFile
-       super ExternFile
-
-       init (filename, cflags: String)
-       do
-               super filename
-
-               self.cflags = cflags
-       end
-
-       # Additionnal specific CC compiler -c flags
-       var cflags: String
-
-       redef fun hash do return filename.hash
-       redef fun ==(o) do return o isa ExternCFile and filename == o.filename
-end
-
 class ForeignCType
        super ForeignType
 
index b596a8a..ca64759 100644 (file)
@@ -134,33 +134,33 @@ private class CCompilerOptionsPhase
                end
 
                # retreive module
-               var nmodule = nmoduledecl.parent.as(AModule)
+               var mmodule = nmoduledecl.parent.as(AModule).mmodule.as(not null)
 
                for opt in simplified_options do
                        var cmd = opt.option
                        if annotation_name == compiler_annotation_name then
-                               process_c_compiler_annotation(nmodule, cmd)
+                               process_c_compiler_annotation(mmodule, cmd)
                        else if annotation_name == linker_annotation_name then
-                               process_c_linker_annotation(nmodule, cmd)
+                               process_c_linker_annotation(mmodule, cmd)
                        else if annotation_name == cpp_compiler_annotation_name then
-                               process_cpp_compiler_annotation(nmodule, cmd)
+                               process_cpp_compiler_annotation(mmodule, cmd)
                        else abort
                end
        end
 
-       fun process_c_compiler_annotation(nmodule: AModule, opt: String)
+       fun process_c_compiler_annotation(mmodule: MModule, opt: String)
        do
-               nmodule.c_compiler_options = "{nmodule.c_compiler_options} {opt}"
+               mmodule.c_compiler_options = "{mmodule.c_compiler_options} {opt}"
        end
 
-       fun process_c_linker_annotation(nmodule: AModule, opt: String)
+       fun process_c_linker_annotation(mmodule: MModule, opt: String)
        do
-               nmodule.c_linker_options = "{nmodule.c_linker_options} {opt}"
+               mmodule.c_linker_options = "{mmodule.c_linker_options} {opt}"
        end
 
-       fun process_cpp_compiler_annotation(nmodule: AModule, opt: String)
+       fun process_cpp_compiler_annotation(mmodule: MModule, opt: String)
        do
-               nmodule.cpp_compiler_options = "{nmodule.cpp_compiler_options} {opt}"
+               mmodule.cpp_compiler_options = "{mmodule.cpp_compiler_options} {opt}"
        end
 end
 
index d9e3045..44179db 100644 (file)
@@ -99,7 +99,7 @@ redef class AModule
                end
 
                ffi_ccu.write_as_impl(self, compdir)
-               for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, self.c_compiler_options))
+               for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, mmodule.c_compiler_options))
        end
 end
 
index 3af6d1a..be4d374 100644 (file)
@@ -26,6 +26,9 @@ end
 
 redef class AModule
        private var cpp_file: nullable CPPCompilationUnit = null
+end
+
+redef class MModule
        var cpp_compiler_options writable = ""
 end
 
@@ -133,7 +136,7 @@ class CPPLanguage
                nmodule.ffi_files.add(file)
 
                # add linked option to support C++
-               nmodule.c_linker_options = "{nmodule.c_linker_options} -lstdc++"
+               nmodule.mmodule.c_linker_options = "{nmodule.mmodule.c_linker_options} -lstdc++"
        end
 
        redef fun compile_callback(callback, nmodule, mmodule, ecc)
@@ -158,7 +161,8 @@ class CPPCompilationUnit
 
        fun write_to_files(amodule: AModule, compdir: String): ExternCppFile
        do
-               var base_name = "{amodule.mmodule.name}._ffi"
+               var mmodule = amodule.mmodule.as(not null)
+               var base_name = "{mmodule.name}._ffi"
 
                var h_file = "{base_name}.hpp"
                var guard = "{amodule.cname.to_s.to_upper}_NIT_HPP"
@@ -170,22 +174,22 @@ class CPPCompilationUnit
 
                files.add("{compdir}/{c_file}")
 
-               return new ExternCppFile("{compdir}/{c_file}", amodule)
+               return new ExternCppFile("{compdir}/{c_file}", mmodule)
        end
 end
 
 class ExternCppFile
        super ExternFile
 
-       var amodule: AModule
-       init(path: String, amodule: AModule)
+       var mmodule: MModule
+       init(path: String, mmodule: MModule)
        do
                super
-               self.amodule = amodule
+               self.mmodule = mmodule
        end
 
        redef fun makefile_rule_name do return "{filename.basename("")}.o"
-       redef fun makefile_rule_content do return "g++ {amodule.cpp_compiler_options} -c {filename.basename("")} -o {filename.basename("")}.o"
+       redef fun makefile_rule_content do return "g++ {mmodule.cpp_compiler_options} -c {filename.basename("")} -o {filename.basename("")}.o"
 end
 
 class ForeignCppType
index 86f53ea..a34243e 100644 (file)
@@ -144,15 +144,6 @@ redef class TExternCodeSegment
        end
 end
 
-# An extern file to compile
-class ExternFile
-       # The filename of the file
-       var filename: String
-
-       fun makefile_rule_name: String is abstract
-       fun makefile_rule_content: String is abstract
-end
-
 redef class CCompilationUnit
        fun write_as_impl( amodule: AModule, compdir: String )
        do
index 3addbb5..b263834 100644 (file)
@@ -67,6 +67,7 @@ class PkgconfigPhase
 
                # retreive module
                var nmodule = nmoduledecl.parent.as(AModule)
+               var mmodule = nmodule.mmodule.as(not null)
 
                # check availability of pkg-config
                var proc_which = new IProcess("which", "pkg-config")
@@ -92,12 +93,12 @@ class PkgconfigPhase
                        # compiler
                        var proc = new IProcess("pkg-config", "--cflags", pkg)
                        var compiler_opts = proc.read_all
-                       nmodule.c_compiler_options = "{nmodule.c_compiler_options} {compiler_opts.replace("\n", " ")}"
+                       mmodule.c_compiler_options = "{mmodule.c_compiler_options} {compiler_opts.replace("\n", " ")}"
 
                        # linker
                        proc = new IProcess("pkg-config", "--libs", pkg)
                        var linker_opts = proc.read_all
-                       nmodule.c_linker_options = "{nmodule.c_linker_options} {linker_opts.replace("\n", " ")}"
+                       mmodule.c_linker_options = "{mmodule.c_linker_options} {linker_opts.replace("\n", " ")}"
                end
 
        end
index ee2f52f..2583252 100644 (file)
@@ -21,38 +21,53 @@ intrude import abstract_compiler
 intrude import common_ffi
 import nitni
 
-redef class AModule
+redef class MModule
        private var foreign_callbacks = new ForeignCallbackSet
        var nitni_ccu: nullable CCompilationUnit = null
 
-       redef var uses_legacy_ni: Bool = false
-
-       redef fun finalize_ffi(v: AbstractCompilerVisitor, modelbuilder: ModelBuilder)
+       private fun nmodule(v: AbstractCompilerVisitor): nullable AModule
        do
-               finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule)
-               for file in ffi_files do v.compiler.extern_bodies.add(file)
+               var m2n = v.compiler.modelbuilder.mmodule2nmodule
+               return m2n.get_or_null(self)
        end
 
-       fun ensure_compile_nitni_base(v: AbstractCompilerVisitor)
+       redef fun finalize_ffi(compiler: AbstractCompiler)
        do
-               if nitni_ccu != null then return
+               if not uses_ffi then return
 
-               nitni_ccu = new CCompilationUnit
-       end
+               var v = compiler.new_visitor
+               var n = nmodule(v)
+               if n == null then return
+               n.finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule)
+               for file in n.ffi_files do v.compiler.extern_bodies.add(file)
 
-       redef fun finalize_nitni(v: AbstractCompilerVisitor)
-       do
                ensure_compile_nitni_base(v)
 
-               nitni_ccu.header_c_types.add("#include \"{mmodule.name}._ffi.h\"\n")
+               nitni_ccu.header_c_types.add("#include \"{name}._ffi.h\"\n")
 
-               nitni_ccu.write_as_nitni(self, v.compiler.modelbuilder.compile_dir)
+               nitni_ccu.write_as_nitni(n, v.compiler.modelbuilder.compile_dir)
 
                for file in nitni_ccu.files do
                        v.compiler.extern_bodies.add(new ExternCFile(file, c_compiler_options))
                end
        end
 
+       fun ensure_compile_nitni_base(v: AbstractCompilerVisitor)
+       do
+               if nitni_ccu != null then return
+
+               nitni_ccu = new CCompilationUnit
+       end
+
+       redef fun collect_linker_libs
+       do
+               var s = c_linker_options
+               if s.is_empty then return null
+               var res = new ArraySet[String]
+               res.add s
+               return res
+       end
+
        var compiled_callbacks: Array[NitniCallback] = new Array[NitniCallback]
 
        # Returns true if callbacks has yet to be generated and register it as being generated
@@ -68,7 +83,8 @@ redef class AExternPropdef
        fun compile_ffi_support_to_c(v: AbstractCompilerVisitor)
        do
                var mmodule = mpropdef.mclassdef.mmodule
-               var amainmodule = v.compiler.modelbuilder.mmodule2nmodule[v.compiler.mainmodule]
+               var mainmodule = v.compiler.mainmodule
+               var amainmodule = v.compiler.modelbuilder.mmodule2nmodule[mainmodule]
                var amodule = v.compiler.modelbuilder.mmodule2nmodule[mmodule]
                var mclass_type = mpropdef.mclassdef.bound_mtype
 
@@ -80,33 +96,33 @@ redef class AExternPropdef
                compile_ffi_method(amodule)
 
                # nitni - Compile missing callbacks
-               amodule.ensure_compile_nitni_base(v)
-               var ccu = amodule.nitni_ccu.as(not null)
+               mmodule.ensure_compile_nitni_base(v)
+               var ccu = mmodule.nitni_ccu.as(not null)
 
                for mtype in foreign_callbacks.types do
                        if not mtype.is_cprimitive then
                                mtype.compile_extern_type(v, ccu)
 
                                # has callbacks already been compiled? (this may very well happen with global compilation)
-                               if amodule.check_callback_compilation(mtype) then mtype.compile_extern_helper_functions(v, ccu)
+                               if mmodule.check_callback_compilation(mtype) then mtype.compile_extern_helper_functions(v, ccu)
                        end
                end
 
                # compile callbacks
-               for cb in foreign_callbacks.callbacks do if amainmodule.check_callback_compilation(cb) then
+               for cb in foreign_callbacks.callbacks do if mainmodule.check_callback_compilation(cb) then
                        cb.compile_extern_callback(v, ccu)
                end
 
-               for cb in foreign_callbacks.supers do if amainmodule.check_callback_compilation(cb) then
+               for cb in foreign_callbacks.supers do if mainmodule.check_callback_compilation(cb) then
                        cb.compile_extern_callback(v, ccu)
                end
 
-               for cb in foreign_callbacks.casts do if amainmodule.check_callback_compilation(cb) then
+               for cb in foreign_callbacks.casts do if mainmodule.check_callback_compilation(cb) then
                        cb.compile_extern_callbacks(v, ccu)
                end
 
                # manage nitni callback set
-               amodule.foreign_callbacks.join(foreign_callbacks)
+               mmodule.foreign_callbacks.join(foreign_callbacks)
        end
 end
 
@@ -119,7 +135,6 @@ redef class AExternMethPropdef
                # if using the old native interface fallback on previous implementation
                var nextern = self.n_extern
                if nextern != null then
-                       amodule.uses_legacy_ni = true
                        super
                        return
                end
@@ -186,7 +201,6 @@ redef class AExternInitPropdef
                # if using the old native interface fallback on previous implementation
                var nextern = self.n_extern
                if nextern != null then
-                       amodule.uses_legacy_ni = true
                        super
                        return
                end
index a85f889..ce8fde1 100644 (file)
@@ -25,7 +25,6 @@ module global_compiler
 
 import abstract_compiler
 import rapid_type_analysis
-import compiler_ffi
 
 redef class ModelBuilder
        # Entry point to performs a global compilation on the AST of a complete program.
@@ -274,7 +273,7 @@ class GlobalCompilerVisitor
                        end
                        self.add("{res} = BOX_{valtype.c_name}({value}); /* autobox from {value.mtype} to {mtype} */")
                        return res
-               else if value.mtype.cname_blind == "void*" and mtype.cname_blind == "void*" then
+               else if value.mtype.ctype == "void*" and mtype.ctype == "void*" then
                        return value
                else
                        # Bad things will appen!
index 965be59..4228a62 100644 (file)
@@ -25,6 +25,7 @@ import global_compiler
 import separate_erasure_compiler
 import separate_compiler
 import android_platform
+import compiler_ffi
 
 # Create a tool context to handle options and paths
 var toolcontext = new ToolContext
index 92cd821..4b1c5cc 100644 (file)
@@ -18,7 +18,6 @@ module separate_compiler
 import abstract_compiler
 import layout_builders
 import rapid_type_analysis
-import compiler_ffi
 
 # Add separate compiler specific options
 redef class ToolContext
@@ -934,10 +933,10 @@ class SeparateCompiler
                self.header.add_decl("struct nitni_instance \{struct instance *value;\};")
        end
        
-       redef fun finalize_ffi_for_module(nmodule)
+       redef fun finalize_ffi_for_module(mmodule)
        do
                var old_module = self.mainmodule
-               self.mainmodule = nmodule.mmodule.as(not null)
+               self.mainmodule = mmodule
                super
                self.mainmodule = old_module
        end
@@ -984,7 +983,7 @@ class SeparateCompilerVisitor
                        self.require_declaration("BOX_{valtype.c_name}")
                        self.add("{res} = BOX_{valtype.c_name}({value}); /* autobox from {value.mtype} to {mtype} */")
                        return res
-               else if value.mtype.cname_blind == "void*" and mtype.cname_blind == "void*" then
+               else if value.mtype.ctype == "void*" and mtype.ctype == "void*" then
                        return value
                else
                        # Bad things will appen!
diff --git a/src/separate_options.nit b/src/separate_options.nit
deleted file mode 100644 (file)
index 8ebe70e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2012 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.
-
-# module adding separate specification of opts to compiler
-module separate_options
-
-import mmloader
-import compiling
-
-# only to order correctly redefs of compile_separate_module
-import native_interface
-import ffi
-
-redef class ToolContext
-       # all ops precised in .ops files
-       var separate_options : OptionContext = new OptionContext
-       var opt_cc_lib_paths: OptionArray = new OptionArray("Path to libraries for C compiler", "--cc-lib-path")
-       var opt_cc_libs: OptionArray = new OptionArray("Name of library to use for C compiler", "--cc-lib-name")
-       var opt_cc_include_paths: OptionArray = new OptionArray("Path to .h files for C compiler", "--cc-header-path")
-
-       redef init
-       do
-               super
-
-               separate_options.add_option( opt_cc_lib_paths )
-               separate_options.add_option( opt_cc_libs )
-               separate_options.add_option( opt_cc_include_paths )
-       end
-
-       fun integrate_separate_options( options : String, mod : MMModule )
-       do
-               for line in options.split_with('\n') do
-                       line = line.strip_extension( "\n" )
-                       separate_options.parse( line.split_with( ' ' ) )
-                       var rest = new Array[String]
-                       for s in separate_options.rest do if s.length > 0 then rest.add( s )
-                       if rest.length > 0 then
-                               error( null, "module \"{mod}\" args file has unknown args: {rest.join(", ")}" )
-                       end
-               end
-
-               cc_lib_paths.append( opt_cc_lib_paths.value )
-               cc_libs.append( opt_cc_libs.value )
-               cc_include_paths.append( opt_cc_include_paths.value )
-       end
-end
-
-redef class MMSrcModule
-
-       redef fun compile_separate_module(cprogram)
-       do
-               super
-
-               # extract options from file
-               var options_path = "{location.file.filename}.args"
-               if options_path.file_exists then
-                       var option_file = new IFStream.open( options_path )
-                       var option_content = option_file.read_all
-                       option_file.close
-
-                       cprogram.program.tc.integrate_separate_options( option_content, self )
-                       cprogram.program.tc.check_errors
-               end
-       end
-end
index bf9d576..dd8cb87 100644 (file)
@@ -1,5 +1,5 @@
 
-PROGS=*.nit ../examples/*.nit ../examples/leapfrog/leapfrog.nit ../examples/shoot/shoot_logic.nit ../lib/*.nit ../src/nitdoc.nit ../src/test_parser.nit ../src/nit.nit ../src/nitmetrics.nit ../src/nitg.nit
+PROGS=*.nit ../examples/*.nit ../examples/leapfrog/leapfrog.nit ../examples/shoot/shoot_logic.nit ../contrib/pep8analysis/src/pep8analysis ../lib/*.nit ../src/nitdoc.nit ../src/test_parser.nit ../src/nit.nit ../src/nitmetrics.nit ../src/nitg.nit
 
 all: niti nitg-g nitg-s
 
diff --git a/tests/base_ni.nit.c b/tests/base_ni.nit.c
deleted file mode 100644 (file)
index c78542b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-       Extern implementation of Nit module base_ni
-       File initially created by nits to customize type of extern classes
-*/
-
-#include "base_ni.nit.h"
-
-/*
-C implementation of base_ni::Object::inita
-*/
-void* Object_inita___impl( Object recv )
-{
-       return NULL;
-}
diff --git a/tests/base_ni.nit.h b/tests/base_ni.nit.h
deleted file mode 100644 (file)
index b373c36..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-       Extern implementation of Nit module base_ni
-       File initially created by nits to implement extern methods body
-*/
-
-#ifndef BASE_NI_NIT_H
-#define BASE_NI_NIT_H
-
-#include <base_ni._nitni.h>
-
-void* Object_inita___impl( Object recv );
-
-#endif
index 4050a44..e1ba289 100644 (file)
@@ -2,3 +2,4 @@ init_inherit
 init_linext
 inline
 test_json
+pep8analysis_args
index 4050a44..e1ba289 100644 (file)
@@ -2,3 +2,4 @@ init_inherit
 init_linext
 inline
 test_json
+pep8analysis_args
index 2d458dd..906bd9b 100644 (file)
@@ -11,5 +11,6 @@ nitg_args1
 nitg_args3
 nitg_args5
 nitg_args6
+pep8analysis
 test_android_platform
 android
diff --git a/tests/pep8analysis.args b/tests/pep8analysis.args
new file mode 100644 (file)
index 0000000..fb95cdc
--- /dev/null
@@ -0,0 +1,4 @@
+../contrib/pep8analysis/tests/micro/*.pep ../contrib/pep8analysis/tests/privat/*.pep ../contrib/pep8analysis/tests/terrasa/*.pep -o out/pep8analysis_args1
+--ast ../contrib/pep8analysis/tests/micro/*.pep ../contrib/pep8analysis/tests/privat/*.pep ../contrib/pep8analysis/tests/terrasa/*.pep -o out/pep8analysis_args2
+--cfg ../contrib/pep8analysis/tests/micro/*.pep ../contrib/pep8analysis/tests/privat/*.pep ../contrib/pep8analysis/tests/terrasa/*.pep -o out/pep8analysis_args3
+--cfg-long ../contrib/pep8analysis/tests/micro/*.pep ../contrib/pep8analysis/tests/privat/*.pep ../contrib/pep8analysis/tests/terrasa/*.pep -o out/pep8analysis_args4
diff --git a/tests/sav/pep8analysis.res b/tests/sav/pep8analysis.res
new file mode 100644 (file)
index 0000000..0b7e08a
--- /dev/null
@@ -0,0 +1,10 @@
+Usage: pep8analysis [options] file.pep [other_file.pep [...]]
+Options:
+  --ast                Print the AST
+  --cfg                Print the CFG to "cfg.dot" (for debugging purposes)
+  --cfg-long           Print the long format CFG
+  --inline             Inline function calls in the CFG
+  --report-types-top   Report unknown types
+  --help, -h           Display this help message
+  --quiet, -q          Do not show notes
+  --output, -o         Output directory
diff --git a/tests/sav/pep8analysis_args1.res b/tests/sav/pep8analysis_args1.res
new file mode 100644 (file)
index 0000000..0ad9744
--- /dev/null
@@ -0,0 +1,79 @@
+Analyzing ../contrib/pep8analysis/tests/micro/directive-in-code.pep
+Analyzing ../contrib/pep8analysis/tests/micro/range.pep
+Analyzing ../contrib/pep8analysis/tests/micro/to-graph.pep
+Analyzing ../contrib/pep8analysis/tests/micro/types.pep
+Analyzing ../contrib/pep8analysis/tests/privat/02-fibo.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-abc.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-leplusgrand.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-0et100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-1a100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-aei.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-otan.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_3n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_x.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-sommeVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-compte1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-majuscules.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-menu.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-print-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-processVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-puissance2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes3.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-x100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-matrice.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stris.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-abus.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-vars.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-fib.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-incr.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-pile.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-tab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-triforce.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-varlocales.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-liste.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-produit.pep
+Analyzing ../contrib/pep8analysis/tests/privat/fib.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/addition_stro.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/boucle.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/chari_charo.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/division.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/hello.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_elseif_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/lecture_chaine.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/matrice.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/max_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/multiplication.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/reverse_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/somme_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/soustraction.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/tri_bulles.pep
+# Notes:
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:4; unreachable instructions
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:2; data in program flow
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in rA, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; use of partial word in rA, got 1st byte of word then code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in rA, got 2x code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/privat/05-1a100.pep:10; expected word in m1, got 2x code
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; invalid line following instruction
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:14; overwriting code at instr@m76 with code
+Warning: ../contrib/pep8analysis/tests/privat/06-menu.pep:13; use of indirect jumps, the CFG may be wrong
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:7; use of uninitialized values
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:9; use of uninitialized values
+Error:   ../contrib/pep8analysis/tests/privat/07-stris.pep:39; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/08-abus.pep:8--10; unreachable instructions
diff --git a/tests/sav/pep8analysis_args2.res b/tests/sav/pep8analysis_args2.res
new file mode 100644 (file)
index 0000000..0ad9744
--- /dev/null
@@ -0,0 +1,79 @@
+Analyzing ../contrib/pep8analysis/tests/micro/directive-in-code.pep
+Analyzing ../contrib/pep8analysis/tests/micro/range.pep
+Analyzing ../contrib/pep8analysis/tests/micro/to-graph.pep
+Analyzing ../contrib/pep8analysis/tests/micro/types.pep
+Analyzing ../contrib/pep8analysis/tests/privat/02-fibo.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-abc.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-leplusgrand.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-0et100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-1a100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-aei.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-otan.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_3n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_x.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-sommeVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-compte1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-majuscules.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-menu.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-print-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-processVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-puissance2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes3.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-x100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-matrice.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stris.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-abus.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-vars.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-fib.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-incr.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-pile.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-tab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-triforce.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-varlocales.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-liste.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-produit.pep
+Analyzing ../contrib/pep8analysis/tests/privat/fib.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/addition_stro.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/boucle.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/chari_charo.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/division.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/hello.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_elseif_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/lecture_chaine.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/matrice.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/max_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/multiplication.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/reverse_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/somme_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/soustraction.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/tri_bulles.pep
+# Notes:
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:4; unreachable instructions
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:2; data in program flow
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in rA, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; use of partial word in rA, got 1st byte of word then code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in rA, got 2x code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/privat/05-1a100.pep:10; expected word in m1, got 2x code
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; invalid line following instruction
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:14; overwriting code at instr@m76 with code
+Warning: ../contrib/pep8analysis/tests/privat/06-menu.pep:13; use of indirect jumps, the CFG may be wrong
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:7; use of uninitialized values
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:9; use of uninitialized values
+Error:   ../contrib/pep8analysis/tests/privat/07-stris.pep:39; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/08-abus.pep:8--10; unreachable instructions
diff --git a/tests/sav/pep8analysis_args3.res b/tests/sav/pep8analysis_args3.res
new file mode 100644 (file)
index 0000000..0ad9744
--- /dev/null
@@ -0,0 +1,79 @@
+Analyzing ../contrib/pep8analysis/tests/micro/directive-in-code.pep
+Analyzing ../contrib/pep8analysis/tests/micro/range.pep
+Analyzing ../contrib/pep8analysis/tests/micro/to-graph.pep
+Analyzing ../contrib/pep8analysis/tests/micro/types.pep
+Analyzing ../contrib/pep8analysis/tests/privat/02-fibo.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-abc.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-leplusgrand.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-0et100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-1a100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-aei.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-otan.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_3n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_x.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-sommeVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-compte1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-majuscules.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-menu.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-print-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-processVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-puissance2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes3.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-x100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-matrice.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stris.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-abus.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-vars.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-fib.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-incr.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-pile.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-tab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-triforce.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-varlocales.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-liste.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-produit.pep
+Analyzing ../contrib/pep8analysis/tests/privat/fib.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/addition_stro.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/boucle.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/chari_charo.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/division.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/hello.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_elseif_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/lecture_chaine.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/matrice.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/max_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/multiplication.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/reverse_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/somme_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/soustraction.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/tri_bulles.pep
+# Notes:
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:4; unreachable instructions
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:2; data in program flow
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in rA, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; use of partial word in rA, got 1st byte of word then code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in rA, got 2x code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/privat/05-1a100.pep:10; expected word in m1, got 2x code
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; invalid line following instruction
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:14; overwriting code at instr@m76 with code
+Warning: ../contrib/pep8analysis/tests/privat/06-menu.pep:13; use of indirect jumps, the CFG may be wrong
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:7; use of uninitialized values
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:9; use of uninitialized values
+Error:   ../contrib/pep8analysis/tests/privat/07-stris.pep:39; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/08-abus.pep:8--10; unreachable instructions
diff --git a/tests/sav/pep8analysis_args4.res b/tests/sav/pep8analysis_args4.res
new file mode 100644 (file)
index 0000000..0ad9744
--- /dev/null
@@ -0,0 +1,79 @@
+Analyzing ../contrib/pep8analysis/tests/micro/directive-in-code.pep
+Analyzing ../contrib/pep8analysis/tests/micro/range.pep
+Analyzing ../contrib/pep8analysis/tests/micro/to-graph.pep
+Analyzing ../contrib/pep8analysis/tests/micro/types.pep
+Analyzing ../contrib/pep8analysis/tests/privat/02-fibo.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-abc.pep
+Analyzing ../contrib/pep8analysis/tests/privat/04-leplusgrand.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-0et100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-1a100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-aei.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-otan.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_3n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_n.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-simul_x.pep
+Analyzing ../contrib/pep8analysis/tests/privat/05-sommeVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-compte1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-majuscules.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-menu.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-print-non-pur.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-processVec.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-puissance2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes1.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-sommes3.pep
+Analyzing ../contrib/pep8analysis/tests/privat/06-x100.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-matrice.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-stris.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri.pep
+Analyzing ../contrib/pep8analysis/tests/privat/07-tri2.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-abus.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div-vars.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-div.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-fib.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-incr.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab-stack.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-liretab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-pile.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-tab.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-triforce.pep
+Analyzing ../contrib/pep8analysis/tests/privat/08-varlocales.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-liste.pep
+Analyzing ../contrib/pep8analysis/tests/privat/09-produit.pep
+Analyzing ../contrib/pep8analysis/tests/privat/fib.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/addition_stro.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/boucle.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/chari_charo.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/division.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/hello.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/if_elseif_else.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/lecture_chaine.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/matrice.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/max_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/multiplication.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/reverse_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/somme_tableau.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/soustraction.pep
+Analyzing ../contrib/pep8analysis/tests/terrasa/tri_bulles.pep
+# Notes:
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:4; unreachable instructions
+Error:   ../contrib/pep8analysis/tests/micro/directive-in-code.pep:2; data in program flow
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in rA, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:1; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; use of partial word in rA, got 1st byte of word then code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:3; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in rA, got 2x code
+Warning: ../contrib/pep8analysis/tests/micro/types.pep:6; expected word in m123, got 2x uninitialized
+Warning: ../contrib/pep8analysis/tests/privat/05-1a100.pep:10; expected word in m1, got 2x code
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; invalid line following instruction
+Error:   ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:32; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/06-calc-non-pur.pep:14; overwriting code at instr@m76 with code
+Warning: ../contrib/pep8analysis/tests/privat/06-menu.pep:13; use of indirect jumps, the CFG may be wrong
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:7; use of uninitialized values
+Warning: ../contrib/pep8analysis/tests/privat/07-stri.pep:9; use of uninitialized values
+Error:   ../contrib/pep8analysis/tests/privat/07-stris.pep:39; unreachable instructions
+Warning: ../contrib/pep8analysis/tests/privat/08-abus.pep:8--10; unreachable instructions
diff --git a/tests/test_ni_accessor.nit.c b/tests/test_ni_accessor.nit.c
deleted file mode 100644 (file)
index c9e54a2..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_accessor.nit.h"
-
-/*
-C implementation of test_ni_accessor::A::print_all
-
-Imported methods signatures:
-       char * String_to_cstring( String recv ) for string::String::to_cstring
-       String A_r( A recv ) for test_ni_accessor::A::r
-       String A_rw( A recv ) for test_ni_accessor::A::rw
-*/
-void A_print_all___impl( A recv )
-{
-       printf( "%s %s\n",
-               String_to_cstring( A_r( recv ) ),
-               String_to_cstring( A_rw( recv ) ) );
-}
-
-/*
-C implementation of test_ni_accessor::A::modify
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-       void A_w__eq( A recv, String w ) for test_ni_accessor::A::w=
-       void A_rw__eq( A recv, String rw ) for test_ni_accessor::A::rw=
-*/
-void A_modify___impl( A recv )
-{
-       A_w__assign( recv, NativeString_to_s( "w set from native" ) );
-       A_rw__assign( recv, NativeString_to_s( "rw set from native" ) );
-}
-
-/*
-C implementation of test_ni_accessor::B::print_and_modify
-
-Imported methods signatures:
-       String A_rw( A recv ) for test_ni_accessor::A::rw
-       void A_rw__assign( A recv, String value ) for test_ni_accessor::A::rw=
-       char * String_to_cstring( String recv ) for string::String::to_cstring
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-void B_print_and_modify___impl( B recv, A a )
-{
-       printf( "%s\n", String_to_cstring( A_rw( a ) ) );
-       A_rw__assign( a, NativeString_to_s( "set from native" ) );
-       printf( "%s\n", String_to_cstring( A_rw( a ) ) );
-}
diff --git a/tests/test_ni_accessor.nit.h b/tests/test_ni_accessor.nit.h
deleted file mode 100644 (file)
index 02c81e8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_accessor_IMPL_NIT_H
-#define test_ni_accessor_IMPL_NIT_H
-
-#include <test_ni_accessor._nitni.h>
-
-void A_print_all___impl( A recv );
-void A_modify___impl( A recv );
-void B_print_and_modify___impl( B recv, A a );
-
-#endif
diff --git a/tests/test_ni_cast_extra.nit.c b/tests/test_ni_cast_extra.nit.c
deleted file mode 100644 (file)
index 31a736c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_cast_extra.nit.h"
-
-/*
-C implementation of test_ni_cast_extra::A::isa_b
-
-Imported methods signatures:
-       int A_is_a_B( A value ) to check if a A is a B
-       B A_as_B( A value ) to cast from A to B
-*/
-int A_isa_b___impl( A recv )
-{
-       return A_is_a_B( recv );
-}
-
-/*
-C implementation of test_ni_cast_extra::A::as_b
-
-Imported methods signatures:
-       int A_is_a_B( A value ) to check if a A is a B
-       B A_as_B( A value ) to cast from A to B
-       int A_is_a_nullable_B( A value ) to check if a A is a nullable B
-       nullable_B A_as_nullable_B( A value ) to cast from A to nullable B
-*/
-nullable_B A_as_b___impl( A recv )
-{
-       if ( A_is_a_nullable_B( recv ) )
-               return A_as_nullable_B( recv );
-       else
-               return null_B();
-}
-
-/*
-C implementation of test_ni_cast_extra::C::isa_a
-
-Imported methods signatures:
-       int C_is_a_A( C value ) to check if a C is a A
-       A C_as_A( C value ) to cast from C to A
-*/
-int C_isa_a___impl( C recv )
-{
-       return C_is_a_A( recv );
-}
-
-/*
-C implementation of test_ni_cast_extra::D::as_a
-
-Imported methods signatures:
-       int D_is_a_A( D value ) to check if a D is a A
-       A D_as_A( D value ) to cast from D to A
-*/
-A D_as_a___impl( D recv )
-{
-       return D_as_A( recv );
-}
diff --git a/tests/test_ni_cast_extra.nit.h b/tests/test_ni_cast_extra.nit.h
deleted file mode 100644 (file)
index dfc7cff..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_cast_extra_IMPL_NIT_H
-#define test_ni_cast_extra_IMPL_NIT_H
-
-#include <test_ni_cast_extra._nitni.h>
-
-int A_isa_b___impl( A recv );
-nullable_B A_as_b___impl( A recv );
-int C_isa_a___impl( C recv );
-A D_as_a___impl( D recv );
-
-#endif
diff --git a/tests/test_ni_cast_simple.nit.c b/tests/test_ni_cast_simple.nit.c
deleted file mode 100644 (file)
index 633f40a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_cast_simple.nit.h"
-
-/*
-C implementation of test_ni_cast_simple::Object::s_to_o
-
-Imported methods signatures:
-       int String_is_a_Object( String value ) to check if a String is a Object
-       Object String_as_Object( String value ) to cast from String to Object
-*/
-Object Object_s_to_o___impl( Object recv, String s )
-{
-    return String_as_Object( s );
-}
-
-/*
-C implementation of test_ni_cast_simple::Object::n_to_nn
-
-Imported methods signatures:
-       nullable_String String_as_nullable( String value ) to cast from String to nullable String
-*/
-nullable_String Object_n_to_nn___impl( Object recv, String s )
-{
-    return String_as_nullable( s );
-}
-
-/*
-C implementation of test_ni_cast_simple::Object::nn_to_n
-
-Imported methods signatures:
-       int String_is_null( nullable_String value ) to check if a nullable String is a String
-       String nullable_String_as_not_null( nullable_String value ) to cast from nullable String to String
-*/
-String Object_nn_to_n___impl( Object recv, nullable_String s )
-{
-    return String_as_not_null( s );
-}
diff --git a/tests/test_ni_cast_simple.nit.h b/tests/test_ni_cast_simple.nit.h
deleted file mode 100644 (file)
index 42793ea..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_cast_simple_IMPL_NIT_H
-#define test_ni_cast_simple_IMPL_NIT_H
-
-#include <test_ni_cast_simple._nitni.h>
-
-Object Object_s_to_o___impl( Object recv, String s );
-nullable_String Object_n_to_nn___impl( Object recv, String s );
-String Object_nn_to_n___impl( Object recv, nullable_String s );
-
-#endif
diff --git a/tests/test_ni_casts.nit.c b/tests/test_ni_casts.nit.c
deleted file mode 100644 (file)
index 084c6cf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_casts.nit.h"
-
-/*
-C implementation of test_ni_casts::Object::a
-
-Imported methods signatures:
-       int String_is_a_Object( String value ) to check if a String is a Object
-       Object String_as_Object( String value ) to cast from String to Object
-*/
-Object Object_a___impl( Object recv, String s )
-{
-    return String_as_Object( s );
-}
-
-/*
-C implementation of test_ni_casts::Object::b
-
-Imported methods signatures:
-       nullable_String String_as_nullable( String value ) to cast from String to nullable String
-*/
-nullable_String Object_b___impl( Object recv, String s )
-{
-    return String_as_nullable( s );
-}
-
-/*
-C implementation of test_ni_casts::Object::c
-
-Imported methods signatures:
-       int nullable_String_is_null( nullable_String value ) to check if a nullable String is a String
-       String nullable_String_as_not_null( nullable_String value ) to cast from nullable String to String
-*/
-String Object_c___impl( Object recv, nullable_String s )
-{
-    return nullable_String_as_not_null( s );
-}
diff --git a/tests/test_ni_casts.nit.h b/tests/test_ni_casts.nit.h
deleted file mode 100644 (file)
index 0592b25..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_casts_IMPL_NIT_H
-#define test_ni_casts_IMPL_NIT_H
-
-#include <test_ni_casts._nitni.h>
-
-Object Object_a___impl( Object recv, String s );
-nullable_String Object_b___impl( Object recv, String s );
-String Object_c___impl( Object recv, nullable_String s );
-
-#endif
diff --git a/tests/test_ni_fibonacci.nit.c b/tests/test_ni_fibonacci.nit.c
deleted file mode 100644 (file)
index c0141a9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_fibonacci.nit.h"
-
-
-/*
-C implementation of fibonacci::FibonacciEngine::fibonacci
-
-Imported methods signatures:
-       bigint FibonacciEngine_fibonacci( FibonacciEngine recv, bigint n ) for fibonacci::FibonacciEngine::fibonacci
-*/
-bigint FibonacciEngine_fibonacci___impl( FibonacciEngine recv, bigint n )
-{
-       if ( n == 0 )
-           return 0;
-       if ( n == 1 )
-           return 1;
-       else
-           return FibonacciEngine_fibonacci( recv, n-1 ) + FibonacciEngine_fibonacci( recv,  n-2 );
-}
-
-/*
-C implementation of fibonacci::Int::fibonacci
-
-Imported methods signatures:
-       bigint Int_fibonacci( bigint recv ) for fibonacci::Int::fibonacci
-*/
-bigint Int_fibonacci___impl( bigint recv )
-{
-       if ( recv == 0 )
-           return 0;
-       else if ( recv == 1 )
-           return 1;
-       else
-           return Int_fibonacci( recv-1 ) + Int_fibonacci( recv-2 );
-}
diff --git a/tests/test_ni_fibonacci.nit.h b/tests/test_ni_fibonacci.nit.h
deleted file mode 100644 (file)
index a834646..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef fibonacci_NIT_H
-#define fibonacci_NIT_H
-
-#include <test_ni_fibonacci._nitni.h>
-
-bigint FibonacciEngine_fibonacci___impl( FibonacciEngine recv, bigint n );
-bigint Int_fibonacci___impl( bigint recv );
-
-#endif
diff --git a/tests/test_ni_global_not_called_but_referred.nit.c b/tests/test_ni_global_not_called_but_referred.nit.c
deleted file mode 100644 (file)
index 7e2eb6f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-       Extern implementation of Nit module test_ni_global_not_called_but_referred
-*/
-
-#include "test_ni_global_not_called_but_referred.nit.h"
-
-/*
-C implementation of test_ni_global_not_called_but_referred::A::f
-
-Imported methods signatures:
-       void B_g( B recv ) for test_ni_global_not_called_but_referred::B::g
-*/
-void A_f___impl( A recv, B b ) {
-       B_g( b );
-}
diff --git a/tests/test_ni_global_not_called_but_referred.nit.h b/tests/test_ni_global_not_called_but_referred.nit.h
deleted file mode 100644 (file)
index 96776da..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-       Extern implementation of Nit module test_ni_global_not_called_but_referred
-*/
-
-#ifndef TEST_NI_GLOBAL_NOT_CALLED_BUT_REFERRED_NIT_H
-#define TEST_NI_GLOBAL_NOT_CALLED_BUT_REFERRED_NIT_H
-
-#include <test_ni_global_not_called_but_referred._nitni.h>
-
-#endif
-void A_f___impl( A recv, B b );
diff --git a/tests/test_ni_global_only_from_native.nit.c b/tests/test_ni_global_only_from_native.nit.c
deleted file mode 100644 (file)
index 0b0bb12..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2012 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_global_only_from_native.nit.h"
-
-/*
-C implementation of test_ni_global_only_from_native::A::f
-
-Imported methods signatures:
-       void B_g( B recv ) for test_ni_global_only_from_native::B::g
-*/
-void A_f___impl( A recv, B b ) {
-       B_g( b );
-}
diff --git a/tests/test_ni_global_only_from_native.nit.h b/tests/test_ni_global_only_from_native.nit.h
deleted file mode 100644 (file)
index a6da8b8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2012 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef TEST_NI_GLOBAL_ONLY_FROM_NATIVE_NIT_H
-#define TEST_NI_GLOBAL_ONLY_FROM_NATIVE_NIT_H
-
-#include <test_ni_global_only_from_native._nitni.h>
-
-#endif
-void A_f___impl( A recv, B b );
diff --git a/tests/test_ni_import_init.nit.c b/tests/test_ni_import_init.nit.c
deleted file mode 100644 (file)
index 2aba0b1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_import_init.nit.h"
-
-/*
-C implementation of acces::A::ex_sees_b_attr
-
-Imported methods signatures:
-       bigint B_i( B recv ) for acces::B::i
-*/
-bigint A_ex_sees_b_attr___impl( A recv, B b )
-{
-       return B_i( b );
-}
-
-/*
-C implementation of acces::A::ex_sees_b_init
-
-Imported methods signatures:
-       void new_B(  ) for acces::B::init
-       void new_B_from( bigint i ) for acces::B::from
-*/
-B A_ex_sees_b_init___impl( A recv, bigint i )
-{
-       return new_B_from( i );
-}
diff --git a/tests/test_ni_import_init.nit.h b/tests/test_ni_import_init.nit.h
deleted file mode 100644 (file)
index bce9903..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef acces_NIT_H
-#define acces_NIT_H
-
-#include <test_ni_import_init._nitni.h>
-
-bigint A_ex_sees_b_attr___impl( A recv, B b );
-B A_ex_sees_b_init___impl( A recv, bigint i );
-
-#endif
diff --git a/tests/test_ni_import_meth.nit.c b/tests/test_ni_import_meth.nit.c
deleted file mode 100644 (file)
index 5d54fc2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_import_meth.nit.h"
-
-/*
-C implementation of simple::A::ex_sees_nity
-
-Imported methods signatures:
-       void A_nity( A recv ) for simple::A::nity
-*/
-void A_ex_sees_nity___impl( A recv )
-{
-       A_nity( recv );
-}
-
-/*
-C implementation of simple::A::ex_sees_nities
-
-Imported methods signatures:
-       void A_nity1( A recv, bigint x ) for simple::A::nity1
-       void A_nity2( A recv, bigint x, bigint y ) for simple::A::nity2
-*/
-void A_ex_sees_nities___impl( A recv )
-{
-       A_nity( recv );
-       A_nity1( recv, 3 );
-       A_nity2( recv, 7, 13 );
-}
diff --git a/tests/test_ni_import_meth.nit.h b/tests/test_ni_import_meth.nit.h
deleted file mode 100644 (file)
index e4bd6c4..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef simple_NIT_H
-#define simple_NIT_H
-
-#include <test_ni_import_meth._nitni.h>
-
-void A_ex_sees_nity___impl( A recv );
-void A_ex_sees_nities___impl( A recv );
-
-#endif
diff --git a/tests/test_ni_inits.nit.c b/tests/test_ni_inits.nit.c
deleted file mode 100644 (file)
index 7003fab..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_inits.nit.h"
-
-/*
-C implementation of test_ni_inits::A::with_b
-*/
-A new_A_with_b___impl(  )
-{
-       A a = malloc( sizeof(char) );
-       *a = 'b';
-       return a;
-}
-
-/*
-C implementation of test_ni_inits::A::alloc
-*/
-A new_A_alloc___impl(  )
-{
-       A a = malloc( sizeof(char) );
-       return a;
-}
-
-/*
-C implementation of test_ni_inits::A::set
-*/
-void A_set___impl( A recv, char v )
-{
-       *recv = 'v';
-}
-
-/*
-C implementation of test_ni_inits::A::(string::Object::to_s)
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-String A_to_s___impl( A recv )
-{
-       char *str = malloc( 2 * sizeof(char) );
-       str[0] = *recv;
-       str[1] = 0;
-
-       return NativeString_to_s( str );
-}
diff --git a/tests/test_ni_local_ref.nit.c b/tests/test_ni_local_ref.nit.c
deleted file mode 100644 (file)
index 04a35c4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2012 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_local_ref.nit.h"
-
-ToBePreserved global_tbp = NULL;
-
-/*
-C implementation of test_ni_references::A::run
-
-Imported methods signatures:
-       void ToBePreserved_output( ToBePreserved recv ) for test_ni_references::ToBePreserved::(kernel::Object::output)
-*/
-void A_run___impl( A recv, ToBePreserved a, ToBePreserved b, ToBePreserved c, ToBePreserved d )
-{
-       ToBePreserved_output( a );
-       ToBePreserved_output( b );
-       ToBePreserved_output( c );
-       ToBePreserved_output( d );
-
-       /* force call to GC */
-       A_launch_gc( recv );
-
-       ToBePreserved_output( a );
-       ToBePreserved_output( b );
-       ToBePreserved_output( c );
-       ToBePreserved_output( d );
-}
-
-void A_run2___impl( A recv, ToBePreserved a, ToBePreserved b, ToBePreserved c, ToBePreserved d )
-{
-       ToBePreserved_output( a );
-       ToBePreserved_output( b );
-       ToBePreserved_output( c );
-       ToBePreserved_output( d );
-
-       /* force call to GC */
-       A_launch_gc( recv );
-
-       /* go 1 deeper level */
-       A_run( recv, a, b, c, d );
-
-       /* force call to GC */
-       A_launch_gc( recv );
-
-       ToBePreserved_output( a );
-       ToBePreserved_output( b );
-       ToBePreserved_output( c );
-       ToBePreserved_output( d );
-}
-
diff --git a/tests/test_ni_local_ref.nit.h b/tests/test_ni_local_ref.nit.h
deleted file mode 100644 (file)
index 8626d31..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2012 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef TEST_NI_LOCAL_REF_NIT_H
-#define TEST_NI_LOCAL_REF_NIT_H
-
-#include <test_ni_local_ref._nitni.h>
-
-void A_run___impl( A recv, ToBePreserved a, ToBePreserved b, ToBePreserved c, ToBePreserved d );
-void A_run2___impl( A recv, ToBePreserved a, ToBePreserved b, ToBePreserved c, ToBePreserved d );
-
-#endif
diff --git a/tests/test_ni_new.nit.c b/tests/test_ni_new.nit.c
deleted file mode 100644 (file)
index 7d7c6c0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_new.nit.h"
-
-#include <stdlib.h>
-
-
-/*
-C implementation of extern_new::A::init
-
-Imported methods signatures:
-       void A_p( A recv ) for extern_new::A::p
-*/
-int dv = 1234;
-A new_A___impl(  )
-{
-       return &dv;
-}
-
-/*
-C implementation of extern_new::A::with_args
-*/
-A new_A_with_args___impl( bigint x, A a )
-{
-    int* v = (int*)malloc( sizeof(int) );
-    (*v) = (int)x;
-       return v;
-}
-
-/*
-C implementation of extern_new::A::p
-*/
-void A_p___impl( A recv )
-{
-       printf( "allo from %i\n", *recv );
-}
-
-/*
-C implementation of extern_new::A::d
-
-Imported methods signatures:
-       A A_d( A recv ) for extern_new::A::d
-       A new_A(  ) for extern_new::A::init
-*/
-A A_d___impl( A recv )
-{
-    return new_A();
-}
diff --git a/tests/test_ni_new.nit.h b/tests/test_ni_new.nit.h
deleted file mode 100644 (file)
index c666a98..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_new_IMPL_NIT_H
-#define test_ni_new_IMPL_NIT_H
-
-#define A int*
-
-#include <nit_common.h>
-
-#include <test_ni_new._nitni.h>
-
-A new_A___impl(  );
-A new_A_with_args___impl( bigint x, A a );
-void A_p___impl( A recv );
-A A_d___impl( A recv );
-
-#endif
diff --git a/tests/test_ni_null.nit.c b/tests/test_ni_null.nit.c
deleted file mode 100644 (file)
index 1265225..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_null.nit.h"
-
-/*
-C implementation of test_ni_null::A::is_int_null
-
-Imported methods signatures:
-       int Int_is_null( nullable_Int value ) to check if a nullable Int is a Int
-       bigint bigint_as_not_null( nullable_Int value ) to cast from nullable Int to Int
-*/
-int A_is_int_null___impl( A recv, nullable_Int ni )
-{
-    return Int_is_null( ni );
-}
-
-/*
-C implementation of test_ni_null::A::is_a_null
-
-Imported methods signatures:
-       int A_is_null( nullable_A value ) to check if a nullable A is a A
-       A A_as_not_null( nullable_A value ) to cast from nullable A to A
-*/
-int A_is_a_null___impl( A recv, nullable_A na )
-{
-    return A_is_null( na );
-}
-
-/*
-C implementation of test_ni_null::A::get_nullable_string
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-       nullable_String String_as_nullable( String value ) to cast from String to nullable String
-*/
-nullable_String A_get_nullable_string___impl( A recv, int get_nulled )
-{
-    if ( get_nulled )
-    {
-        return null_String();
-    }
-    else
-    {
-        return String_as_nullable( NativeString_to_s( "something" ) );
-    }
-}
diff --git a/tests/test_ni_null.nit.h b/tests/test_ni_null.nit.h
deleted file mode 100644 (file)
index a5a5d34..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_null_IMPL_NIT_H
-#define test_ni_null_IMPL_NIT_H
-
-#include <test_ni_null._nitni.h>
-
-int A_is_int_null___impl( A recv, nullable_Int ni );
-int A_is_a_null___impl( A recv, nullable_A na );
-nullable_String A_get_nullable_string___impl( A recv, int get_nulled );
-
-#endif
diff --git a/tests/test_ni_operators.nit.c b/tests/test_ni_operators.nit.c
deleted file mode 100644 (file)
index 54e4948..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_operators.nit.h"
-
-/*
-C implementation of test_ni_operators::A::+
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__plus___impl( A recv, A other )
-{
-
-               int s = A_value( recv );
-               int o = A_value( other );
-
-               return new_A( s + o );
-
-}
-
-/*
-C implementation of test_ni_operators::A::-
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__minus___impl( A recv, A other )
-{
-
-               int s = A_value( recv );
-               int o = A_value( other );
-
-               return new_A( s - o );
-
-}
-
-/*
-C implementation of test_ni_operators::A::*
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__star___impl( A recv, bigint by )
-{
-
-               int s = A_value( recv );
-
-               return new_A( s * by );
-
-}
-
-/*
-C implementation of test_ni_operators::A::/
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__slash___impl( A recv, bigint by )
-{
-
-               int s = A_value( recv );
-
-               return new_A( s / by );
-
-}
-
-/*
-C implementation of test_ni_operators::A::(kernel::Object::==)
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       int nullable_Object_is_a_A( nullable_Object value ) to check if a nullable Object is a A
-       A nullable_Object_as_A( nullable_Object value ) to cast from nullable Object to A
-*/
-int A__equal___impl( A recv, nullable_Object other )
-{
-
-               if ( nullable_Object_is_a_A( other ) &&
-                        A_value( nullable_Object_as_A(other) ) == A_value( recv ) )
-                       return 1;
-               else
-                       return 0;
-
-}
-
-/*
-C implementation of test_ni_operators::A::%
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__percent___impl( A recv, A other )
-{
-
-               return new_A( A_value( recv ) % A_value( other ) );
-
-}
-
-/*
-C implementation of test_ni_operators::A::<=>
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__starship___impl( A recv, A other )
-{
-
-               return new_A( A_value( recv )* 1024 );
-
-}
-
-/*
-C implementation of test_ni_operators::A::>
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-*/
-int A__greater___impl( A recv, A other )
-{
-
-               return A_value( recv ) > A_value( other );
-
-}
-
-/*
-C implementation of test_ni_operators::A::<
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-*/
-int A__less___impl( A recv, A other )
-{
-
-               return A_value( recv ) < A_value( other );
-
-}
-
-/*
-C implementation of test_ni_operators::A::>=
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-*/
-int A__ge___impl( A recv, A other )
-{
-
-               return A_value( recv ) >= A_value( other );
-
-}
-
-/*
-C implementation of test_ni_operators::A::<=
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-*/
-int A__less_or_equal___impl( A recv, A other )
-{
-
-               return A_value( recv ) <= A_value( other );
-
-}
-
-/*
-C implementation of test_ni_operators::A::>>
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       void A_value__assign( A recv, bigint value ) for test_ni_operators::A::value=
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-void A__right___impl( A recv, A other )
-{
-
-               int new_val = A_value( recv ) >> A_value( other );
-               A_value__assign( recv, new_val );
-
-}
-
-/*
-C implementation of test_ni_operators::A::<<
-
-Imported methods signatures:
-       bigint A_value( A recv ) for test_ni_operators::A::value
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-void A__left___impl( A recv, A other )
-{
-
-               int new_val = A_value( recv ) << A_value( other );
-               A_value__assign( recv, new_val );
-
-}
-
-/*
-C implementation of test_ni_operators::A::[]
-
-Imported methods signatures:
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__index___impl( A recv, bigint index )
-{
-
-               return new_A( index );
-
-}
-
-/*
-C implementation of test_ni_operators::A::[]=
-
-Imported methods signatures:
-       A new_A( bigint value ) for test_ni_operators::A::init
-*/
-A A__index_assign___impl( A recv, bigint index, A value )
-{
-
-               return new_A( index + A_value( value ) );
-
-}
\ No newline at end of file
diff --git a/tests/test_ni_operators.nit.h b/tests/test_ni_operators.nit.h
deleted file mode 100644 (file)
index 7964db9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_operators_IMPL_NIT_H
-#define test_ni_operators_IMPL_NIT_H
-
-#include <test_ni_operators._nitni.h>
-
-A A__plus___impl( A recv, A other );
-A A__minus___impl( A recv, A other );
-A A__star___impl( A recv, bigint by );
-A A__slash___impl( A recv, bigint by );
-int A__equal___impl( A recv, nullable_Object other );
-A A__percent___impl( A recv, A other );
-A A__starship___impl( A recv, A other );
-int A__greater___impl( A recv, A other );
-int A__less___impl( A recv, A other );
-int A__ge___impl( A recv, A other );
-int A__less_or_equal___impl( A recv, A other );
-void A__right___impl( A recv, A other );
-void A__left___impl( A recv, A other );
-A A__index___impl( A recv, bigint index );
-A A__index_assign___impl( A recv, bigint index, A value );
-
-#endif
diff --git a/tests/test_ni_optimized.nit.c b/tests/test_ni_optimized.nit.c
deleted file mode 100644 (file)
index c951352..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-       Extern implementation of Nit module test_ni_optimized
-*/
-
-#include "test_ni_optimized.nit.h"
-
-/*
-C implementation of test_ni_optimized::A::foo
-*/
-void A_foo___impl( A recv, bigint i, Object o )
-{
-       printf( "%ld\n", i );
-}
-
-/*
-C implementation of test_ni_optimized::Int::bar
-*/
-bigint Int_bar___impl( bigint recv, Object o, nullable_Object u )
-{
-       return recv*2;
-}
diff --git a/tests/test_ni_optimized.nit.h b/tests/test_ni_optimized.nit.h
deleted file mode 100644 (file)
index 79dfea7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-       Extern implementation of Nit module test_ni_optimized
-*/
-
-#ifndef TEST_NI_OPTIMIZED_NIT_H
-#define TEST_NI_OPTIMIZED_NIT_H
-
-#include <test_ni_optimized._nitni.h>
-
-void A_foo___impl( A recv, bigint i, Object o );
-bigint Int_bar___impl( bigint recv, Object o, nullable_Object u );
-
-#endif
diff --git a/tests/test_ni_out.nit.c b/tests/test_ni_out.nit.c
deleted file mode 100644 (file)
index 11c6d1c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_out.nit.h"
-
-/*
-C implementation of simple::A::proc
-*/
-void A_proc___impl( A recv )
-{
-       printf( "proc\n" );
-}
-
-/*
-C implementation of simple::A::function
-*/
-bigint A_function___impl( A recv )
-{
-       return 1;
-}
-
-/*
-C implementation of simple::A::one
-*/
-bigint A_one___impl( A recv, bigint x )
-{
-       return x;
-}
-
-/*
-C implementation of simple::A::two
-*/
-bigint A_two___impl( A recv, bigint x, bigint y )
-{
-       return x + y;
-}
-
-/*
-C implementation of simple::A::three
-*/
-bigint A_three___impl( A recv, bigint x, bigint y, bigint z )
-{
-       return x + y - z;
-}
-
-/*
-C implementation of simple::Object::in_object
-*/
-Object Object_in_object___impl( Object recv, Object o )
-{
-       return o;
-}
diff --git a/tests/test_ni_out.nit.h b/tests/test_ni_out.nit.h
deleted file mode 100644 (file)
index 83924a5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef simple_NIT_H
-#define simple_NIT_H
-
-#include <test_ni_out._nitni.h>
-
-void A_proc___impl( A recv );
-bigint A_function___impl( A recv );
-bigint A_one___impl( A recv, bigint x );
-bigint A_two___impl( A recv, bigint x, bigint y );
-bigint A_three___impl( A recv, bigint x, bigint y, bigint z );
-Object Object_in_object___impl( Object recv, Object o );
-
-#endif
diff --git a/tests/test_ni_pointer.nit.c b/tests/test_ni_pointer.nit.c
deleted file mode 100644 (file)
index 00680a2..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_pointer.nit.h"
-
-/*
-C implementation of test_ni_pointer::A::init
-*/
-A new_A___impl(  )
-{
-       int* v = (int*)malloc( sizeof(int) );
-       (*v) = 123;
-       return (A)v;
-}
-
-/*
-C implementation of test_ni_pointer::A::(string::Object::to_s)
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-String A_to_s___impl( A recv )
-{
-       char* s = calloc( 256, sizeof(char) );
-       sprintf( s, "%d", *((int*)recv) );
-       return NativeString_to_s( s );
-}
diff --git a/tests/test_ni_pointer.nit.h b/tests/test_ni_pointer.nit.h
deleted file mode 100644 (file)
index 2fcf8a7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_pointer_IMPL_NIT_H
-#define test_ni_pointer_IMPL_NIT_H
-
-#define A void*
-
-#include <nit_common.h>
-
-#include <test_ni_pointer._nitni.h>
-
-A new_A___impl(  );
-void A_native_init___impl( A recv );
-String A_to_s___impl( A recv );
-
-#endif
diff --git a/tests/test_ni_primitives.nit.c b/tests/test_ni_primitives.nit.c
deleted file mode 100644 (file)
index 519578f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_primitives.nit.h"
-
-#include <stdlib.h>
-
-/*
-C implementation of test_ni_primitives::Object::opposite
-*/
-int Object_opposite___impl( Object recv, int v )
-{
-       return v == 0;
-}
-
-/*
-C implementation of test_ni_primitives::Object::plus_10
-*/
-char Object_plus_10___impl( Object recv, char v )
-{
-       return v + 10;
-}
-
-/*
-C implementation of test_ni_primitives::Object::plus_1000
-*/
-bigint Object_plus_1000___impl( Object recv, bigint v )
-{
-       return v + 1000;
-}
-
-/*
-C implementation of test_ni_primitives::Object::multiply_by_100
-*/
-float Object_multiply_by_100___impl( Object recv, float v )
-{
-       return v * 100;
-}
-
-/*
-C implementation of test_ni_primitives::Object::print_ns
-*/
-void Object_print_ns___impl( Object recv, char * s )
-{
-       printf( "%s\n", s );
-}
diff --git a/tests/test_ni_primitives.nit.h b/tests/test_ni_primitives.nit.h
deleted file mode 100644 (file)
index 1866e66..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_primitives_IMPL_NIT_H
-#define test_ni_primitives_IMPL_NIT_H
-
-#include <nit_common.h>
-
-#include <test_ni_primitives._nitni.h>
-
-int Object_opposite___impl( Object recv, int v );
-char Object_plus_10___impl( Object recv, char v );
-bigint Object_plus_1000___impl( Object recv, bigint v );
-float Object_multiply_by_100___impl( Object recv, float v );
-void Object_print_ns___impl( Object recv, char * s );
-
-#endif
diff --git a/tests/test_ni_special_all_native.nit.c b/tests/test_ni_special_all_native.nit.c
deleted file mode 100644 (file)
index fa9ca8f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_special_all_native.nit.h"
-
-/*
-C implementation of test_ni_special_all_native::A::work
-*/
-void A_work___impl( A recv )
-{
-       printf( "A\n" );
-}
-
-/*
-C implementation of test_ni_special_all_native::A::call
-
-Imported methods signatures:
-       void A_work( A recv ) for test_ni_special_all_native::A::work
-*/
-void A_call___impl( A recv )
-{
-       A_work( recv );
-}
-
-/*
-C implementation of test_ni_special_all_native::B::(test_ni_special_all_native::A::work)
-*/
-void B_work___impl( B recv )
-{
-       printf( "B\n" );
-}
diff --git a/tests/test_ni_special_all_native.nit.h b/tests/test_ni_special_all_native.nit.h
deleted file mode 100644 (file)
index e33fea0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_special_all_native_IMPL_NIT_H
-#define test_ni_special_all_native_IMPL_NIT_H
-
-#include <nit_common.h>
-
-#include <test_ni_special_all_native._nitni.h>
-
-void A_work___impl( A recv );
-void A_call___impl( A recv );
-void B_work___impl( B recv );
-
-#endif
diff --git a/tests/test_ni_special_from_native.nit.c b/tests/test_ni_special_from_native.nit.c
deleted file mode 100644 (file)
index 90eaf62..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_special_from_native.nit.h"
-
-/*
-C implementation of test_ni_special_from_native::A::exy
-
-Imported methods signatures:
-       void A_nity( A recv ) for test_ni_special_from_native::A::nity
-*/
-void A_exy___impl( A recv )
-{
-       A_nity( recv );
-}
diff --git a/tests/test_ni_special_from_native.nit.h b/tests/test_ni_special_from_native.nit.h
deleted file mode 100644 (file)
index 715956d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_special_from_native_IMPL_NIT_H
-#define test_ni_special_from_native_IMPL_NIT_H
-
-#include <nit_common.h>
-
-#include <test_ni_special_from_native._nitni.h>
-
-void A_exy___impl( A recv );
-
-#endif
diff --git a/tests/test_ni_special_pointer.nit.c b/tests/test_ni_special_pointer.nit.c
deleted file mode 100644 (file)
index f26fc6d..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_special_pointer.nit.h"
-
-/*
-C implementation of test_ni_special_pointer::ExternInt::as_0
-*/
-ExternInt new_ExternInt_as_0___impl(  )
-{
-       ExternInt i0 = (int*)malloc( sizeof(int) );
-       (*i0) = 0;
-       return i0;
-}
-
-/*
-C implementation of test_ni_special_pointer::ExternInt::as_1
-*/
-ExternInt new_ExternInt_as_1___impl(  )
-{
-       ExternInt i0 = (int*)malloc( sizeof(int) );
-       (*i0) = 1;
-       return i0;
-}
-
-/*
-C implementation of test_ni_special_pointer::ExternInt::as_2
-*/
-ExternInt new_ExternInt_as_2___impl(  )
-{
-       ExternInt i0 = (int*)malloc( sizeof(int) );
-       (*i0) = 2;
-       return i0;
-}
-
-/*
-C implementation of test_ni_special_pointer::ExternInt::(string::Object::to_s)
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-String ExternInt_to_s___impl( ExternInt recv )
-{
-       int v = *recv;
-       char *vs = (char*)calloc( 256, sizeof(char) );
-
-       sprintf( vs, "%i", v );
-       return NativeString_to_s( vs );
-}
-
-/*
-C implementation of test_ni_special_pointer::ExternInt::to_i
-*/
-bigint ExternInt_to_i___impl( ExternInt recv )
-{
-       return *recv;
-}
-
-/*
-C implementation of test_ni_special_pointer::Int::to_extern_int
-*/
-ExternInt Int_to_extern_int___impl( bigint recv )
-{
-       ExternInt i = malloc( sizeof(int) );
-       (*i) = recv;
-       return i;
-}
diff --git a/tests/test_ni_special_pointer.nit.h b/tests/test_ni_special_pointer.nit.h
deleted file mode 100644 (file)
index 0ae2b79..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_special_pointer_IMPL_NIT_H
-#define test_ni_special_pointer_IMPL_NIT_H
-
-#define ExternInt int*
-
-#include <nit_common.h>
-
-#include <test_ni_special_pointer._nitni.h>
-
-ExternInt new_ExternInt_as_0___impl(  );
-ExternInt new_ExternInt_as_1___impl(  );
-ExternInt new_ExternInt_as_2___impl(  );
-String ExternInt_to_s___impl( ExternInt recv );
-bigint ExternInt_to_i___impl( ExternInt recv );
-ExternInt Int_to_extern_int___impl( bigint recv );
-
-#endif
diff --git a/tests/test_ni_special_to_native.nit.c b/tests/test_ni_special_to_native.nit.c
deleted file mode 100644 (file)
index ba26947..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_special_to_native.nit.h"
-
-#include <stdlib.h>
-
-/*
-C implementation of test_ni_special_to_native::A::extern_echo
-*/
-void A_extern_echo___impl( A recv )
-{
-       printf( "A from native\n" );
-}
-
-/*
-C implementation of test_ni_special_to_native::B::(test_ni_special_to_native::A::extern_echo)
-*/
-void B_extern_echo___impl( B recv )
-{
-       printf( "B from native\n" );
-}
diff --git a/tests/test_ni_special_to_native.nit.h b/tests/test_ni_special_to_native.nit.h
deleted file mode 100644 (file)
index aeba40c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_special_to_native_IMPL_NIT_H
-#define test_ni_special_to_native_IMPL_NIT_H
-
-#include <nit_common.h>
-
-#include <test_ni_special_to_native._nitni.h>
-
-void A_extern_echo___impl( A recv );
-void B_extern_echo___impl( B recv );
-
-#endif
diff --git a/tests/test_ni_strings.nit.c b/tests/test_ni_strings.nit.c
deleted file mode 100644 (file)
index 2a23e1c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_strings.nit.h"
-
-
-/*
-C implementation of test_ni_strings::A::get_str_from_nstr
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-String A_get_str_from_nstr___impl( A recv, char * nstr )
-{
-       return NativeString_to_s( nstr );
-}
-
-/*
-C implementation of test_ni_strings::A::get_str_from_nstr_with_len
-
-Imported methods signatures:
-       String NativeString_to_s_with_length( char * nat, bigint size ) for string::NativeString::to_s_with_length
-       bigint NativeString_cstring_length( char * recv ) for string::NativeString::cstring_length
-*/
-String A_get_str_from_nstr_with_len___impl( A recv, char * nstr )
-{
-       return NativeString_to_s_with_length( nstr, NativeString_cstring_length( nstr ) );
-}
-
-/*
-C implementation of test_ni_strings::A::get_nstr_from_str
-
-Imported methods signatures:
-       char * String_to_cstring( String recv ) for string::String::to_cstring
-*/
-char * A_get_nstr_from_str___impl( A recv, String str )
-{
-       return String_to_cstring( str );
-}
-
-
-/*
-C implementation of test_ni_strings::A::get_something
-
-Imported methods signatures:
-       String NativeString_to_s( char * str ) for string::NativeString::to_s
-*/
-String A_get_something___impl( A recv )
-{
-       return NativeString_to_s( "something" );
-}
diff --git a/tests/test_ni_strings.nit.h b/tests/test_ni_strings.nit.h
deleted file mode 100644 (file)
index 66b189d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef test_ni_strings_IMPL_NIT_H
-#define test_ni_strings_IMPL_NIT_H
-
-#include <nit_common.h>
-
-#include <test_ni_strings._nitni.h>
-
-String A_get_str_from_nstr___impl( A recv, char * nstr );
-String A_get_str_from_nstr_with_len___impl( A recv, char * nstr );
-char * A_get_nstr_from_str___impl( A recv, String str );
-String A_get_something___impl( A recv );
-
-#endif
diff --git a/tests/test_ni_super.nit.c b/tests/test_ni_super.nit.c
deleted file mode 100644 (file)
index 90a0f37..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include "test_ni_super.nit.h"
-
-/*
-C implementation of super::B::(super::A::id)
-
-Imported methods signatures:
-       void NativeString_to_s( char * str ) for string::NativeString::to_s
-       char * String_to_cstring( String recv ) for string::String::to_cstring
-       String B_id___super( B recv ) to call super
-*/
-String B_id___impl( B recv )
-{
-       char *new_name;
-       char *prefix = "B special ";
-       char *super_name = String_to_cstring( B_id___super( recv ) );
-
-       new_name = calloc( strlen( prefix )+strlen( super_name )+1, sizeof(char) );
-       strcpy( new_name, prefix );
-       strcpy( new_name+strlen( prefix ), super_name );
-       new_name[ strlen( prefix )+strlen( super_name ) ] = '\0';
-
-       return NativeString_to_s( new_name );
-}
diff --git a/tests/test_ni_super.nit.h b/tests/test_ni_super.nit.h
deleted file mode 100644 (file)
index 441cced..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
- *
- * This file is free software, which comes along with NIT.  This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
- * PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You  are  allowed  to  redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#ifndef super_NIT_H
-#define super_NIT_H
-
-#include <test_ni_super._nitni.h>
-
-String B_id___impl( B recv );
-
-#endif
index 246ad6c..b45891f 100755 (executable)
@@ -15,4 +15,5 @@ done
        ../lib/*.nit $list \
        ../src/nit*.nit \
        ../src/test_*.nit \
-       ../contrib/sort_downloads/src/sort_downloads.nit
+       ../contrib/sort_downloads/src/sort_downloads.nit \
+       ../contrib/pep8analysis/src/pep8analysis.nit