X-Git-Url: http://nitlanguage.org diff --git a/contrib/pep8analysis/src/pep8analysis_web.nit b/contrib/pep8analysis/src/pep8analysis_web.nit index 259fd09..e9a81d8 100644 --- a/contrib/pep8analysis/src/pep8analysis_web.nit +++ b/contrib/pep8analysis/src/pep8analysis_web.nit @@ -20,8 +20,8 @@ # analysis results. The result graph will be sent to the JavaScript function # `show_graph` with the source of the graph in Graphviz's dot. module pep8analysis_web is - cpp_compiler_option("--std=c++11 --bind") - c_linker_option("--bind") + cppflags "--std=c++11 --bind" + ldflags "--bind" end import emscripten @@ -31,7 +31,7 @@ import ast import model import cfg import flow_analysis -intrude import standard::stream +intrude import core::stream import cpp in "C++" `{ @@ -40,17 +40,17 @@ in "C++" `{ using namespace emscripten; EMSCRIPTEN_BINDINGS(my_module) { - function("run_analysis", &NativeString_run_analysis, allow_raw_pointers()); + function("run_analysis", &CString_run_analysis, allow_raw_pointers()); } `} redef class AnalysisManager - fun run(src: String) + fun run_web(src: String) do sys.suggest_garbage_collection - var stream = new StringIStream(src) + var stream = new StringReader(src) var ast = build_ast("web", stream) if ast == null then return @@ -95,7 +95,7 @@ redef class AnalysisManager print_notes if notes.is_empty then print "Success: Nothing wrong detected" - var of = new StringOStream + var of = new StringWriter cfg.print_dot(of, false) of.close show_graph(of.to_s) @@ -108,20 +108,11 @@ redef class AnalysisManager fun show_graph(content: String) do "show_graph('{content.escape_to_c}');".run_js end -class StringIStream - super BufferedIStream - - init(str: String) do _buffer = new FlatBuffer.from(str) - - redef fun fill_buffer do end_reached = true - redef var end_reached: Bool = false -end - -redef class NativeString - fun run_analysis do manager.run to_s +redef class CString + fun run_analysis do manager.run_web to_s end -fun dummy_set_callbacks import NativeString.run_analysis in "C++" `{ +fun dummy_set_callbacks import CString.run_analysis in "C++" `{ `} dummy_set_callbacks