incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1160012 [2/2] - in /incubator/lcf/trunk/framework: ./ core/src/main/java/org/apache/manifoldcf/core/interfaces/ script-engine/src/main/java/org/apache/manifoldcf/scriptengine/
Date Sun, 21 Aug 2011 17:10:22 GMT
Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java Sun Aug 21 17:10:20 2011
@@ -20,226 +20,588 @@
 package org.apache.manifoldcf.scriptengine;
 
 import java.util.*;
+import java.io.*;
 
-/** Parse script and execute.
+/** Class to parse various syntactical parts of a script and execute them.
 */
 public class ScriptParser
 {
-  protected TokenStream currentStream = null;
-  protected Map<String,VariableReference> context = new HashMap<String,VariableReference>();
+  /** The current variable context. */
+  protected Map<String,ContextVariableReference> context = new HashMap<String,ContextVariableReference>();
+  
+  /** A table of commands that we know how to deal with. */
+  protected Map<String,Command> commands = new HashMap<String,Command>();
   
   public ScriptParser()
   {
   }
   
-  /** Parse multiple statements.
+  /** Add a command.
+  *@param commandName is the name of the command.
+  *@param command is the command instance.
+  */
+  public void addCommand(String commandName, Command command)
+  {
+    commands.put(commandName,command);
+  }
+
+  // Statement return codes
+  protected static final int STATEMENT_NOTME = 0;
+  protected static final int STATEMENT_ISME = 1;
+  protected static final int STATEMENT_BREAK = 2;
+  
+  /** Parse and execute multiple statements.
+  *@param currentStream is the token stream to parse.
+  *@return true for a break signal.
   */
-  public boolean parseStatements()
+  public boolean parseStatements(TokenStream currentStream)
     throws ScriptException
   {
+    boolean breakSignal = false;
     while (true)
     {
-      if (parseStatement() == false)
-        break;
+      if (breakSignal)
+      {
+        if (skipStatement(currentStream) == false)
+          break;
+      }
+      else
+      {
+        int result = parseStatement(currentStream);
+        if (result == STATEMENT_NOTME)
+          break;
+        if (result == STATEMENT_BREAK)
+          breakSignal = true;
+      }
     }
-    return true;
+    return breakSignal;
   }
   
   /** Skip multiple statements.
+  *@param currentStream is the token stream to parse.
   */
-  public boolean skipStatements()
+  public void skipStatements(TokenStream currentStream)
     throws ScriptException
   {
     while (true)
     {
-      if (skipStatement() == false)
+      if (skipStatement(currentStream) == false)
         break;
     }
-    return true;
   }
   
+  
   /** Parse a single statement.
+  *@param currentStream is the current token stream.
+  *@return a signal indicating either NOTME, ISME, or BREAK.
   */
-  public boolean parseStatement()
+  protected int parseStatement(TokenStream currentStream)
+    throws ScriptException
+  {
+    int rval = STATEMENT_ISME;
+    
+    Token command = currentStream.peek();
+    if (command == null)
+      return STATEMENT_NOTME;
+    String commandString = command.getToken();
+    if (commandString == null)
+      return STATEMENT_NOTME;
+    
+    // Let's see if we know about this command.
+    Token t = currentStream.peek();
+    if (t != null && t.getToken() != null)
+    {
+      Command c = commands.get(t.getToken());
+      if (c != null)
+      {
+        // We do know about it.  So skip the command name and call the parse method.
+        currentStream.skip();
+        if (c.parseAndExecute(this,currentStream))
+          rval = STATEMENT_BREAK;
+        else
+          rval = STATEMENT_ISME;
+      }
+      else
+        return STATEMENT_NOTME;
+    }
+    else
+      return STATEMENT_NOTME;
+    
+    Token semi = currentStream.peek();
+    if (semi == null || semi.getPunctuation() == null || !semi.getPunctuation().equals(";"))
+      syntaxError(currentStream,"Missing semicolon");
+    currentStream.skip();
+    return rval;
+  }
+
+  /** Skip a single statement.
+  *@param currentStream is the current token stream.
+  *@return true if a statement was detected, false otherwise.
+  */
+  protected boolean skipStatement(TokenStream currentStream)
     throws ScriptException
   {
     Token command = currentStream.peek();
     if (command == null)
       return false;
-    String commandString = command.getString();
+    String commandString = command.getToken();
     if (commandString == null)
       return false;
-    if (commandString.equals("POST"))
+    
+    // Let's see if we know about this command.
+    Token t = currentStream.peek();
+    if (t != null && t.getToken() != null)
     {
-      currentStream.skip();
-      // MHL
+      Command c = commands.get(t.getToken());
+      if (c != null)
+      {
+        // We do know about it.  So skip the command name and call the parse method.
+        currentStream.skip();
+        c.parseAndSkip(this,currentStream);
+        // Fall through
+      }
+      else
+        return false;
     }
-    else if (commandString.equals("GET"))
+    else
+      return false;
+    
+    Token semi = currentStream.peek();
+    if (semi == null || semi.getPunctuation() == null || !semi.getPunctuation().equals(";"))
+      syntaxError(currentStream,"Missing semicolon");
+    currentStream.skip();
+    return true;
+  }
+  
+  /** Evaluate an expression.
+  *@param currentStream is the token stream to parse.
+  *@return a VariableReference object if an expression was detected, null otherwise.
+  */
+  public VariableReference evaluateExpression(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for pipe operations
+    VariableReference vr = evaluateExpression_1(currentStream);
+    if (vr == null)
+      return null;
+    while (true)
     {
-      currentStream.skip();
-      // MHL
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("||"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_1(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '||'");
+        vr = vr.resolve().doublePipe(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("|"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_1(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '|'");
+        vr = vr.resolve().pipe(v.resolve());
+      }
+      else
+        break;
     }
-    else if (commandString.equals("PUT"))
+    return vr;
+  }
+  
+  /** Skip an expression.
+  *@param currentStream is the token stream to parse.
+  *@return true if an expression was detected, false otherwise.
+  */
+  public boolean skipExpression(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for pipe operations
+    if (skipExpression_1(currentStream) == false)
+      return false;
+    while (true)
     {
-      currentStream.skip();
-      // MHL
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("||"))
+      {
+        currentStream.skip();
+        if (skipExpression_1(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '||'");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("|"))
+      {
+        currentStream.skip();
+        if (skipExpression_1(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '|'");
+      }
+      else
+        break;
     }
-    else if (commandString.equals("DELETE"))
+    return true;
+  }
+  
+  protected VariableReference evaluateExpression_1(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for ampersand operations
+    VariableReference vr = evaluateExpression_2(currentStream);
+    if (vr == null)
+      return null;
+    while (true)
     {
-      currentStream.skip();
-      // MHL
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("&&"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_2(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '&&'");
+        vr = vr.resolve().doubleAmpersand(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("&"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_2(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '&'");
+        vr = vr.resolve().ampersand(v.resolve());
+      }
+      else
+        break;
     }
-    else if (commandString.equals("if"))
+    return vr;
+  }
+  
+  protected boolean skipExpression_1(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for ampersand operations
+    if (skipExpression_2(currentStream) == false)
+      return false;
+    while (true)
     {
-      currentStream.skip();
-      Variable ifCondition = evaluateExpression();
-      if (ifCondition == null)
-        syntaxError("Missing if expression");
       Token t = currentStream.peek();
-      if (t == null || t.getString() == null || !t.getString().equals("then"))
-        syntaxError("Missing 'then' in if statement");
-      currentStream.skip();
-      if (ifCondition.getBooleanValue())
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("&&"))
       {
-        parseStatements();
-        t = currentStream.peek();
-        if (t != null &&t.getString().equals("else"))
-        {
-          currentStream.skip();
-          // Skip statements
-          skipStatements();
-        }
+        currentStream.skip();
+        if (skipExpression_2(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '&&'");
       }
-      else
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("&"))
       {
-        skipStatements();
-        t = currentStream.peek();
-        if (t != null && t.getString().equals("else"))
-        {
-          currentStream.skip();
-          // Parse statements
-          parseStatements();
-        }
+        currentStream.skip();
+        if (skipExpression_2(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '&'");
       }
+      else
+        break;
     }
-    else if (commandString.equals("while"))
+    return true;
+  }
+
+  protected VariableReference evaluateExpression_2(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for exclamation operations
+    Token t = currentStream.peek();
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("!"))
+    {
+      currentStream.skip();
+      VariableReference v = evaluateExpression_2(currentStream);
+      if (v == null)
+        syntaxError(currentStream,"Missing expression after '!'");
+      return v.resolve().unaryExclamation();
+    }
+    return evaluateExpression_3(currentStream);
+  }
+  
+  protected boolean skipExpression_2(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for exclamation operations
+    Token t = currentStream.peek();
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("!"))
     {
       currentStream.skip();
-      int expressionPosition = currentStream.getCharacterPosition();
-      while (true)
+      if (skipExpression_2(currentStream) == false)
+        syntaxError(currentStream,"Missing expression after '!'");
+      return true;
+    }
+    return skipExpression_3(currentStream);
+  }
+  
+  protected VariableReference evaluateExpression_3(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for comparison operations
+    VariableReference vr = evaluateExpression_4(currentStream);
+    if (vr == null)
+      return null;
+    while (true)
+    {
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("=="))
       {
-        currentStream.setCharacterPosition(expressionPosition);
-        Variable whileCondition = evaluateExpression();
-        if (whileCondition == null)
-          syntaxError("Missing while expression");
-        Token t = currentStream.peek();
-        if (t == null || t.getString() == null || !t.getString().equals("do"))
-          syntaxError("Missing 'do' in while statement");
         currentStream.skip();
-        if (whileCondition.getBooleanValue())
-        {
-          parseStatements();
-        }
-        else
-        {
-          skipStatements();
-          break;
-        }
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '=='");
+        vr = vr.resolve().doubleEquals(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("!="))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '!='");
+        vr = vr.resolve().exclamationEquals(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '<'");
+        vr = vr.resolve().lesserAngle(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '>'");
+        vr = vr.resolve().greaterAngle(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<="))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '<='");
+        vr = vr.resolve().lesserAngleEquals(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">="))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_4(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '>='");
+        vr = vr.resolve().greaterAngleEquals(v.resolve());
       }
+      else
+        break;
     }
-    else
+    return vr;
+  }
+  
+  protected boolean skipExpression_3(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for comparison operations
+    if (skipExpression_4(currentStream) == false)
       return false;
-    Token semi = currentStream.peek();
-    if (semi == null || semi.getPunctuation() == null || !semi.getPunctuation().equals(";"))
-      syntaxError("Missing semicolon");
-    currentStream.skip();
+    while (true)
+    {
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("=="))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '=='");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("!="))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '!='");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<"))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '<'");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">"))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '>'");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<="))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '<='");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">="))
+      {
+        currentStream.skip();
+        if (skipExpression_4(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '>='");
+      }
+      else
+        break;
+    }
     return true;
   }
+  
+  protected VariableReference evaluateExpression_4(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for +/- operations
+    VariableReference vr = evaluateExpression_5(currentStream);
+    if (vr == null)
+      return null;
+    while (true)
+    {
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("+"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_5(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '+'");
+        vr = vr.resolve().plus(v.resolve());
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("-"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_5(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '-'");
+        vr = vr.resolve().minus(v.resolve());
+      }
+      else
+        break;
+    }
+    return vr;
+  }
 
-  /** Skip a single statement.
-  */
-  public boolean skipStatement()
+  protected boolean skipExpression_4(TokenStream currentStream)
     throws ScriptException
   {
-    Token command = currentStream.peek();
-    if (command == null)
-      return false;
-    String commandString = command.getString();
-    if (commandString == null)
+    // Look for +/- operations
+    if (skipExpression_5(currentStream) == false)
       return false;
-    if (commandString.equals("POST") ||
-      commandString.equals("GET") ||
-      commandString.equals("PUT") ||
-      commandString.equals("DELETE"))
+    while (true)
     {
-      currentStream.skip();
-      while (true)
+      Token t = currentStream.peek();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("+"))
       {
-        Token t = currentStream.peek();
-        if (t == null || t.getPunctuation().equals(";"))
-          break;
+        currentStream.skip();
+        if (skipExpression_5(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '+'");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("-"))
+      {
+        currentStream.skip();
+        if (skipExpression_5(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '-'");
       }
+      else
+        break;
     }
-    else if (commandString.equals("if"))
+    return true;
+  }
+
+  protected VariableReference evaluateExpression_5(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for *// operations
+    VariableReference vr = evaluateExpression_6(currentStream);
+    if (vr == null)
+      return null;
+    while (true)
     {
-      currentStream.skip();
-      if (skipExpression() == false)
-        syntaxError("Missing if expression");
       Token t = currentStream.peek();
-      if (t == null || t.getString() == null || !t.getString().equals("then"))
-        syntaxError("Missing 'then' in if statement");
-      currentStream.skip();
-      skipStatements();
-      t = currentStream.peek();
-      if (t != null &&t.getString().equals("else"))
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("*"))
       {
         currentStream.skip();
-        // Skip statements
-        skipStatements();
+        VariableReference v = evaluateExpression_6(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '*'");
+        vr = vr.resolve().asterisk(v.resolve());
       }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("/"))
+      {
+        currentStream.skip();
+        VariableReference v = evaluateExpression_6(currentStream);
+        if (v == null)
+          syntaxError(currentStream,"Missing expression after '/'");
+        vr = vr.resolve().slash(v.resolve());
+      }
+      else
+        break;
     }
-    else if (commandString.equals("while"))
+    return vr;
+  }
+
+  protected boolean skipExpression_5(TokenStream currentStream)
+    throws ScriptException
+  {
+    // Look for *// operations
+    if (skipExpression_6(currentStream) == false)
+      return false;
+    while (true)
     {
-      currentStream.skip();
-      if (skipExpression() == false)
-	syntaxError("Missing while expression");
       Token t = currentStream.peek();
-      if (t == null || t.getString() == null || !t.getString().equals("do"))
-        syntaxError("Missing 'do' in if statement");
-      currentStream.skip();
-      skipStatements();
+      if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("*"))
+      {
+        currentStream.skip();
+        if (skipExpression_6(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '*'");
+      }
+      else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("/"))
+      {
+        currentStream.skip();
+        if (skipExpression_6(currentStream) == false)
+          syntaxError(currentStream,"Missing expression after '/'");
+      }
+      else
+        break;
     }
-    else
-      return false;
-    Token semi = currentStream.peek();
-    if (semi == null || semi.getPunctuation() == null || !semi.getPunctuation().equals(";"))
-      syntaxError("Missing semicolon");
-    currentStream.skip();
     return true;
   }
-  
-  protected Variable evaluateExpression()
+
+  protected VariableReference evaluateExpression_6(TokenStream currentStream)
     throws ScriptException
   {
-    // MHL
-    return null;
+    // Look for - operations
+    Token t = currentStream.peek();
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("-"))
+    {
+      currentStream.skip();
+      VariableReference v = evaluateExpression_6(currentStream);
+      if (v == null)
+        syntaxError(currentStream,"Missing expression after '-'");
+      return v.resolve().unaryMinus();
+    }
+    return parseVariableReference(currentStream);
   }
   
-  protected boolean skipExpression()
+  protected boolean skipExpression_6(TokenStream currentStream)
     throws ScriptException
   {
-    // MHL
-    return false;
+    // Look for - operations
+    Token t = currentStream.peek();
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("-"))
+    {
+      currentStream.skip();
+      if (skipExpression_6(currentStream) == false)
+        syntaxError(currentStream,"Missing expression after '-'");
+      return true;
+    }
+    return skipVariableReference(currentStream);
   }
-  
-  protected VariableReference parseVariableReference()
+
+  protected VariableReference parseVariableReference(TokenStream currentStream)
     throws ScriptException
   {
     // variable_reference -> variable_reference '[' expression ']'
     // variable_reference -> variable_reference.property_name
     // variable_reference -> variable_reference_1
     
-    VariableReference vr = parseVariableReference_1();
+    VariableReference vr = parseVariableReference_1(currentStream);
     if (vr == null)
       return vr;
     while (true)
@@ -248,29 +610,23 @@ public class ScriptParser
       if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("["))
       {
 	currentStream.skip();
-	Variable expression = evaluateExpression();
+	VariableReference expression = evaluateExpression(currentStream);
 	if (expression == null)
-	  syntaxError("Missing expression after '['");
-	int indexValue = expression.getIntValue();
-	Variable v = vr.resolve();
-	if (v == null)
-	  syntaxError("Null reference");
-	vr = v.getIndexed(indexValue);
+	  syntaxError(currentStream,"Missing expression after '['");
+	int indexValue = expression.resolve().getIntValue();
+	vr = vr.resolve().getIndexed(indexValue);
 	t = currentStream.peek();
 	if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals("]"))
-	  syntaxError("Missing ']'");
+	  syntaxError(currentStream,"Missing ']'");
 	currentStream.skip();
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("."))
       {
 	currentStream.skip();
 	t = currentStream.peek();
-	if (t == null || t.getString() == null)
-	  syntaxError("Need attribute name");
-	Variable v = vr.resolve();
-	if (v == null)
-	  syntaxError("Null attribute reference");
-	vr = v.getAttribute(t.getString());
+	if (t == null || t.getToken() == null)
+	  syntaxError(currentStream,"Need attribute name");
+	vr = vr.resolve().getAttribute(t.getToken());
 	currentStream.skip();
       }
       else
@@ -280,28 +636,72 @@ public class ScriptParser
     return vr;
   }
   
-  protected VariableReference parseVariableReference_1()
+  protected VariableReference parseVariableReference_1(TokenStream currentStream)
     throws ScriptException
   {
     Token t = currentStream.peek();
-    if (t == null || t.getString() == null)
-      return null;
-    currentStream.skip();
-    String variableName = t.getString();
-    // Look up variable reference in current context
-    VariableReference x = context.get(variableName);
-    if (x == null)
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("("))
     {
-      x = new VariableReference();
-      context.put(variableName,x);
+      currentStream.skip();
+      VariableReference rval = evaluateExpression(currentStream);
+      if (rval == null)
+        syntaxError(currentStream,"Missing expression after '('");
+      t = currentStream.peek();
+      if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals(")"))
+        syntaxError(currentStream,"Missing ')'");
+      currentStream.skip();
+      return rval;
     }
-    return x;
+    return parseVariableReference_2(currentStream);
   }
   
-  protected boolean skipVariableReference()
+  protected VariableReference parseVariableReference_2(TokenStream currentStream)
     throws ScriptException
   {
-    if (skipVariableReference_1() == false)
+    Token t = currentStream.peek();
+    if (t != null && t.getToken() != null)
+    {
+      currentStream.skip();
+      String variableName = t.getToken();
+      if (variableName.equals("true"))
+        return new VariableBoolean(true);
+      else if (variableName.equals("false"))
+        return new VariableBoolean(false);
+      else
+      {
+        // Look up variable reference in current context
+        ContextVariableReference x = context.get(variableName);
+        if (x == null)
+        {
+          x = new ContextVariableReference();
+          context.put(variableName,x);
+        }
+        return x;
+      }
+    }
+    else if (t != null && t.getString() != null)
+    {
+      currentStream.skip();
+      return new VariableString(t.getString());
+    }
+    else if (t != null && t.getFloat() != null)
+    {
+      currentStream.skip();
+      return new VariableFloat(new Double(t.getFloat()).doubleValue());
+    }
+    else if (t != null && t.getInteger() != null)
+    {
+      currentStream.skip();
+      return new VariableInt(Integer.parseInt(t.getInteger()));
+    }
+    else
+      return null;
+  }
+  
+  protected boolean skipVariableReference(TokenStream currentStream)
+    throws ScriptException
+  {
+    if (skipVariableReference_1(currentStream) == false)
       return false;
     while (true)
     {
@@ -309,19 +709,19 @@ public class ScriptParser
       if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("["))
       {
 	currentStream.skip();
-	if (skipExpression() == false)
-	  syntaxError("Missing expression after '['");
+	if (skipExpression(currentStream) == false)
+	  syntaxError(currentStream,"Missing expression after '['");
 	t = currentStream.peek();
 	if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals("]"))
-	  syntaxError("Missing ']'");
+	  syntaxError(currentStream,"Missing ']'");
 	currentStream.skip();
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("."))
       {
 	currentStream.skip();
 	t = currentStream.peek();
-	if (t == null || t.getString() == null)
-	  syntaxError("Need property name");
+	if (t == null || t.getToken() == null)
+	  syntaxError(currentStream,"Need property name");
 	currentStream.skip();
       }
       else
@@ -330,21 +730,108 @@ public class ScriptParser
       
     return true;
   }
-  
-  protected boolean skipVariableReference_1()
+
+  protected boolean skipVariableReference_1(TokenStream currentStream)
     throws ScriptException
   {
     Token t = currentStream.peek();
-    if (t == null || t.getString() == null)
-      return false;
-    currentStream.skip();
-    return true;
+    if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("("))
+    {
+      currentStream.skip();
+      if (skipExpression(currentStream) == false)
+        syntaxError(currentStream,"Missing expression after '('");
+      t = currentStream.peek();
+      if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals(")"))
+        syntaxError(currentStream,"Missing ')'");
+      currentStream.skip();
+      return true;
+    }
+    return skipVariableReference_2(currentStream);
+  }
+
+  protected boolean skipVariableReference_2(TokenStream currentStream)
+    throws ScriptException
+  {
+    Token t = currentStream.peek();
+    if (t != null && t.getToken() != null)
+    {
+      currentStream.skip();
+      return true;
+    }
+    else if (t != null && t.getString() != null)
+    {
+      currentStream.skip();
+      return true;
+    }
+    else if (t != null && t.getFloat() != null)
+    {
+      currentStream.skip();
+      return true;
+    }
+    else if (t != null && t.getInteger() != null)
+    {
+      currentStream.skip();
+      return true;
+    }
+
+    return false;
   }
   
-  protected void syntaxError(String message)
+  protected void syntaxError(TokenStream currentStream, String message)
     throws ScriptException
   {
-    throw new ScriptException(message+" in file "+currentStream.getFileName()+" at position "+currentStream.getCharacterPosition());
+    Token t = currentStream.peek();
+    if (t == null)
+      throw new ScriptException("Syntax error: "+message+", at end of file");
+    else
+      t.throwException("Syntax error: "+message+": "+t);
+  }
+  
+  public static void main(String[] argv)
+  {
+    if (argv.length > 1)
+    {
+      System.err.println("Usage: ScriptParser [<filename>]");
+      System.exit(1);
+    }
+    
+    ScriptParser sp = new ScriptParser();
+    
+    // Initialize script parser with the appropriate commands.
+    sp.addCommand("break",new BreakCommand());
+    sp.addCommand("print",new PrintCommand());
+    sp.addCommand("if",new IfCommand());
+    sp.addCommand("while",new WhileCommand());
+    sp.addCommand("set",new SetCommand());
+    
+    sp.addCommand("GET",new GETCommand());
+    sp.addCommand("PUT",new PUTCommand());
+    sp.addCommand("DELETE",new DELETECommand());
+    sp.addCommand("POST", new POSTCommand());
+    // MHL
+    
+    try
+    {
+      Reader reader;
+      if (argv.length == 1)
+      {
+        File inputFile = new File(argv[0]);
+        reader = new InputStreamReader(new FileInputStream(inputFile),"utf-8");
+      }
+      else
+        reader = new InputStreamReader(System.in);
+      
+      TokenStream ts = new BasicTokenStream(reader);
+      sp.parseStatements(ts);
+      Token t = ts.peek();
+      if (t != null)
+        t.throwException("Characters after end of script");
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace(System.err);
+      System.exit(2);
+    }
   }
   
 }

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java?rev=1160012&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java Sun Aug 21 17:10:20 2011
@@ -0,0 +1,63 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.scriptengine;
+
+/** Set command. */
+public class SetCommand implements Command
+{
+  /** Parse and execute.  Parsing begins right after the command name, and should stop before the trailing semicolon.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  *@return true to send a break signal, false otherwise.
+  */
+  public boolean parseAndExecute(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    VariableReference lhs = sp.evaluateExpression(currentStream);
+    if (lhs == null)
+      sp.syntaxError(currentStream,"Missing lhs expression in set command");
+    Token t = currentStream.peek();
+    if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals("="))
+      sp.syntaxError(currentStream,"Missing '=' in set command");
+    currentStream.skip();
+    VariableReference rhs = sp.evaluateExpression(currentStream);
+    if (rhs == null)
+      sp.syntaxError(currentStream,"Missing rhs expression in set command");
+    lhs.setReference(rhs.resolve());
+    return false;
+  }
+  
+  /** Parse and skip.  Parsing begins right after the command name, and should stop before the trailing semicolon.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  */
+  public void parseAndSkip(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    if (sp.skipExpression(currentStream) == false)
+      sp.syntaxError(currentStream,"Missing lhs expression in set command");
+    Token t = currentStream.peek();
+    if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals("="))
+      sp.syntaxError(currentStream,"Missing '=' in set command");
+    currentStream.skip();
+    if (sp.skipExpression(currentStream) == false)
+      sp.syntaxError(currentStream,"Missing rhs expression in set command");
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/SetCommand.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java Sun Aug 21 17:10:20 2011
@@ -23,14 +23,27 @@ public class Token
 {
   public static final int TOKEN_PUNCTUATION = 0;
   public static final int TOKEN_STRING = 1;
+  public static final int TOKEN_INTEGER = 2;
+  public static final int TOKEN_FLOAT = 3;
+  public static final int TOKEN_TOKEN = 4;
   
   protected int tokenType;
   protected String tokenValue;
+  protected int lineNumber;
+  protected int characterPosition;
   
-  public Token(int type, String value)
+  public Token(int type, String value, int lineNumber, int characterPosition)
   {
     this.tokenType = type;
-    this.tokenValue = tokenValue;
+    this.tokenValue = value;
+    this.lineNumber = lineNumber;
+    this.characterPosition = characterPosition;
+  }
+  
+  public void throwException(String message)
+    throws ScriptException
+  {
+    throw new ScriptException(message+" at line "+lineNumber+" position "+characterPosition);
   }
   
   public String getPunctuation()
@@ -40,6 +53,13 @@ public class Token
     return null;
   }
   
+  public String getToken()
+  {
+    if (tokenType == TOKEN_TOKEN)
+      return tokenValue;
+    return null;
+  }
+  
   public String getString()
   {
     if (tokenType == TOKEN_STRING)
@@ -47,4 +67,23 @@ public class Token
     return null;
   }
   
+  public String getFloat()
+  {
+    if (tokenType == TOKEN_FLOAT)
+      return tokenValue;
+    return null;
+  }
+  
+  public String getInteger()
+  {
+    if (tokenType == TOKEN_INTEGER)
+      return tokenValue;
+    return null;
+  }
+  
+  public String toString()
+  {
+    return "Type: "+Integer.toString(tokenType)+" Value: '"+tokenValue+"' Line: "+Integer.toString(lineNumber)+" Char: "+Integer.toString(characterPosition);
+  }
+  
 }
\ No newline at end of file

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java Sun Aug 21 17:10:20 2011
@@ -19,154 +19,16 @@
 
 package org.apache.manifoldcf.scriptengine;
 
-/** Convert a script into a stream of tokens.
+/** Describe a sequence of tokens.
 */
-public class TokenStream
+public interface TokenStream
 {
-  protected String fileName;
-  protected String code;
-  protected int characterPosition = 0;
-  protected Token currentToken = null;
-  
-  public TokenStream(String fileName, String code)
-  {
-    this.fileName = fileName;
-    this.code = code;
-  }
-  
-  public int getCharacterPosition()
-  {
-    return characterPosition;
-  }
-  
-  public void setCharacterPosition(int characterPosition)
-  {
-    this.characterPosition = characterPosition;
-    currentToken = null;
-  }
-  
+  /** Examine the current token.
+  */
   public Token peek()
-  {
-    if (currentToken == null)
-      currentToken = parseNextToken();
-    return currentToken;
-  }
-  
-  public void skip()
-  {
-    currentToken = null;
-  }
-  
-  public String getFileName()
-  {
-    return fileName;
-  }
-
-  // Protected methods
-  
-  protected Token parseNextToken()
-  {
-    // Skip to the start of the next token (or exit if no token start can be found)
-    while (true)
-    {
-      // Skip white space
-      while (characterPosition < code.length())
-      {
-        char x = code.charAt(characterPosition);
-        if (x > ' ')
-          break;
-        characterPosition++;
-      }
-      
-      // End of text?
-      if (characterPosition == code.length())
-        return null;
-      
-      // Is it a comment?
-      char y = code.charAt(characterPosition);
-      if (y == '#')
-      {
-        // Skip to the end of the line, or the end of the text.
-        while (characterPosition < code.length())
-        {
-          char x = code.charAt(characterPosition++);
-          if (x == '\n')
-            break;
-        }
-        continue;
-      }
-      break;
-    }
-
-    // At the start of the next token.
-    // Figure out what kind of token it is.  Currently we only care about punctuation
-    // and strings.  Furthermore, no distinction is made between quoted and unquoted
-    // strings.
-    char z = code.charAt(characterPosition);
-    if (isLegalTokenCharacter(z))
-    {
-      // Legal token character
-      StringBuilder tokenBuffer = new StringBuilder();
-      int quoteMark = -1;
-      while (characterPosition < code.length())
-      {
-        char x = code.charAt(characterPosition);
-        if (quoteMark == -1)
-        {
-          // Not yet in a quote
-          if (x <= ' ' || x == '#')
-            break;
-          if (x == '\'' || x == '"')
-          {
-            characterPosition++;
-            quoteMark = (int)x;
-          }
-          else if (isLegalTokenCharacter(x))
-          {
-            characterPosition++;
-            tokenBuffer.append(x);
-          }
-          else
-            break;
-        }
-        else
-        {
-          characterPosition++;
-          // In a quote.
-          if (((int)x) == quoteMark)
-            // End of the quotation
-            break;
-          if (x == '\\')
-          {
-            // Escape character
-            if (characterPosition < code.length())
-              tokenBuffer.append(code.charAt(characterPosition++));
-          }
-          else
-            tokenBuffer.append(x);
-        }
-      }
-      return new Token(Token.TOKEN_STRING,tokenBuffer.toString());
-    }
-    else
-    {
-      // Set a punctuation token
-      characterPosition++;
-      return new Token(Token.TOKEN_PUNCTUATION,new StringBuilder(z).toString());
-    }
-  }
-  
-  protected static boolean isLegalTokenCharacter(char x)
-  {
-    if (x >= '0' && x <= '9')
-      return true;
-    if (x >= 'a' && x <= 'z')
-      return true;
-    if (x >= 'A' && x <='Z')
-      return true;
-    if (x == '_' || x == '$' || x == '@')
-      return true;
-    return false;
-  }
+    throws ScriptException;
   
+  /** Skip the current token.
+  */
+  public void skip();
 }

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java Sun Aug 21 17:10:20 2011
@@ -28,6 +28,8 @@ public interface Variable
   
   /** Name attribute */
   public static String ATTRIBUTE_NAME = "__name__";
+  /** Value attribute */
+  public static String ATTRIBUTE_VALUE = "__value__";
   /** Size attribute */
   public static String ATTRIBUTE_SIZE = "__size__";
   /** OK status attribute */
@@ -35,12 +37,18 @@ public interface Variable
   /** NOTFOUND status attribute */
   public static String ATTRIBUTE_NOTFOUNDSTATUS = "__NOTFOUND__";
   /** CREATED status attribute */
-  public static String ATTRIBUTE_CREATED = "__CREATED__";
+  public static String ATTRIBUTE_CREATEDSTATUS = "__CREATED__";
+  /** RESULT attribute */
+  public static String ATTRIBUTE_RESULT = "__result__";
   
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException;
-  
+
+  /** Get the variable's value as a JSON string */
+  public String getJSONValue()
+    throws ScriptException;
+
   /** Get the variable's value as a boolean */
   public boolean getBooleanValue()
     throws ScriptException;
@@ -53,13 +61,63 @@ public interface Variable
   public double getDoubleValue()
     throws ScriptException;
   
+  // Arithmetic and comparison operators
+  
+  public VariableReference plus(Variable v)
+    throws ScriptException;
+    
+  public VariableReference minus(Variable v)
+    throws ScriptException;
+    
+  public VariableReference asterisk(Variable v)
+    throws ScriptException;
+    
+  public VariableReference slash(Variable v)
+    throws ScriptException;
+    
+  public VariableReference unaryMinus()
+    throws ScriptException;
+  
+  public VariableReference greaterAngle(Variable v)
+    throws ScriptException;
+    
+  public VariableReference lesserAngle(Variable v)
+    throws ScriptException;
+    
+  public VariableReference doubleEquals(Variable v)
+    throws ScriptException;
+    
+  public VariableReference greaterAngleEquals(Variable v)
+    throws ScriptException;
+    
+  public VariableReference lesserAngleEquals(Variable v)
+    throws ScriptException;
+  
+  public VariableReference exclamationEquals(Variable v)
+    throws ScriptException;
+  
+  public VariableReference ampersand(Variable v)
+    throws ScriptException;
+    
+  public VariableReference pipe(Variable v)
+    throws ScriptException;
+
+  public VariableReference doubleAmpersand(Variable v)
+    throws ScriptException;
+    
+  public VariableReference doublePipe(Variable v)
+    throws ScriptException;
+
+  public VariableReference unaryExclamation()
+    throws ScriptException;
+    
   // The following operations allow manipulation of a Configuration structure
 
   /** Get a named attribute of the variable; e.g. xxx.yyy */
   public VariableReference getAttribute(String attributeName)
     throws ScriptException;
   
-  // The following two operations correspond to <xxx> and xxx[index]
+  // The following operations correspond to xxx[index]
   
   /** Get an indexed property of the variable */
   public VariableReference getIndexed(int index)

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java Sun Aug 21 17:10:20 2011
@@ -22,7 +22,7 @@ package org.apache.manifoldcf.scriptengi
 /** Base class for variables.
 * Basically, everything is illegal until overridden.
 */
-public class VariableBase implements Variable
+public class VariableBase implements Variable, VariableReference
 {
   public VariableBase()
   {
@@ -35,6 +35,13 @@ public class VariableBase implements Var
     throw new ScriptException("Cannot convert variable to string");
   }
   
+  /** Get the variable's value as a JSON string */
+  public String getJSONValue()
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot convert variable to JSON");
+  }
+
   /** Get the variable's value as a boolean */
   public boolean getBooleanValue()
     throws ScriptException
@@ -55,7 +62,105 @@ public class VariableBase implements Var
   {
     throw new ScriptException("Cannot convert variable to float");
   }
+
+  // Operations
+  
+  public VariableReference plus(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("+ operator illegal for this type");
+  }
+    
+  public VariableReference minus(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("- operator illegal for this type");
+  }
+    
+  public VariableReference asterisk(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("* operator illegal for this type");
+  }
+    
+  public VariableReference slash(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("/ operator illegal for this type");
+  }
+    
+  public VariableReference unaryMinus()
+    throws ScriptException
+  {
+    throw new ScriptException("Unary - operator illegal for this type");
+  }
+  
+  public VariableReference greaterAngle(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("> operator illegal for this type");
+  }
+    
+  public VariableReference lesserAngle(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("< operator illegal for this type");
+  }
+    
+  public VariableReference doubleEquals(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("= operator illegal for this type");
+  }
+    
+  public VariableReference greaterAngleEquals(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException(">= operator illegal for this type");
+  }
+    
+  public VariableReference lesserAngleEquals(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("<= operator illegal for this type");
+  }
+  
+  public VariableReference exclamationEquals(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("!= operator illegal for this type");
+  }
+  
+  public VariableReference ampersand(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("& operator illegal for this type");
+  }
+    
+  public VariableReference pipe(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("| operator illegal for this type");
+  }
+
+  public VariableReference doubleAmpersand(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("&& operator illegal for this type");
+  }
+    
+  public VariableReference doublePipe(Variable v)
+    throws ScriptException
+  {
+    throw new ScriptException("|| operator illegal for this type");
+  }
   
+  public VariableReference unaryExclamation()
+    throws ScriptException
+  {
+    throw new ScriptException("! operator illegal for this type");
+  }
+
   // The following operations allow manipulation of a Configuration structure
 
   /** Get a named attribute of the variable; e.g. xxx.yyy */
@@ -74,4 +179,20 @@ public class VariableBase implements Var
     throw new ScriptException("Variable has no member number "+Integer.toString(index));
   }
 
+  // As a variable reference, refer to self
+  
+  /** Set the reference */
+  public void setReference(Variable object)
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot set reference of this kind");
+  }
+  
+  /** Resolve the reference */
+  public Variable resolve()
+    throws ScriptException
+  {
+    return this;
+  }
+
 }

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java?rev=1160012&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java Sun Aug 21 17:10:20 2011
@@ -0,0 +1,67 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Variable class representing an integer.
+*/
+public class VariableBoolean extends VariableBase
+{
+  protected boolean value;
+  
+  public VariableBoolean(boolean value)
+  {
+    this.value = value;
+  }
+
+  /** Get the variable's value as a boolean */
+  public boolean getBooleanValue()
+    throws ScriptException
+  {
+    return value;
+  }
+
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    if (value)
+      return "true";
+    return "false";
+  }
+
+  public VariableReference doubleAmpersand(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value && v.getBooleanValue());
+  }
+    
+  public VariableReference doublePipe(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value || v.getBooleanValue());
+  }
+
+  public VariableReference unaryExclamation()
+    throws ScriptException
+  {
+    return new VariableBoolean(! value);
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java Sun Aug 21 17:10:20 2011
@@ -46,13 +46,34 @@ public class VariableConfiguration exten
     }
   }
   
