diff --git a/bitshift/parser/__init__.py b/bitshift/parser/__init__.py index 675d8bb..bf86945 100644 --- a/bitshift/parser/__init__.py +++ b/bitshift/parser/__init__.py @@ -129,6 +129,7 @@ def parse(codelet): lang = _lang(codelet) lang_string = LANGS[lang] codelet.language = lang + if lang_string in PARSERS: symbols = PARSERS[lang_string](codelet) symbols = { @@ -138,3 +139,6 @@ def parse(codelet): for name in syms] for key, syms in symbols.iteritems()} codelet.symbols = symbols + + else: + codelet.symbols = {} diff --git a/parsers/java/src/main/java/com/bitshift/parsing/parsers/JavaParser.java b/parsers/java/src/main/java/com/bitshift/parsing/parsers/JavaParser.java index 989c0dd..75362a8 100644 --- a/parsers/java/src/main/java/com/bitshift/parsing/parsers/JavaParser.java +++ b/parsers/java/src/main/java/com/bitshift/parsing/parsers/JavaParser.java @@ -80,8 +80,6 @@ public class JavaParser extends Parser { int sl = this.root.getLineNumber(node.getStartPosition()); int sc = this.root.getColumnNumber(node.getStartPosition()); - Integer el = -1; - Integer ec = -1; if (statements.size() > 0) { Statement last = statements.get(statements.size() - 1); @@ -89,7 +87,7 @@ public class JavaParser extends Parser { ec = this.root.getColumnNumber(last.getStartPosition()); } - data.put("coord", Symbols.createCoord(sl, sc, el, ec)); + data.put("coord", Symbols.createCoord(sl, sc, sl, sc)); data.put("name", name); this._cache.push(data); return true; @@ -110,7 +108,7 @@ public class JavaParser extends Parser { int sl = this.root.getLineNumber(node.getStartPosition()); int sc = this.root.getColumnNumber(node.getStartPosition()); - data.put("coord", Symbols.createCoord(sl, sc, -1, -1)); + data.put("coord", Symbols.createCoord(sl, sc, sl, sc)); data.put("name", name); this._cache.push(data); return true; @@ -140,7 +138,7 @@ public class JavaParser extends Parser { int sl = this.root.getLineNumber(node.getStartPosition()); int sc = this.root.getColumnNumber(node.getStartPosition()); - data.put("coord", Symbols.createCoord(sl, sc, -1, -1)); + data.put("coord", Symbols.createCoord(sl, sc, sl, sc)); this._cache.push(data); return true; } @@ -161,7 +159,7 @@ public class JavaParser extends Parser { int sl = this.root.getLineNumber(node.getStartPosition()); int sc = this.root.getColumnNumber(node.getStartPosition()); - data.put("coord", Symbols.createCoord(sl, sc, -1, -1)); + data.put("coord", Symbols.createCoord(sl, sc, sl, sc)); this._cache.push(data); return true; } diff --git a/parsers/ruby/lib/parser.rb b/parsers/ruby/lib/parser.rb index eec293b..e4ff4eb 100644 --- a/parsers/ruby/lib/parser.rb +++ b/parsers/ruby/lib/parser.rb @@ -51,7 +51,7 @@ module Bitshift break if cur_exp == nil end - pos = [start_ln, -1, end_ln, -1] + pos = [start_ln, 1, end_ln, 1] return pos end @@ -59,7 +59,7 @@ module Bitshift pos = Hash.new end_ln = start_ln = exp.line - offset - pos = [start_ln, -1, end_ln, -1] + pos = [start_ln, 1, end_ln, 1] return pos end