projects
/
org.ibex.core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8875041
)
2003/06/16 08:55:37
author
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:01:20 +0000
(07:01 +0000)
committer
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:01:20 +0000
(07:01 +0000)
darcs-hash:
20040130070120
-2ba56-
4f626d19b1481a2b43c46a6c3fec5d0318af9eb6
.gz
src/org/xwt/js/CompiledFunctionImpl.java
patch
|
blob
|
history
src/org/xwt/js/JS.java
patch
|
blob
|
history
src/org/xwt/js/Parser.java
patch
|
blob
|
history
src/org/xwt/util/Log.java
patch
|
blob
|
history
diff --git
a/src/org/xwt/js/CompiledFunctionImpl.java
b/src/org/xwt/js/CompiledFunctionImpl.java
index
416cd94
..
9d61a0f
100644
(file)
--- a/
src/org/xwt/js/CompiledFunctionImpl.java
+++ b/
src/org/xwt/js/CompiledFunctionImpl.java
@@
-17,6
+17,9
@@
class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
/** the line numbers */
private int[] line = new int[10];
/** the line numbers */
private int[] line = new int[10];
+ /** the first line of this script */
+ private int firstLine = -1;
+
/** the instructions */
private int[] op = new int[10];
/** the instructions */
private int[] op = new int[10];
@@
-45,16
+48,12
@@
class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
this.parentScope = parentScope;
if (sourceCode == null) return;
Parser p = new Parser(sourceCode, sourceName, firstLine);
this.parentScope = parentScope;
if (sourceCode == null) return;
Parser p = new Parser(sourceCode, sourceName, firstLine);
- try {
- while(true) {
- int s = size();
- p.parseStatement(this, null);
- if (s == size()) break;
- }
- add(-1, Tokens.RETURN);
- } catch (Exception e) {
- if (Log.on) Log.log(Parser.class, e);
+ while(true) {
+ int s = size();
+ p.parseStatement(this, null);
+ if (s == size()) break;
}
}
+ add(-1, Tokens.RETURN);
}
public Object call(JS.Array args) throws JS.Exn { return call(args, new FunctionScope(sourceName, parentScope)); }
}
public Object call(JS.Array args) throws JS.Exn { return call(args, new FunctionScope(sourceName, parentScope)); }
@@
-105,7
+104,7
@@
class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
final Vec t = cx.stack;
OUTER: for(pc=0; pc<size; pc++) {
String label = null;
final Vec t = cx.stack;
OUTER: for(pc=0; pc<size; pc++) {
String label = null;
- cx.line = line[op];
+ cx.line = line[pc];
switch(op[pc]) {
case LITERAL: t.push(arg[pc]); break;
case OBJECT: t.push(new JS.Obj()); break;
switch(op[pc]) {
case LITERAL: t.push(arg[pc]); break;
case OBJECT: t.push(new JS.Obj()); break;
diff --git
a/src/org/xwt/js/JS.java
b/src/org/xwt/js/JS.java
index
24f133a
..
1e246b1
100644
(file)
--- a/
src/org/xwt/js/JS.java
+++ b/
src/org/xwt/js/JS.java
@@
-124,7
+124,7
@@
public abstract class JS {
CompiledFunction currentCompiledFunction = null;
Vec stack = new Vec();
CompiledFunction currentCompiledFunction = null;
Vec stack = new Vec();
- private int line = -1;
+ int line = -1;
/** binds this thread to the current Java Thread */
public void bindToCurrentJavaThread() { javaThreadToJSThread.put(java.lang.Thread.currentThread(), this); }
/** binds this thread to the current Java Thread */
public void bindToCurrentJavaThread() { javaThreadToJSThread.put(java.lang.Thread.currentThread(), this); }
diff --git
a/src/org/xwt/js/Parser.java
b/src/org/xwt/js/Parser.java
index
cd5dfc2
..
c3f90ca
100644
(file)
--- a/
src/org/xwt/js/Parser.java
+++ b/
src/org/xwt/js/Parser.java
@@
-496,7
+496,7
@@
class Parser extends Lexer implements ByteCodes {
consume(COMMA);
}
b.add(parserLine, POP); // pop off the topscope
consume(COMMA);
}
b.add(parserLine, POP); // pop off the topscope
- if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1) consume(SEMI);
+ if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1 && mostRecentlyReadToken != SEMI) consume(SEMI);
break;
}
case IF: {
break;
}
case IF: {
@@
-708,7
+708,7
@@
class Parser extends Lexer implements ByteCodes {
pushBackToken(NAME, possiblyTheLabel);
startExpr(b, -1);
b.add(parserLine, POP);
pushBackToken(NAME, possiblyTheLabel);
startExpr(b, -1);
b.add(parserLine, POP);
- if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1) consume(SEMI);
+ if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1 && mostRecentlyReadToken != SEMI) consume(SEMI);
break;
}
}
break;
}
}
@@
-727,7
+727,7
@@
class Parser extends Lexer implements ByteCodes {
pushBackToken();
startExpr(b, -1);
b.add(parserLine, POP);
pushBackToken();
startExpr(b, -1);
b.add(parserLine, POP);
- if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1) consume(SEMI);
+ if ((mostRecentlyReadToken != RC || peekToken() == SEMI) && peekToken() != -1 && mostRecentlyReadToken != SEMI) consume(SEMI);
break;
}
}
break;
}
}
diff --git
a/src/org/xwt/util/Log.java
b/src/org/xwt/util/Log.java
index
a367004
..
3a54c4d
100644
(file)
--- a/
src/org/xwt/util/Log.java
+++ b/
src/org/xwt/util/Log.java
@@
-22,7
+22,7
@@
public class Log {
if (current == null) {
log("<none>", message);
} else {
if (current == null) {
log("<none>", message);
} else {
- log(current.getSourceName() + current.getLine(), message);
+ log(current.getSourceName() + ":" + current.getLine(), message);
}
}
}
}