+  /** Get a string from this */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return configuration.toString();
+  }
+  
+  /** Get the variable's value as a JSON string */
+  public String getJSONValue()
+    throws ScriptException
+  {
+    try
+    {
+      return configuration.toJSON();
+    }
+    catch (ManifoldCFException e)
+    {
+      throw new ScriptException(e.getMessage(),e);
+    }
+  }
+
   /** Get a named attribute of the variable; e.g. xxx.yyy */
   public VariableReference getAttribute(String attributeName)
     throws ScriptException
   {
     // We recognize only the __size__ attribute
     if (attributeName.equals(ATTRIBUTE_SIZE))
-      return new VariableReference(new VariableInt(configuration.getChildCount()));
+      return new VariableInt(configuration.getChildCount());
     return super.getAttribute(attributeName);
   }
   
@@ -61,19 +82,17 @@ public class VariableConfiguration exten
     throws ScriptException
   {
     if (index < configuration.getChildCount())
-      return new NodeReference(index, new VariableConfigurationNode(configuration.findChild(index)));
+      return new NodeReference(index);
     return super.getIndexed(index);
   }
   
   /** Extend VariableReference class so we capture attempts to set the reference, and actually overwrite the child when that is done */
-  protected class NodeReference extends VariableReference
+  protected class NodeReference implements VariableReference
   {
     protected int index;
     
-    public NodeReference(int index, VariableConfigurationNode node)
-      throws ScriptException
+    public NodeReference(int index)
     {
-      super(node);
       this.index = index;
     }
     
@@ -81,11 +100,20 @@ public class VariableConfiguration exten
       throws ScriptException
     {
       if (!(v instanceof VariableConfigurationNode))
-        throw new ScriptException("Cannot set child value to anything other than a ConfigurationNode object");
-      super.setReference(v);
+        throw new ScriptException("Cannot set Configuration child value to anything other than a ConfigurationNode object");
+      if (index >= configuration.getChildCount())
+        throw new ScriptException("Index out of range for Configuration children");
       configuration.removeChild(index);
       configuration.addChild(index,((VariableConfigurationNode)v).getConfigurationNode());
     }
     
+    public Variable resolve()
+      throws ScriptException
+    {
+      if (index >= configuration.getChildCount())
+        throw new ScriptException("Index out of range for Configuration children");
+      return new VariableConfigurationNode(configuration.findChild(index));
+    }
+    
   }
 }

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java Sun Aug 21 17:10:20 2011
@@ -37,18 +37,36 @@ public class VariableConfigurationNode e
     configurationNode = node;
   }
   
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return configurationNode.toString();
+  }
+
   /** Get a named attribute of the variable; e.g. xxx.yyy */
   public VariableReference getAttribute(String attributeName)
     throws ScriptException
   {
-    // We recognize only the __size__ attribute
+    // We recognize the __size__ attribute
     if (attributeName.equals(ATTRIBUTE_SIZE))
-      return new VariableReference(new VariableInt(configurationNode.getChildCount()));
+      return new VariableInt(configurationNode.getChildCount());
+    // Also, the __name__ attribute
+    if (attributeName.equals(ATTRIBUTE_NAME))
+      return new VariableString(configurationNode.getType());
+    // And the __value__ attribute
+    if (attributeName.equals(ATTRIBUTE_VALUE))
+    {
+      String x = configurationNode.getValue();
+      if (x == null)
+        return new NullVariableReference();
+      return new VariableString(x);
+    }
     // Look for named attribute
     String attributeValue = configurationNode.getAttributeValue(attributeName);
     // MHL to allow attribute to be modified
     if (attributeValue != null)
-      return new VariableReference(new VariableString(attributeValue));
+      return new VariableString(attributeValue);
     return super.getAttribute(attributeName);
   }
   
