|
From: <jom...@us...> - 2008-10-05 16:38:46
|
Revision: 1392
http://jason.svn.sourceforge.net/jason/?rev=1392&view=rev
Author: jomifred
Date: 2008-10-05 16:34:24 +0000 (Sun, 05 Oct 2008)
Log Message:
-----------
SourceInfo is a "delegated" object of terms and not a super class.
Modified Paths:
--------------
trunk/build.xml
trunk/src/jason/asSemantics/TransitionSystem.java
trunk/src/jason/asSyntax/ArithExpr.java
trunk/src/jason/asSyntax/Atom.java
trunk/src/jason/asSyntax/BinaryStructure.java
trunk/src/jason/asSyntax/DefaultTerm.java
trunk/src/jason/asSyntax/InternalActionLiteral.java
trunk/src/jason/asSyntax/NumberTermImpl.java
trunk/src/jason/asSyntax/Plan.java
trunk/src/jason/asSyntax/PlanBodyImpl.java
trunk/src/jason/asSyntax/SourceInfo.java
trunk/src/jason/asSyntax/StringTermImpl.java
trunk/src/jason/asSyntax/Term.java
trunk/src/jason/asSyntax/VarTerm.java
trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc
trunk/src/jason/asSyntax/parser/as2j.java
trunk/src/jason/asSyntax/patterns/goal/OMC.java
trunk/src/jason/jeditplugin/AgentSpeakSideKickParser.java
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/build.xml 2008-10-05 16:34:24 UTC (rev 1392)
@@ -378,7 +378,7 @@
<fileset defaultexcludes="no" dir="${basedir}" includes="**/*~" />
<fileset dir="${basedir}" includes="**/*.class" excludes="applications/**/*"/>
<fileset dir="${basedir}" includes="**/core" />
- <fileset dir="${basedir}/doc/api" includes="**/*" />
+ <!-- fileset dir="${basedir}/doc/api" includes="**/*" /-->
<fileset dir="${basedir}" includes="**/.nbattrs" />
<fileset dir="${basedir}" includes="**/*.backup" />
<fileset dir="${basedir}" includes="bin/*.old" />
Modified: trunk/src/jason/asSemantics/TransitionSystem.java
===================================================================
--- trunk/src/jason/asSemantics/TransitionSystem.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSemantics/TransitionSystem.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -476,7 +476,7 @@
im.unif = iu.next();
updateIntention();
} else {
- String msg = "Constraint "+h+" was not satisfied ("+h.getErrorMsg()+").";
+ String msg = "Constraint "+h+" was not satisfied ("+h.getSrcInfo().getErrorMsg()+").";
generateGoalDeletion(JasonException.createBasicErrorAnnots(new Atom("constraint_failed"), msg));
logger.fine(msg);
}
@@ -531,7 +531,7 @@
}
}
if (fail) {
- if (logger.isLoggable(Level.FINE)) logger.fine("Test '"+h+"' failed ("+h.getErrorMsg()+").");
+ if (logger.isLoggable(Level.FINE)) logger.fine("Test '"+h+"' failed ("+h.getSrcInfo().getErrorMsg()+").");
generateGoalDeletion();
}
}
@@ -881,7 +881,7 @@
Term codeline = null;
if (body != null && body instanceof Literal) {
bodyterm = (Literal)body;
- codesrc = new StringTermImpl(bodyterm.getSrc());
+ codesrc = new StringTermImpl(bodyterm.getSrcFile());
codeline = new NumberTermImpl(bodyterm.getSrcLine());
} else {
bodyterm = new Atom("no_code");
@@ -890,17 +890,17 @@
}
// code
- Structure code = new Structure("code");
+ Structure code = new Structure("code", 1);
code.addTerm(bodyterm);
failAnnots.add(code);
// ASL source
- Structure src = new Structure("code_src");
+ Structure src = new Structure("code_src", 1);
src.addTerm(codesrc);
failAnnots.add(src);
// line in the source
- Structure line = new Structure("code_line");
+ Structure line = new Structure("code_line", 1);
line.addTerm(codeline);
failAnnots.add(line);
failEvent.getTrigger().getLiteral().addAnnots(failAnnots);
Modified: trunk/src/jason/asSyntax/ArithExpr.java
===================================================================
--- trunk/src/jason/asSyntax/ArithExpr.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/ArithExpr.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -126,15 +126,17 @@
super(oper.toString(),2);
addTerms(t1, t2);
op = oper;
- if (t1 instanceof SourceInfo) setSrc((SourceInfo)t1);
- else if (t2 instanceof SourceInfo) setSrc((SourceInfo)t2);
+ if (t1.getSrcInfo() != null)
+ srcInfo = t1.getSrcInfo();
+ else
+ srcInfo = t2.getSrcInfo();
}
public ArithExpr(ArithmeticOp oper, NumberTerm t1) {
super(oper.toString(),1);
addTerm(t1);
op = oper;
- setSrc(t1);
+ srcInfo = t1.getSrcInfo();
}
private ArithExpr(ArithExpr ae) { // for clone
Modified: trunk/src/jason/asSyntax/Atom.java
===================================================================
--- trunk/src/jason/asSyntax/Atom.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/Atom.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -49,7 +49,7 @@
this.functor = l.getFunctor();
predicateIndicatorCache = l.predicateIndicatorCache;
hashCodeCache = l.hashCodeCache;
- setSrc(l);
+ srcInfo = l.srcInfo;
}
public String getFunctor() {
Modified: trunk/src/jason/asSyntax/BinaryStructure.java
===================================================================
--- trunk/src/jason/asSyntax/BinaryStructure.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/BinaryStructure.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -40,15 +40,17 @@
public BinaryStructure(Term t1, String id, Term t2) {
super(id,2);
addTerms( t1, t2 );
- if (t1 instanceof SourceInfo) setSrc((SourceInfo)t1);
- else if (t2 instanceof SourceInfo) setSrc((SourceInfo)t2);
+ if (t1.getSrcInfo() != null)
+ srcInfo = t1.getSrcInfo();
+ else
+ srcInfo = t2.getSrcInfo();
}
/** Constructor for unary operator */
public BinaryStructure(String id, Term arg) {
super(id,1);
addTerm( arg );
- setSrc(arg);
+ srcInfo = arg.getSrcInfo();
}
public boolean isUnary() {
Modified: trunk/src/jason/asSyntax/DefaultTerm.java
===================================================================
--- trunk/src/jason/asSyntax/DefaultTerm.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/DefaultTerm.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -35,14 +35,20 @@
/**
* Base class for all terms.
*
- * (this class may be renamed to AbstractTerm infuture releases of Jason)
+ * (this class may be renamed to AbstractTerm in future releases of Jason, so
+ * avoid using it -- use ASSyntax class to create new terms)
+ *
+ * @navassoc - source - SourceInfo
+ *
+ * @see ASSyntax
*/
-public abstract class DefaultTerm extends SourceInfo implements Term, Serializable {
+public abstract class DefaultTerm implements Term, Serializable {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(Term.class.getName());
- protected Integer hashCodeCache = null;
+ protected Integer hashCodeCache = null;
+ protected SourceInfo srcInfo = null;
/** @deprecated it is preferable to use ASSyntax.parseTerm */
public static Term parse(String sTerm) {
@@ -93,4 +99,33 @@
public boolean apply(Unifier u) {
return false;
}
+
+ public SourceInfo getSrcInfo() {
+ return srcInfo;
+ }
+
+ public void setSrcInfo(SourceInfo s) {
+ srcInfo = s;
+ }
+
+ public String getSrcFile() {
+ if (srcInfo == null)
+ return null;
+ else
+ return srcInfo.getSrcFile();
+ }
+
+ public int getSrcLine() {
+ if (srcInfo == null)
+ return 0;
+ else
+ return srcInfo.getSrcLine();
+ }
+
+ public String getErrorMsg() {
+ if (srcInfo == null)
+ return "";
+ else
+ return srcInfo.getErrorMsg();
+ }
}
Modified: trunk/src/jason/asSyntax/InternalActionLiteral.java
===================================================================
--- trunk/src/jason/asSyntax/InternalActionLiteral.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/InternalActionLiteral.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -143,7 +143,7 @@
@Override
public String getErrorMsg() {
String line = (getSrcLine() >= 0 ? ":"+getSrcLine() : "");
- return "Error in internal action '"+this+"' ("+ getSrc() + line + ")";
+ return "Error in internal action '"+this+"' ("+ getSrcFile() + line + ")";
}
public InternalActionLiteral clone() {
Modified: trunk/src/jason/asSyntax/NumberTermImpl.java
===================================================================
--- trunk/src/jason/asSyntax/NumberTermImpl.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/NumberTermImpl.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -57,7 +57,8 @@
}
public NumberTermImpl(NumberTermImpl t) {
- value = t.solve();
+ value = t.solve();
+ srcInfo = t.srcInfo;
}
public double solve() {
Modified: trunk/src/jason/asSyntax/Plan.java
===================================================================
--- trunk/src/jason/asSyntax/Plan.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/Plan.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -44,10 +44,10 @@
@navassoc - event - Trigger
@navassoc - context - LogicalFormula
@navassoc - body - PlanBody
+ @navassoc - source - SourceInfo
-
*/
-public class Plan extends SourceInfo implements Cloneable, Serializable {
+public class Plan implements Cloneable, Serializable {
private static final long serialVersionUID = 1L;
private static final Term TAtomic = ASSyntax.createAtom("atomic");
@@ -61,6 +61,7 @@
private LogicalFormula context;
private PlanBody body;
+ protected SourceInfo srcInfo = null;
private boolean isAtomic = false;
private boolean isAllUnifs = false;
@@ -211,7 +212,7 @@
p.body = (PlanBody)body.clone();
- p.setSrc(this);
+ p.setSrcInfo(srcInfo);
return p;
}
@@ -230,11 +231,20 @@
p.context = context;
p.body = body.clonePB();
- p.setSrc(this);
+ p.setSrcInfo(srcInfo);
return p;
}
+
+ public SourceInfo getSrcInfo() {
+ return srcInfo;
+ }
+
+ public void setSrcInfo(SourceInfo s) {
+ srcInfo = s;
+ }
+
public String toString() {
return toASString();
}
Modified: trunk/src/jason/asSyntax/PlanBodyImpl.java
===================================================================
--- trunk/src/jason/asSyntax/PlanBodyImpl.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/PlanBodyImpl.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -40,7 +40,7 @@
super(BODY_PLAN_FUNCTOR, 0);
term = b;
formType = t;
- setSrc(b);
+ setSrcInfo(b.getSrcInfo());
}
public void setBodyNext(PlanBody next) {
Modified: trunk/src/jason/asSyntax/SourceInfo.java
===================================================================
--- trunk/src/jason/asSyntax/SourceInfo.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/SourceInfo.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -1,65 +1,56 @@
package jason.asSyntax;
/**
- * Store information about the file source of some data.
+ * Store information about the file source of some term (atom, literal, etc).
+ * (immutable objects)
*/
public class SourceInfo {
- private String source = null;
- private int beginSrcLine = -1; // the line this literal appears in the source
- private int endSrcLine = -1;
+ private final String source;
+ private final int beginSrcLine; // the line this literal appears in the source
+ private final int endSrcLine;
- public SourceInfo() {
+ public SourceInfo(String file, int beginLine) {
+ source = file;
+ beginSrcLine = beginLine;
+ endSrcLine = beginLine;
}
-
- public SourceInfo(SourceInfo o) {
- setSrc(o);
+ public SourceInfo(String file, int beginLine, int endLine) {
+ source = file;
+ beginSrcLine = beginLine;
+ endSrcLine = endLine;
}
-
- public void setSrc(SourceInfo o) {
+ public SourceInfo(SourceInfo o) {
source = o.source;
beginSrcLine = o.beginSrcLine;
endSrcLine = o.endSrcLine;
}
- public void setSrc(Object o) {
- if (o instanceof SourceInfo)
- setSrc((SourceInfo)o);
+ public SourceInfo(DefaultTerm o) {
+ this(o.getSrcInfo());
}
-
- public void setSrc(String asSource) {
- source = asSource;
+
+ public SourceInfo clone() {
+ return this;
}
- public String getSrc() {
+
+ public String getSrcFile() {
return source;
}
- public void setSrcLine(int i) {
- beginSrcLine = i;
- }
public int getSrcLine() {
return beginSrcLine;
}
- public void setSrcLines(int b, int e) {
- beginSrcLine = b;
- endSrcLine = e;
- }
-
- public void setBeginSrcLine(int i) {
- beginSrcLine = i;
- }
public int getBeginSrcLine() {
return beginSrcLine;
}
- public void setEndSrcLine(int i) {
- endSrcLine = i;
- }
public int getEndSrcLine() {
return endSrcLine;
}
public String getErrorMsg() {
- return getSrc() + (getSrcLine() >= 0 ? ":"+getSrcLine() : "");
+ return (source == null ? "nofile" : source)
+ + (beginSrcLine >= 0 ? ":"+beginSrcLine : "");
}
}
Modified: trunk/src/jason/asSyntax/StringTermImpl.java
===================================================================
--- trunk/src/jason/asSyntax/StringTermImpl.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/StringTermImpl.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -54,7 +54,8 @@
}
public StringTermImpl(StringTermImpl t) {
- value = t.getString();
+ value = t.getString();
+ srcInfo = t.srcInfo;
}
public String getString() {
Modified: trunk/src/jason/asSyntax/Term.java
===================================================================
--- trunk/src/jason/asSyntax/Term.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/Term.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -8,6 +8,8 @@
/**
* Common interface for all kind of terms
+ *
+ * @opt nodefillcolor lightgoldenrodyellow
*/
public interface Term extends Cloneable, Comparable<Term>, Serializable, ToDOM {
@@ -37,10 +39,7 @@
public boolean apply(Unifier u);
/** Removes the value cached for hashCode */
- public void resetHashCodeCache();
+ //public void resetHashCodeCache();
- public int getSrcLine();
- public String getSrc();
- public String getErrorMsg(); // info for error messages
-
+ public SourceInfo getSrcInfo();
}
Modified: trunk/src/jason/asSyntax/VarTerm.java
===================================================================
--- trunk/src/jason/asSyntax/VarTerm.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/VarTerm.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -82,7 +82,7 @@
} else {
// do not call constructor with term parameter!
VarTerm t = new VarTerm(super.getFunctor());
- t.setSrc(this);
+ t.srcInfo = this.srcInfo;
if (hasAnnot())
t.setAnnots(getAnnots().cloneLT());
return t;
Modified: trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc
===================================================================
--- trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2008-10-05 16:34:24 UTC (rev 1392)
@@ -58,14 +58,23 @@
public void setAg(Agent ag) { curAg = ag; }
- private String getSourceRef(Object o) {
- if (o instanceof SourceInfo) {
- SourceInfo s = (SourceInfo)o;
- return "["+s.getSrc()+":"+s.getBeginSrcLine()+"]";
- } else {
- return "";
- }
+ private String getSourceRef(SourceInfo s) {
+ if (s == null)
+ return "[]";
+ else
+ return "["+s.getSrcFile()+":"+s.getBeginSrcLine()+"]";
}
+ private String getSourceRef(DefaultTerm t) {
+ return getSourceRef( ((DefaultTerm)t).getSrcInfo());
+ }
+ private String getSourceRef(Object t) {
+ if (t instanceof DefaultTerm)
+ return getSourceRef((DefaultTerm)t);
+ else if (t instanceof SourceInfo)
+ return getSourceRef((SourceInfo)t);
+ else
+ return "[]";
+ }
private InternalActionLiteral checkInternalActionsInContext(LogicalFormula f, Agent ag) throws Exception {
if (f != null) {
@@ -99,7 +108,7 @@
private Term changeToAtom(Object o) {
Term u = (Term)o;
if (u.isAtom()) {
- return new Atom( (Literal)u);
+ return new Atom((Literal)u);
} else {
return u;
}
@@ -192,7 +201,7 @@
if (config.getBoolean(Config.WARN_SING_VAR) && !parsedFiles.contains(asSource)) {
List<VarTerm> singletonVars = p.getSingletonVars();
if (singletonVars.size() > 0) {
- logger.warning(getSourceRef(p)+" warning: the plan for event '"+p.getTrigger()+"' has the following singleton variables: "+singletonVars);
+ logger.warning(getSourceRef(p.getSrcInfo())+" warning: the plan for event '"+p.getTrigger()+"' has the following singleton variables: "+singletonVars);
}
}
}
@@ -305,8 +314,7 @@
if (B != null && B.getBodyTerm().equals(Literal.LTrue))
B = (PlanBody)B.getBodyNext();
Plan p = new Plan(L,T,(LogicalFormula)C, B);
- p.setSrcLines(start,end);
- p.setSrc(asSource);
+ p.setSrcInfo(new SourceInfo(asSource,start,end));
return p;
}
}
@@ -434,8 +442,7 @@
|
K=<TK_END>
) { p = new Pred(K.image);
- p.setSrcLine(K.beginLine);
- p.setSrc(asSource);
+ p.setSrcInfo(new SourceInfo(asSource, K.beginLine));
}
[
@@ -477,7 +484,7 @@
{
"["
[
- f=term_in_list() { last = lt.append(f); lt.setSrcLine(f.getSrcLine()); lt.setSrc(f.getSrc());}
+ f=term_in_list() { last = lt.append(f); lt.setSrcInfo(f.getSrcInfo()); }
( "," f=term_in_list() { last = last.append(f); }
)*
[ "|" ( K=<VAR> { last.setNext(new VarTerm(K.image)); }
@@ -631,8 +638,7 @@
{ Token K; Object t; VarTerm v; }
{
( K = <NUMBER> { NumberTermImpl ni = new NumberTermImpl(K.image);
- ni.setSrcLine(K.beginLine);
- ni.setSrc(asSource);
+ ni.setSrcInfo(new SourceInfo(asSource, K.beginLine));
return ni;
}
| "-" t = arithm_expr_simple() { if (!(t instanceof NumberTerm)) {
@@ -654,7 +660,7 @@
return l;
} else {
ArithFunctionTerm at = new ArithFunctionTerm(af);
- at.setSrc(l);
+ at.setSrcInfo(l.getSrcInfo());
at.setTerms(l.getTerms());
at.setAgent(curAg);
return at;
@@ -665,7 +671,7 @@
VarTerm var(): { Token K; VarTerm v; ListTerm lt; }
{
- ( K = <VAR> { v = new VarTerm(K.image); v.setSrcLine(K.beginLine); v.setSrc(asSource);}
+ ( K = <VAR> { v = new VarTerm(K.image); v.setSrcInfo(new SourceInfo(asSource, K.beginLine));}
| K = <UNNAMEDVAR> { v = new UnnamedVar(K.image); }
)
[
@@ -677,8 +683,7 @@
StringTerm string():{ Token k; StringTermImpl s; }
{
k = <STRING> { s = new StringTermImpl(k.image.substring(1,k.image.length()-1));
- s.setSrcLine(k.beginLine);
- s.setSrc(asSource);
+ s.setSrcInfo(new SourceInfo(asSource,k.beginLine));
return s;
}
}
Modified: trunk/src/jason/asSyntax/parser/as2j.java
===================================================================
--- trunk/src/jason/asSyntax/parser/as2j.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/parser/as2j.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -28,14 +28,23 @@
public void setAg(Agent ag) { curAg = ag; }
- private String getSourceRef(Object o) {
- if (o instanceof SourceInfo) {
- SourceInfo s = (SourceInfo)o;
- return "["+s.getSrc()+":"+s.getBeginSrcLine()+"]";
- } else {
- return "";
- }
+ private String getSourceRef(SourceInfo s) {
+ if (s == null)
+ return "[]";
+ else
+ return "["+s.getSrcFile()+":"+s.getBeginSrcLine()+"]";
}
+ private String getSourceRef(DefaultTerm t) {
+ return getSourceRef( ((DefaultTerm)t).getSrcInfo());
+ }
+ private String getSourceRef(Object t) {
+ if (t instanceof DefaultTerm)
+ return getSourceRef((DefaultTerm)t);
+ else if (t instanceof SourceInfo)
+ return getSourceRef((SourceInfo)t);
+ else
+ return "[]";
+ }
private InternalActionLiteral checkInternalActionsInContext(LogicalFormula f, Agent ag) throws Exception {
if (f != null) {
@@ -69,7 +78,7 @@
private Term changeToAtom(Object o) {
Term u = (Term)o;
if (u.isAtom()) {
- return new Atom( (Literal)u);
+ return new Atom((Literal)u);
} else {
return u;
}
@@ -178,7 +187,7 @@
if (config.getBoolean(Config.WARN_SING_VAR) && !parsedFiles.contains(asSource)) {
List<VarTerm> singletonVars = p.getSingletonVars();
if (singletonVars.size() > 0) {
- logger.warning(getSourceRef(p)+" warning: the plan for event '"+p.getTrigger()+"' has the following singleton variables: "+singletonVars);
+ logger.warning(getSourceRef(p.getSrcInfo())+" warning: the plan for event '"+p.getTrigger()+"' has the following singleton variables: "+singletonVars);
}
}
}
@@ -359,8 +368,7 @@
if (B != null && B.getBodyTerm().equals(Literal.LTrue))
B = (PlanBody)B.getBodyNext();
Plan p = new Plan(L,T,(LogicalFormula)C, B);
- p.setSrcLines(start,end);
- p.setSrc(asSource);
+ p.setSrcInfo(new SourceInfo(asSource,start,end));
{if (true) return p;}
throw new Error("Missing return statement in function");
}
@@ -598,8 +606,7 @@
throw new ParseException();
}
p = new Pred(K.image);
- p.setSrcLine(K.beginLine);
- p.setSrc(asSource);
+ p.setSrcInfo(new SourceInfo(asSource, K.beginLine));
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 39:
jj_consume_token(39);
@@ -712,7 +719,7 @@
case 39:
case 42:
f = term_in_list();
- last = lt.append(f); lt.setSrcLine(f.getSrcLine()); lt.setSrc(f.getSrc());
+ last = lt.append(f); lt.setSrcInfo(f.getSrcInfo());
label_11:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1101,8 +1108,7 @@
case NUMBER:
K = jj_consume_token(NUMBER);
NumberTermImpl ni = new NumberTermImpl(K.image);
- ni.setSrcLine(K.beginLine);
- ni.setSrc(asSource);
+ ni.setSrcInfo(new SourceInfo(asSource, K.beginLine));
{if (true) return ni;}
break;
case 35:
@@ -1149,7 +1155,7 @@
{if (true) return l;}
} else {
ArithFunctionTerm at = new ArithFunctionTerm(af);
- at.setSrc(l);
+ at.setSrcInfo(l.getSrcInfo());
at.setTerms(l.getTerms());
at.setAgent(curAg);
{if (true) return at;}
@@ -1162,7 +1168,7 @@
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VAR:
K = jj_consume_token(VAR);
- v = new VarTerm(K.image); v.setSrcLine(K.beginLine); v.setSrc(asSource);
+ v = new VarTerm(K.image); v.setSrcInfo(new SourceInfo(asSource, K.beginLine));
break;
case UNNAMEDVAR:
K = jj_consume_token(UNNAMEDVAR);
@@ -1190,8 +1196,7 @@
Token k; StringTermImpl s;
k = jj_consume_token(STRING);
s = new StringTermImpl(k.image.substring(1,k.image.length()-1));
- s.setSrcLine(k.beginLine);
- s.setSrc(asSource);
+ s.setSrcInfo(new SourceInfo(asSource,k.beginLine));
{if (true) return s;}
throw new Error("Missing return statement in function");
}
@@ -1203,13 +1208,13 @@
finally { jj_save(0, xla); }
}
- final private boolean jj_3R_14() {
- if (jj_3R_16()) return true;
+ final private boolean jj_3R_15() {
+ if (jj_3R_17()) return true;
return false;
}
- final private boolean jj_3R_17() {
- if (jj_scan_token(42)) return true;
+ final private boolean jj_3R_14() {
+ if (jj_3R_16()) return true;
return false;
}
@@ -1221,6 +1226,11 @@
return false;
}
+ final private boolean jj_3R_17() {
+ if (jj_scan_token(42)) return true;
+ return false;
+ }
+
final private boolean jj_3R_13() {
if (jj_scan_token(39)) return true;
return false;
@@ -1252,11 +1262,6 @@
return false;
}
- final private boolean jj_3R_15() {
- if (jj_3R_17()) return true;
- return false;
- }
-
public as2jTokenManager token_source;
SimpleCharStream jj_input_stream;
public Token token, jj_nt;
Modified: trunk/src/jason/asSyntax/patterns/goal/OMC.java
===================================================================
--- trunk/src/jason/asSyntax/patterns/goal/OMC.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/asSyntax/patterns/goal/OMC.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -3,6 +3,7 @@
import jason.asSemantics.Agent;
import jason.asSyntax.Plan;
import jason.asSyntax.Pred;
+import jason.asSyntax.SourceInfo;
import jason.asSyntax.Term;
import jason.asSyntax.directives.Directive;
import jason.asSyntax.directives.DirectiveProcessor;
@@ -32,12 +33,12 @@
if (newAg != null) {
// add +f : true <- .fail_goal(g).
Plan pf = Plan.parse("+"+fail+" <- .fail_goal("+goal+").");
- pf.setSrc(outerContent+"/"+directive);
+ pf.setSrcInfo(new SourceInfo(outerContent+"/"+directive, 0));
newAg.getPL().add(pf);
// add -m : true <- .succeed_goal(g).
Plan pm = Plan.parse("-"+motivation+" <- .succeed_goal("+goal+").");
- pm.setSrc(outerContent+"/"+directive);
+ pm.setSrcInfo(new SourceInfo(outerContent+"/"+directive, 0));
newAg.getPL().add(pm);
return newAg;
Modified: trunk/src/jason/jeditplugin/AgentSpeakSideKickParser.java
===================================================================
--- trunk/src/jason/jeditplugin/AgentSpeakSideKickParser.java 2008-10-02 18:50:17 UTC (rev 1391)
+++ trunk/src/jason/jeditplugin/AgentSpeakSideKickParser.java 2008-10-05 16:34:24 UTC (rev 1392)
@@ -84,8 +84,8 @@
//super(((p.getLabel() == null) ? "" : "@" + p.getLabel() + " ") + p.getTriggerEvent());
super(p.getTrigger().toString());
this.plan = p;
- this.start = toPos(buf, p.getBeginSrcLine());
- this.end = toPos(buf, p.getEndSrcLine());
+ this.start = toPos(buf, p.getSrcInfo().getBeginSrcLine());
+ this.end = toPos(buf, p.getSrcInfo().getEndSrcLine());
}
public Icon getIcon() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|