|
From: <jom...@us...> - 2011-03-30 14:36:25
|
Revision: 1638
http://jason.svn.sourceforge.net/jason/?rev=1638&view=rev
Author: jomifred
Date: 2011-03-30 14:36:18 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
fix bug in initial beliefs with strings
Modified Paths:
--------------
trunk/src/jason/asSemantics/Agent.java
trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc
trunk/src/jason/runtime/Settings.java
Modified: trunk/src/jason/asSemantics/Agent.java
===================================================================
--- trunk/src/jason/asSemantics/Agent.java 2011-03-21 20:36:42 UTC (rev 1637)
+++ trunk/src/jason/asSemantics/Agent.java 2011-03-30 14:36:18 UTC (rev 1638)
@@ -439,8 +439,6 @@
protected void addInitialBelsFromProjectInBB() {
String sBels = getTS().getSettings().getUserParameter("beliefs");
if (sBels != null) {
- if (sBels.startsWith("\"") && sBels.endsWith("\""))
- sBels = sBels.substring(1, sBels.length()-1);
try {
for (Term t: ASSyntax.parseList("["+sBels+"]")) {
getBB().add((Literal)t);
@@ -470,8 +468,6 @@
protected void addInitialGoalsFromProjectInBB() {
String sGoals = getTS().getSettings().getUserParameter("goals");
if (sGoals != null) {
- if (sGoals.startsWith("\"") && sGoals.endsWith("\""))
- sGoals = sGoals.substring(1, sGoals.length()-1);
try {
for (Term t: ASSyntax.parseList("["+sGoals+"]")) {
Literal g = (Literal)t;
Modified: trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc
===================================================================
--- trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc 2011-03-21 20:36:42 UTC (rev 1637)
+++ trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc 2011-03-30 14:36:18 UTC (rev 1638)
@@ -139,11 +139,20 @@
| <NUMBER: ["0"-"9"] (["0"-"9"])* >
// Strings
-| <STRING: "\"" ( ~["\"","\\","\n","\r"]
- | "\\" ( ["n","t","b","r","f","\\","\'","\""]
- | ["0"-"7"] (["0"-"7"])?
- | ["0"-"3"] ["0"-"7"] ["0"-"7"]))* "\"">
+| <STRING:
+ "\""
+ ( (~["\"","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ )*
+ "\""
+ >
+
// Identifiers
| <ASID: <LC_LETTER> (<LETTER>|<DIGIT>|"_")* >
| <ID: <LETTER> (<LETTER>|<DIGIT>|"_")* >
Modified: trunk/src/jason/runtime/Settings.java
===================================================================
--- trunk/src/jason/runtime/Settings.java 2011-03-21 20:36:42 UTC (rev 1637)
+++ trunk/src/jason/runtime/Settings.java 2011-03-30 14:36:18 UTC (rev 1638)
@@ -204,8 +204,10 @@
}
public String getUserParameter(String key) {
String vl = (String)userParameters.get(key);
- if (vl != null && vl.startsWith("\"") && vl.endsWith("\""))
+ if (vl != null && vl.startsWith("\"") && vl.endsWith("\"")) {
vl = vl.substring(1, vl.length()-1);
+ vl = vl.replaceAll("\\\\\"", "\"");
+ }
return vl;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|