@@ -57,7 +75,7 @@ public class VariableConfigurationNode e
     throws ScriptException
   {
     if (index < configurationNode.getChildCount())
-      return new NodeReference(index, new VariableConfigurationNode(configurationNode.findChild(index)));
+      return new NodeReference(index);
     return super.getIndexed(index);
   }
   
@@ -67,14 +85,12 @@ public class VariableConfigurationNode e
   }
   
   /** Extend VariableReference class so we capture attempts to set the reference, and actually overwrite the child when that is done */
-  protected class NodeReference extends VariableReference
+  protected class NodeReference implements VariableReference
   {
     protected int index;
     
-    public NodeReference(int index, VariableConfigurationNode node)
-      throws ScriptException
+    public NodeReference(int index)
     {
-      super(node);
       this.index = index;
     }
     
@@ -82,11 +98,20 @@ public class VariableConfigurationNode e
       throws ScriptException
     {
       if (!(v instanceof VariableConfigurationNode))
-        throw new ScriptException("Cannot set child value to anything other than a ConfigurationNode object");
-      super.setReference(v);
+        throw new ScriptException("Cannot set ConfigurationNode child value to anything other than a ConfigurationNode object");
+      if (index >= configurationNode.getChildCount())
+        throw new ScriptException("Index out of range for ConfigurationNode children");
       configurationNode.removeChild(index);
       configurationNode.addChild(index,((VariableConfigurationNode)v).getConfigurationNode());
     }
-    
+
+    public Variable resolve()
+      throws ScriptException
+    {
+      if (index >= configurationNode.getChildCount())
+        throw new ScriptException("Index out of range for ConfigurationNode children");
+      return new VariableConfigurationNode(configurationNode.findChild(index));
+    }
+
   }
 }

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java?rev=1160012&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java Sun Aug 21 17:10:20 2011
@@ -0,0 +1,54 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Variable class representing an integer.
+*/
+public class VariableFloat extends VariableBase
+{
+  protected double value;
+  
+  public VariableFloat(double value)
+  {
+    this.value = value;
+  }
+  
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return new Double(value).toString();
+  }
+
+  /** Get the variable's value as an integer */
+  public int getIntValue()
+    throws ScriptException
+  {
+    return (int)value;
+  }
+  
+  /** Get the variable's value as a double */
+  public double getDoubleValue()
+    throws ScriptException
+  {
+    return value;
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java Sun Aug 21 17:10:20 2011
@@ -51,4 +51,82 @@ public class VariableInt extends Variabl
     return (double)value;
   }
 
+  public VariableReference plus(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value + v.getIntValue());
+  }
+    
+  public VariableReference minus(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value - v.getIntValue());
+  }
+    
+  public VariableReference asterisk(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value * v.getIntValue());
+  }
+    
+  public VariableReference slash(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value / v.getIntValue());
+  }
+    
+  public VariableReference unaryMinus()
+    throws ScriptException
+  {
+    return new VariableInt(-value);
+  }
+  
+  public VariableReference greaterAngle(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value > v.getIntValue());
+  }
+  
+  public VariableReference lesserAngle(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value < v.getIntValue());
+  }
+    
+  public VariableReference doubleEquals(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value == v.getIntValue());
+  }
+    
+  public VariableReference greaterAngleEquals(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value >= v.getIntValue());
+  }
+    
+  public VariableReference lesserAngleEquals(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value <= v.getIntValue());
+  }
+  
+  public VariableReference exclamationEquals(Variable v)
+    throws ScriptException
+  {
+    return new VariableBoolean(value != v.getIntValue());
+  }
+  
+  public VariableReference ampersand(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value & v.getIntValue());
+  }
+    
+  public VariableReference pipe(Variable v)
+    throws ScriptException
+  {
+    return new VariableInt(value | v.getIntValue());
+  }
+
 }

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java?rev=1160012&r1=1160011&r2=1160012&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java Sun Aug 21 17:10:20 2011
@@ -19,33 +19,17 @@
 
 package org.apache.manifoldcf.scriptengine;
 
-/** This class is a mutable reference to a variable.
-* It exists as a separate class so that the reference to the underlying
+/** This interface represents a mutable reference to a variable.
+* It exists as a separate entity so that the reference to the underlying
 * variable can be easily modified.  The reference can, of course, be null.
 */
-public class VariableReference
+public interface VariableReference
 {
-  protected Variable reference;
-  
-  public VariableReference()
-  {
-    reference = null;
-  }
-  
-  public VariableReference(Variable object)
-    throws ScriptException
-  {
-    reference = object;
-  }
-  
+  /** Set the reference */
   public void setReference(Variable object)
-    throws ScriptException
-  {
-    reference = object;
-  }
+    throws ScriptException;
   
+  /** Resolve the reference */
   public Variable resolve()
-  {
-    return reference;
-  }
+    throws ScriptException;
 }

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java?rev=1160012&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java Sun Aug 21 17:10:20 2011
@@ -0,0 +1,67 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Variable class representing the result of an http operation.
+* This consists of two parts: a result code, and a VariableConfiguration object.
+*/
+public class VariableResult extends VariableBase
+{
+  protected int resultCode;
+  protected VariableConfiguration result;
+  
+  public VariableResult(int resultCode, String json)
+    throws ScriptException
+  {
+    this.resultCode = resultCode;
+    this.result = new VariableConfiguration("result",json);
+  }
+  
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return "("+Integer.toString(resultCode)+") "+result.getStringValue();
+  }
+
+  /** Get the variable's value as an integer */
+  public int getIntValue()
+    throws ScriptException
+  {
+    return resultCode;
+  }
+  
+  /** Get a named attribute of the variable; e.g. xxx.yyy */
+  public VariableReference getAttribute(String attributeName)
+    throws ScriptException
+  {
+    if (attributeName.equals(ATTRIBUTE_OKSTATUS))
+      return new VariableBoolean(resultCode == 200);
+    else if (attributeName.equals(ATTRIBUTE_CREATEDSTATUS))
+      return new VariableBoolean(resultCode == 201);
+    else if (attributeName.equals(ATTRIBUTE_NOTFOUNDSTATUS))
+      return new VariableBoolean(resultCode == 404);
+    else if (attributeName.equals(ATTRIBUTE_RESULT))
+      return result;
+    else
+      return super.getAttribute(attributeName);
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java?rev=1160012&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java Sun Aug 21 17:10:20 2011
@@ -0,0 +1,78 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.scriptengine;
+
+/** While command. */
+public class WhileCommand implements Command
+{
+  /** Parse and execute.  Parsing begins right after the command name, and should stop before the trailing semicolon.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  *@return true to send a break signal, false otherwise.
+  */
+  public boolean parseAndExecute(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    RewindableTokenStream rts = new RewindableTokenStream(currentStream);
+    boolean breakFromLoop = false;
+    while (true)
+    {
+      rts.reset();
+      if (breakFromLoop)
+      {
+        sp.skipStatements(rts);
+        break;
+      }
+      VariableReference whileCondition = sp.evaluateExpression(rts);
+      if (whileCondition == null)
+        sp.syntaxError(rts,"Missing while expression");
+      Token t = rts.peek();
+      if (t == null || t.getToken() == null || !t.getToken().equals("do"))
+        sp.syntaxError(rts,"Missing 'do' in while statement");
+      rts.skip();
+      if (whileCondition.resolve().getBooleanValue())
+      {
+        breakFromLoop = sp.parseStatements(rts);
+      }
+      else
+      {
+        sp.skipStatements(rts);
+        break;
+      }
+    }
+    return false;
+  }
+  
+  /** Parse and skip.  Parsing begins right after the command name, and should stop before the trailing semicolon.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  */
+  public void parseAndSkip(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    if (sp.skipExpression(currentStream) == false)
+      sp.syntaxError(currentStream,"Missing while expression");
+    Token t = currentStream.peek();
+    if (t == null || t.getToken() == null || !t.getToken().equals("do"))
+      sp.syntaxError(currentStream,"Missing 'do' in if statement");
+    currentStream.skip();
+    sp.skipStatements(currentStream);
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/WhileCommand.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message