You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2016/07/07 20:47:10 UTC

svn commit: r1751831 [3/4] - in /activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk: ./ src/main/csharp/ src/main/csharp/Readers/ src/main/csharp/Selector/

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MinusExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MinusExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MinusExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MinusExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,67 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// A filter performing a substraction of two expressions.
+    /// </summary>
+    public class MinusExpression : ArithmeticExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "-"; }
+        }
+
+        public MinusExpression(IExpression left, IExpression right)
+            : base(left, right)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object lvalue = Left.Evaluate(message);
+            if(lvalue == null) return null;
+
+            object rvalue = Right.Evaluate(message);
+            if(rvalue == null) return null;
+
+            AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
+
+            object result = null;
+
+            switch(values.TypeEnum)
+            {
+                case AlignedNumericValues.T.SByteType : result = (sbyte )values.Left - (sbyte )values.Right; break;
+                case AlignedNumericValues.T.ByteType  : result = (byte  )values.Left - (byte  )values.Right; break;
+                case AlignedNumericValues.T.CharType  : result = (char  )values.Left - (char  )values.Right; break;
+                case AlignedNumericValues.T.ShortType : result = (short )values.Left - (short )values.Right; break;
+                case AlignedNumericValues.T.UShortType: result = (ushort)values.Left - (ushort)values.Right; break;
+                case AlignedNumericValues.T.IntType   : result = (int   )values.Left - (int   )values.Right; break;
+                case AlignedNumericValues.T.UIntType  : result = (uint  )values.Left - (uint  )values.Right; break;
+                case AlignedNumericValues.T.LongType  : result = (long  )values.Left - (long  )values.Right; break;
+                case AlignedNumericValues.T.ULongType : result = (ulong )values.Left - (ulong )values.Right; break;
+                case AlignedNumericValues.T.FloatType : result = (float )values.Left - (float )values.Right; break;
+                case AlignedNumericValues.T.DoubleType: result = (double)values.Left - (double)values.Right; break;
+            }
+
+            return result;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ModExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ModExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ModExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ModExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,67 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// A filter performing a modulo of two expressions.
+    /// </summary>
+    public class ModExpression : ArithmeticExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "%"; }
+        }
+
+        public ModExpression(IExpression left, IExpression right)
+            : base(left, right)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object lvalue = Left.Evaluate(message);
+            if(lvalue == null) return null;
+
+            object rvalue = Right.Evaluate(message);
+            if(rvalue == null) return null;
+
+            AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
+
+            object result = null;
+
+            switch(values.TypeEnum)
+            {
+                case AlignedNumericValues.T.SByteType : result = (sbyte )values.Left % (sbyte )values.Right; break;
+                case AlignedNumericValues.T.ByteType  : result = (byte  )values.Left % (byte  )values.Right; break;
+                case AlignedNumericValues.T.CharType  : result = (char  )values.Left % (char  )values.Right; break;
+                case AlignedNumericValues.T.ShortType : result = (short )values.Left % (short )values.Right; break;
+                case AlignedNumericValues.T.UShortType: result = (ushort)values.Left % (ushort)values.Right; break;
+                case AlignedNumericValues.T.IntType   : result = (int   )values.Left % (int   )values.Right; break;
+                case AlignedNumericValues.T.UIntType  : result = (uint  )values.Left % (uint  )values.Right; break;
+                case AlignedNumericValues.T.LongType  : result = (long  )values.Left % (long  )values.Right; break;
+                case AlignedNumericValues.T.ULongType : result = (ulong )values.Left % (ulong )values.Right; break;
+                case AlignedNumericValues.T.FloatType : result = (float )values.Left % (float )values.Right; break;
+                case AlignedNumericValues.T.DoubleType: result = (double)values.Left % (double)values.Right; break;
+            }
+
+            return result;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MultiplyExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MultiplyExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MultiplyExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/MultiplyExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,67 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// A filter performing a multiplication of two expressions.
+    /// </summary>
+    public class MultiplyExpression : ArithmeticExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "*"; }
+        }
+
+        public MultiplyExpression(IExpression left, IExpression right)
+            : base(left, right)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object lvalue = Left.Evaluate(message);
+            if(lvalue == null) return null;
+
+            object rvalue = Right.Evaluate(message);
+            if(rvalue == null) return null;
+
+            AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
+
+            object result = null;
+
+            switch(values.TypeEnum)
+            {
+                case AlignedNumericValues.T.SByteType : result = (sbyte )values.Left * (sbyte )values.Right; break;
+                case AlignedNumericValues.T.ByteType  : result = (byte  )values.Left * (byte  )values.Right; break;
+                case AlignedNumericValues.T.CharType  : result = (char  )values.Left * (char  )values.Right; break;
+                case AlignedNumericValues.T.ShortType : result = (short )values.Left * (short )values.Right; break;
+                case AlignedNumericValues.T.UShortType: result = (ushort)values.Left * (ushort)values.Right; break;
+                case AlignedNumericValues.T.IntType   : result = (int   )values.Left * (int   )values.Right; break;
+                case AlignedNumericValues.T.UIntType  : result = (uint  )values.Left * (uint  )values.Right; break;
+                case AlignedNumericValues.T.LongType  : result = (long  )values.Left * (long  )values.Right; break;
+                case AlignedNumericValues.T.ULongType : result = (ulong )values.Left * (ulong )values.Right; break;
+                case AlignedNumericValues.T.FloatType : result = (float )values.Left * (float )values.Right; break;
+                case AlignedNumericValues.T.DoubleType: result = (double)values.Left * (double)values.Right; break;
+            }
+
+            return result;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NOTExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NOTExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NOTExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NOTExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,45 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// An expression which negates a boolean expression value.
+    /// </summary>
+    public class NOTExpression : BooleanUnaryExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "NOT"; }
+        }
+
+        public NOTExpression(IExpression left)
+            : base(left)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object rvalue = Right.Evaluate(message);
+            if(rvalue == null   ) return null;
+            if(rvalue is bool   ) return !(bool)rvalue;
+            return null;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NegateExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NegateExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NegateExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/NegateExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,51 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// An expression which negates a numeric expression value.
+    /// </summary>
+    public class NegateExpression : UnaryExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "-"; }
+        }
+
+        public NegateExpression(IExpression left)
+            : base(left)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object rvalue = Right.Evaluate(message);
+            if(rvalue == null   ) return null;
+            if(rvalue is int    ) return -(int    )rvalue;
+            if(rvalue is long   ) return -(long   )rvalue;
+            if(rvalue is double ) return -(double )rvalue;
+            if(rvalue is float  ) return -(float  )rvalue;
+            if(rvalue is decimal) return -(decimal)rvalue;
+            if(rvalue is short  ) return -(short  )rvalue;
+            if(rvalue is byte   ) return -(byte   )rvalue;
+            return null;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ORExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ORExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ORExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ORExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,46 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// A filter performing a logical OR combination of two expressions.
+    /// </summary>
+    public class ORExpression : LogicExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "OR"; }
+        }
+
+        public ORExpression(IBooleanExpression left, IBooleanExpression right)
+            : base(left, right)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object lvalue = Left.Evaluate(message);
+            if(lvalue != null && (bool)lvalue) return true;
+
+            object rvalue = Right.Evaluate(message);
+            return rvalue == null ? null : rvalue;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ParseException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ParseException.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ParseException.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ParseException.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,197 @@
+/* Generated By:CSharpCC: Do not edit this line. ParseException.cs Version 3.2 */
+/// <summary>
+/// This exception is thrown when parse errors are encountered.
+/// </summary>
+/// <remarks>
+/// You can explicitly create objects of this exception type by
+/// calling the method GenerateParseException in the generated
+/// parser.
+/// <para>
+/// You can modify this class to customize your error reporting
+/// mechanisms so long as you retain the public fields.
+/// </para>
+/// </remarks>
+public  class ParseException : System.Exception {
+
+  /**
+   * This constructor is used by the method "GenerateParseException"
+   * in the generated parser. Calling this constructor generates
+   * a new object of this type with the fields "currentToken",
+   * "expectedTokenSequences", and "tokenImage" set.  The boolean
+   * flag "specialConstructor" is also set to true to indicate that
+   * this constructor was used to create this object.
+   * This constructor calls its super class with the empty string
+   * to force the "toString" method of parent class "Throwable" to
+   * print the error message in the form:
+   *     ParseException: result of getMessage
+   */
+  public ParseException(Token currentTokenVal,
+                        int[][] expectedTokenSequencesVal,
+                        string[] tokenImageVal
+                       ) : base("") {
+    specialConstructor = true;
+    currentToken = currentTokenVal;
+    expectedTokenSequences = expectedTokenSequencesVal;
+    tokenImage = tokenImageVal;
+  }
+
+  /**
+   * The following constructors are for use by you for whatever
+   * purpose you can think of.  Constructing the exception in this
+   * manner makes the exception behave in the normal way - i.e., as
+   * documented in the class "Exception".  The fields "errorToken",
+   * "expectedTokenSequences", and "tokenImage" do not contain
+   * relevant information.  The CSharpCC generated code does not use
+   * these constructors.
+   */
+
+  public ParseException() :
+    base() {
+    specialConstructor = false;
+  }
+
+  public ParseException(string message) :
+    base(message) {
+    specialConstructor = false;
+  }
+
+  /**
+   * This variable determines which constructor was used to create
+   * this object and thereby affects the semantics of the
+   * "getMessage" method (see below).
+   */
+  protected bool specialConstructor;
+
+  /**
+   * This is the last token that has been consumed successfully.  If
+   * this object has been created due to a parse error, the token
+   * followng this token will (therefore) be the first error token.
+   */
+  public Token currentToken;
+
+  /**
+   * Each entry in this array is an array of integers.  Each array
+   * of integers represents a sequence of tokens (by their ordinal
+   * values) that is expected at this point of the parse.
+   */
+  public int[][] expectedTokenSequences;
+
+  /**
+   * This is a reference to the "tokenImage" array of the generated
+   * parser within which the parse error occurred.  This array is
+   * defined in the generated ...Constants interface.
+   */
+  public string[] tokenImage;
+
+  /**
+   * This method has the standard behavior when this object has been
+   * created using the standard constructors.  Otherwise, it uses
+   * "currentToken" and "expectedTokenSequences" to generate a parse
+   * error message and returns it.  If this object has been created
+   * due to a parse error, and you do not catch it (it gets thrown
+   * from the parser), then this method is called during the printing
+   * of the final stack trace, and hence the correct error message
+   * gets displayed.
+   */
+  public override string Message {
+    get {
+      if (!specialConstructor) {
+        return base.Message;
+      }
+      string expected = "";
+      int maxSize = 0;
+      for (int i = 0; i < expectedTokenSequences.Length; i++) {
+        if (maxSize < expectedTokenSequences[i].Length) {
+          maxSize = expectedTokenSequences[i].Length;
+        }
+        for (int j = 0; j < expectedTokenSequences[i].Length; j++) {
+          expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+        }
+        if (expectedTokenSequences[i][expectedTokenSequences[i].Length - 1] != 0) {
+          expected += "...";
+        }
+        expected += eol + "    ";
+      }
+      string retval = "Encountered \"";
+      Token tok = currentToken.next;
+      for (int i = 0; i < maxSize; i++) {
+        if (i != 0) retval += " ";
+        if (tok.kind == 0) {
+          retval += tokenImage[0];
+          break;
+        }
+        retval += AddEscapes(tok.image);
+        tok = tok.next; 
+      }
+      if (currentToken.next.kind == 0) {
+        retval += "\" after line ";
+      } else {
+        retval += "\" at line ";
+      }
+      retval += currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+      retval += "." + eol;
+      if (expectedTokenSequences.Length == 1) {
+        retval += "Was expecting:" + eol + "    ";
+      } else {
+        retval += "Was expecting one of:" + eol + "    ";
+      }
+      retval += expected;
+      return retval;
+    }
+  }
+
+  /**
+   * The end of line string for this machine.
+   */
+  protected string eol = System.Environment.NewLine;
+ 
+  /**
+   * Used to convert raw characters to their escaped version
+   * when these raw version cannot be used as part of an ASCII
+   * string literal.
+   */
+  protected string AddEscapes(string str) {
+      System.Text.StringBuilder retval = new System.Text.StringBuilder();
+      char ch;
+      for (int i = 0; i < str.Length; i++) {
+        switch (str[i]) {
+           case '\0' :
+              continue;
+           case '\b':
+              retval.Append("\\b");
+              continue;
+           case '\t':
+              retval.Append("\\t");
+              continue;
+           case '\n':
+              retval.Append("\\n");
+              continue;
+           case '\f':
+              retval.Append("\\f");
+              continue;
+           case '\r':
+              retval.Append("\\r");
+              continue;
+           case '\"':
+              retval.Append("\\\"");
+              continue;
+           case '\'':
+              retval.Append("\\\'");
+              continue;
+           case '\\':
+              retval.Append("\\\\");
+              continue;
+           default:
+              if ((ch = str[i]) < 0x20 || ch > 0x7e) {
+                 string s = "0000" + System.Convert.ToString((int)ch, 16);
+                 retval.Append("\\u" + s.Substring(s.Length - 4, s.Length - (s.Length - 4)));
+              } else {
+                 retval.Append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.ToString();
+   }
+
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PlusExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PlusExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PlusExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PlusExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,68 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// A filter performing an addition of two expressions.
+    /// </summary>
+    public class PlusExpression : ArithmeticExpression
+    {
+        protected override string ExpressionSymbol
+        {
+            get { return "+"; }
+        }
+
+        public PlusExpression(IExpression left, IExpression right)
+            : base(left, right)
+        {
+        }
+
+        public override object Evaluate(MessageEvaluationContext message)
+        {
+            object lvalue = Left.Evaluate(message);
+            if(lvalue == null) return null;
+
+            object rvalue = Right.Evaluate(message);
+            if(lvalue is string) return (string)lvalue + rvalue;
+            if(rvalue == null) return null;
+
+            AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
+
+            object result = null;
+
+            switch(values.TypeEnum)
+            {
+                case AlignedNumericValues.T.SByteType : result = (sbyte )values.Left + (sbyte )values.Right; break;
+                case AlignedNumericValues.T.ByteType  : result = (byte  )values.Left + (byte  )values.Right; break;
+                case AlignedNumericValues.T.CharType  : result = (char  )values.Left + (char  )values.Right; break;
+                case AlignedNumericValues.T.ShortType : result = (short )values.Left + (short )values.Right; break;
+                case AlignedNumericValues.T.UShortType: result = (ushort)values.Left + (ushort)values.Right; break;
+                case AlignedNumericValues.T.IntType   : result = (int   )values.Left + (int   )values.Right; break;
+                case AlignedNumericValues.T.UIntType  : result = (uint  )values.Left + (uint  )values.Right; break;
+                case AlignedNumericValues.T.LongType  : result = (long  )values.Left + (long  )values.Right; break;
+                case AlignedNumericValues.T.ULongType : result = (ulong )values.Left + (ulong )values.Right; break;
+                case AlignedNumericValues.T.FloatType : result = (float )values.Left + (float )values.Right; break;
+                case AlignedNumericValues.T.DoubleType: result = (double)values.Left + (double)values.Right; break;
+            }
+
+            return result;
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PropertyExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PropertyExpression.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PropertyExpression.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/PropertyExpression.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,53 @@
+using System;
+/**
+ *
+ * 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.
+ */
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// Represents a property expression.
+    /// </summary>
+    public class PropertyExpression : IExpression
+    {
+        private string name;
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public PropertyExpression(string name)
+        {
+            this.name = name;
+        }
+
+        public object Evaluate(MessageEvaluationContext message)
+        {
+            return message.GetProperty(name);
+        }
+
+        public override string ToString()
+        {
+            return name;
+        }
+
+        public override int GetHashCode()
+        {
+            return name.GetHashCode();
+        }
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,1172 @@
+/* Generated By:CSharpCC: Do not edit this line. SelectorParser.cs */
+/**
+ *
+ * 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.
+ */
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+using Apache.NMS;
+
+namespace Apache.NMS.Selector
+{
+    /// <summary>
+    /// JMS Selector Parser generated by <a href="https://github.com/deveel/csharpcc">CSharpCC</a>
+    /// 
+    /// Do not edit this .cs file directly - it is autogenerated from SelectorParser.csc
+    /// using <c>csharpcc.exe -UNICODE_INPUT=true SelectorParser.csc</c>.
+    /// 
+    /// SelectorParser.csc is adapted from
+    /// <a href="https://raw.githubusercontent.com/apache/activemq/activemq-4.0/activemq-core/src/main/grammar/SelectorParser.jj">
+    /// ActiveMQ 4.0 SelectorParser.jj</a>
+    /// </summary>
+    public class SelectorParser : SelectorParserConstants {
+
+        public SelectorParser()
+            : this(new StringReader(""))
+        {
+        }
+
+        public IBooleanExpression Parse(string selector)
+        {
+            this.ReInit(new StringReader(selector));
+
+            try
+            {
+                return this.JmsSelector();
+            }
+            catch(Exception e)
+            {
+                    throw new InvalidSelectorException(selector, e);
+            }
+        }
+
+        private IBooleanExpression AsBooleanExpression(IExpression value)
+        {
+            if(value is IBooleanExpression)
+            {
+                return (IBooleanExpression)value;
+            }
+            if(value is PropertyExpression)
+            {
+                return UnaryExpression.CreateBooleanCast(value);
+            }
+            throw new ParseException("IExpression will not result in a boolean value: " + value);
+        }
+
+// ----------------------------------------------------------------------------
+// Grammar
+// ----------------------------------------------------------------------------
+  public IBooleanExpression JmsSelector() {
+    IExpression left = null;
+    left = GetOrExpression();
+        {return AsBooleanExpression(left);}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetOrExpression() {
+    IExpression left;
+    IExpression right;
+    left = GetAndExpression();
+    while (true) {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case OR:
+        ;
+        break;
+      default:
+        goto label_1;
+      }
+      mcc_consume_token(OR);
+      right = GetAndExpression();
+                left = LogicExpression.CreateOR(AsBooleanExpression(left), AsBooleanExpression(right));
+    }label_1: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetAndExpression() {
+    IExpression left;
+    IExpression right;
+    left = GetEqualityExpression();
+    while (true) {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case AND:
+        ;
+        break;
+      default:
+        goto label_2;
+      }
+      mcc_consume_token(AND);
+      right = GetEqualityExpression();
+                left = LogicExpression.CreateAND(AsBooleanExpression(left), AsBooleanExpression(right));
+    }label_2: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetEqualityExpression() {
+    IExpression left;
+    IExpression right;
+    left = GetComparisonExpression();
+    while (true) {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case IS:
+      case 28:
+      case 29:
+        ;
+        break;
+      default:
+        goto label_3;
+      }
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 28:
+        mcc_consume_token(28);
+        right = GetComparisonExpression();
+                left = ComparisonExpression.CreateEqual(left, right);
+        break;
+      case 29:
+        mcc_consume_token(29);
+        right = GetComparisonExpression();
+                left = ComparisonExpression.CreateNotEqual(left, right);
+        break;
+      default:
+        if (mcc_2_1(2)) {
+          mcc_consume_token(IS);
+          mcc_consume_token(NULL);
+                left = ComparisonExpression.CreateIsNull(left);
+        } else {
+          switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+          case IS:
+            mcc_consume_token(IS);
+            mcc_consume_token(NOT);
+            mcc_consume_token(NULL);
+                left = ComparisonExpression.CreateIsNotNull(left);
+            break;
+          default:
+            mcc_consume_token(-1);
+            throw new ParseException();
+          }
+        }
+        break;
+      }
+    }label_3: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetComparisonExpression() {
+    IExpression left;
+    IExpression right;
+    IExpression low;
+    IExpression high;
+    string t;
+    string u;
+        ArrayList list;
+    left = GetAddExpression();
+    while (true) {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case NOT:
+      case BETWEEN:
+      case LIKE:
+      case IN:
+      case 30:
+      case 31:
+      case 32:
+      case 33:
+        ;
+        break;
+      default:
+        goto label_4;
+      }
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 30:
+        mcc_consume_token(30);
+        right = GetAddExpression();
+                    left = ComparisonExpression.CreateGreaterThan(left, right);
+        break;
+      case 31:
+        mcc_consume_token(31);
+        right = GetAddExpression();
+                    left = ComparisonExpression.CreateGreaterThanOrEqual(left, right);
+        break;
+      case 32:
+        mcc_consume_token(32);
+        right = GetAddExpression();
+                    left = ComparisonExpression.CreateLesserThan(left, right);
+        break;
+      case 33:
+        mcc_consume_token(33);
+        right = GetAddExpression();
+                    left = ComparisonExpression.CreateLesserThanOrEqual(left, right);
+        break;
+      case LIKE:
+                                        u = null;
+        mcc_consume_token(LIKE);
+        t = GetStringLitteral();
+        switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+        case ESCAPE:
+          mcc_consume_token(ESCAPE);
+          u = GetStringLitteral();
+          break;
+        default:
+          ;
+          break;
+        }
+                    left = ComparisonExpression.CreateLike(left, t, u);
+        break;
+      default:
+        if (mcc_2_2(2)) {
+                                        u=null;
+          mcc_consume_token(NOT);
+          mcc_consume_token(LIKE);
+          t = GetStringLitteral();
+          switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+          case ESCAPE:
+            mcc_consume_token(ESCAPE);
+            u = GetStringLitteral();
+            break;
+          default:
+            ;
+            break;
+          }
+                    left = ComparisonExpression.CreateNotLike(left, t, u);
+        } else {
+          switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+          case BETWEEN:
+            mcc_consume_token(BETWEEN);
+            low = GetAddExpression();
+            mcc_consume_token(AND);
+            high = GetAddExpression();
+                                        left = ComparisonExpression.CreateBetween(left, low, high);
+            break;
+          default:
+            if (mcc_2_3(2)) {
+              mcc_consume_token(NOT);
+              mcc_consume_token(BETWEEN);
+              low = GetAddExpression();
+              mcc_consume_token(AND);
+              high = GetAddExpression();
+                                        left = ComparisonExpression.CreateNotBetween(left, low, high);
+            } else {
+              switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+              case IN:
+                mcc_consume_token(IN);
+                mcc_consume_token(34);
+                t = GetStringLitteral();
+                                    list = new ArrayList();
+                                    list.Add(t);
+                while (true) {
+                  switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+                  case 35:
+                    ;
+                    break;
+                  default:
+                    goto label_5;
+                  }
+                  mcc_consume_token(35);
+                  t = GetStringLitteral();
+                                            list.Add(t);
+                }label_5: ;
+                
+                mcc_consume_token(36);
+                           left = ComparisonExpression.CreateIn(left, list);
+                break;
+              default:
+                if (mcc_2_4(2)) {
+                  mcc_consume_token(NOT);
+                  mcc_consume_token(IN);
+                  mcc_consume_token(34);
+                  t = GetStringLitteral();
+                                    list = new ArrayList();
+                                    list.Add(t);
+                  while (true) {
+                    switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+                    case 35:
+                      ;
+                      break;
+                    default:
+                      goto label_6;
+                    }
+                    mcc_consume_token(35);
+                    t = GetStringLitteral();
+                                            list.Add(t);
+                  }label_6: ;
+                  
+                  mcc_consume_token(36);
+                           left = ComparisonExpression.CreateNotIn(left, list);
+                } else {
+                  mcc_consume_token(-1);
+                  throw new ParseException();
+                }
+                break;
+              }
+            }
+            break;
+          }
+        }
+        break;
+      }
+    }label_4: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetAddExpression() {
+    IExpression left;
+    IExpression right;
+    left = GetMultiplyExpression();
+    while (true) {
+      if (mcc_2_5(2147483647)) {
+        ;
+      } else {
+        goto label_7;
+      }
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 37:
+        mcc_consume_token(37);
+        right = GetMultiplyExpression();
+                    left = ArithmeticExpression.CreatePlus(left, right);
+        break;
+      case 38:
+        mcc_consume_token(38);
+        right = GetMultiplyExpression();
+                    left = ArithmeticExpression.CreateMinus(left, right);
+        break;
+      default:
+        mcc_consume_token(-1);
+        throw new ParseException();
+      }
+    }label_7: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetMultiplyExpression() {
+    IExpression left;
+    IExpression right;
+    left = GetUnaryExpression();
+    while (true) {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 39:
+      case 40:
+      case 41:
+        ;
+        break;
+      default:
+        goto label_8;
+      }
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 39:
+        mcc_consume_token(39);
+        right = GetUnaryExpression();
+                left = ArithmeticExpression.CreateMultiply(left, right);
+        break;
+      case 40:
+        mcc_consume_token(40);
+        right = GetUnaryExpression();
+                left = ArithmeticExpression.CreateDivide(left, right);
+        break;
+      case 41:
+        mcc_consume_token(41);
+        right = GetUnaryExpression();
+                left = ArithmeticExpression.CreateMod(left, right);
+        break;
+      default:
+        mcc_consume_token(-1);
+        throw new ParseException();
+      }
+    }label_8: ;
+    
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetUnaryExpression() {
+    IExpression left = null;
+    if (mcc_2_6(2147483647)) {
+      mcc_consume_token(37);
+      left = GetUnaryExpression();
+    } else {
+      switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+      case 38:
+        mcc_consume_token(38);
+        left = GetUnaryExpression();
+                left = UnaryExpression.CreateNegate(left);
+        break;
+      case NOT:
+        mcc_consume_token(NOT);
+        left = GetUnaryExpression();
+                    left = UnaryExpression.CreateNOT(AsBooleanExpression(left));
+        break;
+      case TRUE:
+      case FALSE:
+      case NULL:
+      case DECIMAL_LITERAL:
+      case HEX_LITERAL:
+      case OCTAL_LITERAL:
+      case FLOATING_POINT_LITERAL:
+      case STRING_LITERAL:
+      case ID:
+      case 34:
+        left = GetPrimaryExpression();
+        break;
+      default:
+        mcc_consume_token(-1);
+        throw new ParseException();
+      }
+    }
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public IExpression GetPrimaryExpression() {
+    IExpression left = null;
+    switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+    case TRUE:
+    case FALSE:
+    case NULL:
+    case DECIMAL_LITERAL:
+    case HEX_LITERAL:
+    case OCTAL_LITERAL:
+    case FLOATING_POINT_LITERAL:
+    case STRING_LITERAL:
+      left = GetLiteral();
+      break;
+    case ID:
+      left = GetVariable();
+      break;
+    case 34:
+      mcc_consume_token(34);
+      left = GetOrExpression();
+      mcc_consume_token(36);
+      break;
+    default:
+      mcc_consume_token(-1);
+      throw new ParseException();
+    }
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public ConstantExpression GetLiteral() {
+    Token t;
+    string s;
+    ConstantExpression left = null;
+    switch ((mcc_ntk==-1)?mcc_mntk():mcc_ntk) {
+    case STRING_LITERAL:
+      s = GetStringLitteral();
+                left = new ConstantExpression(s);
+      break;
+    case DECIMAL_LITERAL:
+      t = mcc_consume_token(DECIMAL_LITERAL);
+                left = ConstantExpression.CreateFromDecimal(t.image);
+      break;
+    case HEX_LITERAL:
+      t = mcc_consume_token(HEX_LITERAL);
+                left = ConstantExpression.CreateFromHex(t.image);
+      break;
+    case OCTAL_LITERAL:
+      t = mcc_consume_token(OCTAL_LITERAL);
+                left = ConstantExpression.CreateFromOctal(t.image);
+      break;
+    case FLOATING_POINT_LITERAL:
+      t = mcc_consume_token(FLOATING_POINT_LITERAL);
+                left = ConstantExpression.CreateFloat(t.image);
+      break;
+    case TRUE:
+      mcc_consume_token(TRUE);
+                left = ConstantExpression.TRUE;
+      break;
+    case FALSE:
+      mcc_consume_token(FALSE);
+                left = ConstantExpression.FALSE;
+      break;
+    case NULL:
+      mcc_consume_token(NULL);
+                left = ConstantExpression.NULL;
+      break;
+    default:
+      mcc_consume_token(-1);
+      throw new ParseException();
+    }
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public string GetStringLitteral() {
+    Token t;
+    StringBuilder rc = new StringBuilder();
+    t = mcc_consume_token(STRING_LITERAL);
+        // Decode the sting value.
+        String image = t.image;
+        for(int c = 1; c < image.Length - 1; c++)
+        {
+                char ch = image[c];
+                if(ch == '\'')
+            {
+                        c++;
+            }
+                        rc.Append(ch);
+        }
+            {return rc.ToString();}
+    throw new Exception("Missing return statement in function");
+  }
+
+  public PropertyExpression GetVariable() {
+    Token t;
+    PropertyExpression left = null;
+    t = mcc_consume_token(ID);
+            left = new PropertyExpression(t.image);
+        {return left;}
+    throw new Exception("Missing return statement in function");
+  }
+
+  private bool mcc_2_1(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_1(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_2_2(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_2(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_2_3(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_3(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_2_4(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_4(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_2_5(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_5(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_2_6(int xla) {
+    mcc_la = xla; mcc_lastpos = mcc_scanpos = token;
+    try { return !mcc_3_6(); }
+    catch(LookaheadSuccess) { return true; }
+  }
+
+  private bool mcc_3R_57() {
+    if (mcc_scan_token(ESCAPE)) return true;
+    if (mcc_3R_36()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_19() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_20()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_21()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_22()) return true;
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_39() {
+    if (mcc_3R_41()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_42()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3_4() {
+    if (mcc_scan_token(NOT)) return true;
+    if (mcc_scan_token(IN)) return true;
+    if (mcc_scan_token(34)) return true;
+    if (mcc_3R_36()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_59()) { mcc_scanpos = xsp; break; }
+    }
+    if (mcc_scan_token(36)) return true;
+    return false;
+  }
+
+  private bool mcc_3_6() {
+    if (mcc_scan_token(37)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_15() {
+    if (mcc_3R_19()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_36() {
+    if (mcc_scan_token(STRING_LITERAL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_14() {
+    if (mcc_scan_token(NOT)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_12() {
+    if (mcc_scan_token(37)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_53() {
+    if (mcc_scan_token(IN)) return true;
+    if (mcc_scan_token(34)) return true;
+    if (mcc_3R_36()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_58()) { mcc_scanpos = xsp; break; }
+    }
+    if (mcc_scan_token(36)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_45() {
+    if (mcc_scan_token(IS)) return true;
+    if (mcc_scan_token(NOT)) return true;
+    if (mcc_scan_token(NULL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_13() {
+    if (mcc_scan_token(38)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_33() {
+    if (mcc_scan_token(NULL)) return true;
+    return false;
+  }
+
+  private bool mcc_3_1() {
+    if (mcc_scan_token(IS)) return true;
+    if (mcc_scan_token(NULL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_10() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_12()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_13()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_14()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_15()) return true;
+    }
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_44() {
+    if (mcc_scan_token(29)) return true;
+    if (mcc_3R_39()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_32() {
+    if (mcc_scan_token(FALSE)) return true;
+    return false;
+  }
+
+  private bool mcc_3_3() {
+    if (mcc_scan_token(NOT)) return true;
+    if (mcc_scan_token(BETWEEN)) return true;
+    if (mcc_3R_41()) return true;
+    if (mcc_scan_token(AND)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_43() {
+    if (mcc_scan_token(28)) return true;
+    if (mcc_3R_39()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_40() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_43()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_44()) {
+    mcc_scanpos = xsp;
+    if (mcc_3_1()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_45()) return true;
+    }
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_52() {
+    if (mcc_scan_token(BETWEEN)) return true;
+    if (mcc_3R_41()) return true;
+    if (mcc_scan_token(AND)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_31() {
+    if (mcc_scan_token(TRUE)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_56() {
+    if (mcc_scan_token(ESCAPE)) return true;
+    if (mcc_3R_36()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_18() {
+    if (mcc_scan_token(41)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_30() {
+    if (mcc_scan_token(FLOATING_POINT_LITERAL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_37() {
+    if (mcc_3R_39()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_40()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3_2() {
+    if (mcc_scan_token(NOT)) return true;
+    if (mcc_scan_token(LIKE)) return true;
+    if (mcc_3R_36()) return true;
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_57()) mcc_scanpos = xsp;
+    return false;
+  }
+
+  private bool mcc_3R_51() {
+    if (mcc_scan_token(LIKE)) return true;
+    if (mcc_3R_36()) return true;
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_56()) mcc_scanpos = xsp;
+    return false;
+  }
+
+  private bool mcc_3R_17() {
+    if (mcc_scan_token(40)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_29() {
+    if (mcc_scan_token(OCTAL_LITERAL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_16() {
+    if (mcc_scan_token(39)) return true;
+    if (mcc_3R_10()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_11() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_16()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_17()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_18()) return true;
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_38() {
+    if (mcc_scan_token(AND)) return true;
+    if (mcc_3R_37()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_28() {
+    if (mcc_scan_token(HEX_LITERAL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_9() {
+    if (mcc_3R_10()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_11()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_27() {
+    if (mcc_scan_token(DECIMAL_LITERAL)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_55() {
+    if (mcc_scan_token(38)) return true;
+    if (mcc_3R_9()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_34() {
+    if (mcc_3R_37()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_38()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3_5() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_scan_token(37)) {
+    mcc_scanpos = xsp;
+    if (mcc_scan_token(38)) return true;
+    }
+    if (mcc_3R_9()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_50() {
+    if (mcc_scan_token(33)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_54() {
+    if (mcc_scan_token(37)) return true;
+    if (mcc_3R_9()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_26() {
+    if (mcc_3R_36()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_49() {
+    if (mcc_scan_token(32)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_59() {
+    if (mcc_scan_token(35)) return true;
+    if (mcc_3R_36()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_46() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_54()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_55()) return true;
+    }
+    return false;
+  }
+
+  private bool mcc_3R_35() {
+    if (mcc_scan_token(OR)) return true;
+    if (mcc_3R_34()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_23() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_26()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_27()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_28()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_29()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_30()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_31()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_32()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_33()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_48() {
+    if (mcc_scan_token(31)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_24() {
+    if (mcc_scan_token(ID)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_47() {
+    if (mcc_scan_token(30)) return true;
+    if (mcc_3R_41()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_42() {
+    Token xsp;
+    xsp = mcc_scanpos;
+    if (mcc_3R_47()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_48()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_49()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_50()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_51()) {
+    mcc_scanpos = xsp;
+    if (mcc_3_2()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_52()) {
+    mcc_scanpos = xsp;
+    if (mcc_3_3()) {
+    mcc_scanpos = xsp;
+    if (mcc_3R_53()) {
+    mcc_scanpos = xsp;
+    if (mcc_3_4()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_41() {
+    if (mcc_3R_9()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_46()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_25() {
+    if (mcc_3R_34()) return true;
+    Token xsp;
+    while (true) {
+      xsp = mcc_scanpos;
+      if (mcc_3R_35()) { mcc_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private bool mcc_3R_22() {
+    if (mcc_scan_token(34)) return true;
+    if (mcc_3R_25()) return true;
+    if (mcc_scan_token(36)) return true;
+    return false;
+  }
+
+  private bool mcc_3R_21() {
+    if (mcc_3R_24()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_20() {
+    if (mcc_3R_23()) return true;
+    return false;
+  }
+
+  private bool mcc_3R_58() {
+    if (mcc_scan_token(35)) return true;
+    if (mcc_3R_36()) return true;
+    return false;
+  }
+
+  public SelectorParserTokenManager token_source;
+  SimpleCharStream mcc_input_stream;
+  public Token token, mcc_nt;
+  private int mcc_ntk;
+  private Token mcc_scanpos, mcc_lastpos;
+  private int mcc_la;
+  public bool lookingAhead = false;
+  //private bool mcc_semLA;
+
+  public SelectorParser(System.IO.Stream stream) {
+    mcc_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new SelectorParserTokenManager(mcc_input_stream);
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+  public void ReInit(System.IO.Stream stream) {
+    mcc_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(mcc_input_stream);
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+  public SelectorParser(System.IO.TextReader stream) {
+    mcc_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new SelectorParserTokenManager(mcc_input_stream);
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+  public void ReInit(System.IO.TextReader stream) {
+    mcc_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(mcc_input_stream);
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+  public SelectorParser(SelectorParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+  public void ReInit(SelectorParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    mcc_ntk = -1;
+  }
+
+   private Token mcc_consume_token(int kind) {
+    Token oldToken = null;
+    if ((oldToken = token).next != null) token = token.next;
+    else token = token.next = token_source.GetNextToken();
+    mcc_ntk = -1;
+    if (token.kind == kind) {
+      return token;
+    }
+    token = oldToken;
+    throw GenerateParseException();
+  }
+
+  private class LookaheadSuccess : System.Exception { }
+  private LookaheadSuccess mcc_ls = new LookaheadSuccess();
+  private bool mcc_scan_token(int kind) {
+    if (mcc_scanpos == mcc_lastpos) {
+      mcc_la--;
+      if (mcc_scanpos.next == null) {
+        mcc_lastpos = mcc_scanpos = mcc_scanpos.next = token_source.GetNextToken();
+      } else {
+        mcc_lastpos = mcc_scanpos = mcc_scanpos.next;
+      }
+    } else {
+      mcc_scanpos = mcc_scanpos.next;
+    }
+    if (mcc_scanpos.kind != kind) return true;
+    if (mcc_la == 0 && mcc_scanpos == mcc_lastpos) throw mcc_ls;
+    return false;
+  }
+
+  public Token GetNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.GetNextToken();
+    mcc_ntk = -1;
+    return token;
+  }
+
+  public Token GetToken(int index) {
+    Token t = lookingAhead ? mcc_scanpos : token;
+    for (int i = 0; i < index; i++) {
+      if (t.next != null) t = t.next;
+      else t = t.next = token_source.GetNextToken();
+    }
+    return t;
+  }
+
+  private int mcc_mntk() {
+    if ((mcc_nt=token.next) == null)
+      return (mcc_ntk = (token.next=token_source.GetNextToken()).kind);
+    else
+      return (mcc_ntk = mcc_nt.kind);
+  }
+
+  public ParseException GenerateParseException() {
+    Token errortok = token.next;
+    int line = errortok.beginLine, column = errortok.beginColumn;
+    string mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
+    return new ParseException("Parse error at line " + line + ", column " + column + ".  Encountered: " + mess);
+  }
+
+  public void enable_tracing() {
+  }
+
+  public void disable_tracing() {
+  }
+
+}
+
+}
\ No newline at end of file

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.csc
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.csc?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.csc (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParser.csc Thu Jul  7 20:47:10 2016
@@ -0,0 +1,589 @@
+/**
+ *
+ * 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.
+ */
+
+// ----------------------------------------------------------------------------
+// OPTIONS
+// ----------------------------------------------------------------------------
+options {
+  STATIC = false;
+  UNICODE_INPUT = true;
+  
+  // some performance optimizations
+  OPTIMIZE_TOKEN_MANAGER = true;
+  ERROR_REPORTING = false;
+}
+
+// ----------------------------------------------------------------------------
+// PARSER
+// ----------------------------------------------------------------------------
+
+PARSER_BEGIN(SelectorParser)
+/**
+ *
+ * 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.
+ */
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+using Apache.NMS;
+
+//namespace Apache.NMS.Selector
+//{
+    /// <summary>
+    /// JMS Selector Parser generated by <a href="https://github.com/deveel/csharpcc">CSharpCC</a>
+    /// 
+    /// Do not edit this .cs file directly - it is autogenerated from SelectorParser.csc
+    /// using <c>csharpcc.exe -UNICODE_INPUT=true SelectorParser.csc</c>.
+    /// 
+    /// SelectorParser.csc is adapted from
+    /// <a href="https://raw.githubusercontent.com/apache/activemq/activemq-4.0/activemq-core/src/main/grammar/SelectorParser.jj">
+    /// ActiveMQ 4.0 SelectorParser.jj</a>
+    /// </summary>
+    public class SelectorParser
+    {
+
+        public SelectorParser()
+        {
+        }
+
+        public IBooleanExpression Parse(string selector)
+        {
+            this.ReInit(new StringReader(selector));
+
+            try
+            {
+                return this.JmsSelector();
+            } 
+            catch(Exception e)
+            {
+	            throw new InvalidSelectorException(selector, e);
+            }
+        }
+
+        private IBooleanExpression AsBooleanExpression(IExpression value)
+        {
+            if(value is IBooleanExpression)
+            {
+                return (IBooleanExpression)value;
+            }
+            if(value is PropertyExpression)
+            {
+                return UnaryExpression.CreateBooleanCast(value);
+            }
+            throw new ParseException("IExpression will not result in a boolean value: " + value);
+        }
+    }
+
+//}
+
+PARSER_END(SelectorParser)
+
+// ----------------------------------------------------------------------------
+// Tokens
+// ----------------------------------------------------------------------------
+
+/* White Space */
+SPECIAL_TOKEN :
+{
+  " " | "\t" | "\n" | "\r" | "\f"
+}
+
+/* Comments */
+SKIP:
+{
+  <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
+}
+
+SKIP:
+{
+  <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
+}
+
+/* Reserved Words */
+TOKEN [IGNORE_CASE] :
+{
+    <  NOT     : "NOT">
+  | <  AND     : "AND">
+  | <  OR      : "OR">
+  | <  BETWEEN : "BETWEEN">
+  | <  LIKE    : "LIKE">
+  | <  ESCAPE  : "ESCAPE">
+  | <  IN      : "IN">
+  | <  IS      : "IS">
+  | <  TRUE    : "TRUE" >
+  | <  FALSE   : "FALSE" >
+  | <  NULL    : "NULL" >
+  | <  XPATH   : "XPATH" >
+  | <  XQUERY  : "XQUERY" >
+}
+
+/* Literals */
+TOKEN [IGNORE_CASE] :
+{
+
+    < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
+  | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+  | < OCTAL_LITERAL: "0" (["0"-"7"])* >  
+  | < FLOATING_POINT_LITERAL:  		  
+          (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
+        | "." (["0"-"9"])+ (<EXPONENT>)?              // matches: .5 or .5E10
+        | (["0"-"9"])+ <EXPONENT>                     // matches: 5E10
+    >
+  | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
+  | < STRING_LITERAL: "'" ( ("''") | ~["'"] )*  "'" >
+}
+
+TOKEN [IGNORE_CASE] :
+{
+    < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
+}
+
+// ----------------------------------------------------------------------------
+// Grammar
+// ----------------------------------------------------------------------------
+IBooleanExpression JmsSelector() :
+{
+    IExpression left = null;
+}
+{
+    (
+        left = GetOrExpression()
+    ) 
+    {
+        return AsBooleanExpression(left);
+    }
+
+}
+
+IExpression GetOrExpression() :
+{
+    IExpression left;
+    IExpression right;
+}
+{
+    (
+        left = GetAndExpression() 
+        ( 
+            <OR> right = GetAndExpression() 
+            {
+                left = LogicExpression.CreateOR(AsBooleanExpression(left), AsBooleanExpression(right));
+            }
+        )*
+    ) 
+    {
+        return left;
+    }
+
+}
+
+
+IExpression GetAndExpression() :
+{
+    IExpression left;
+    IExpression right;
+}
+{
+    (
+        left = GetEqualityExpression() 
+        ( 
+            <AND> right = GetEqualityExpression() 
+            {
+                left = LogicExpression.CreateAND(AsBooleanExpression(left), AsBooleanExpression(right));
+            }
+        )*
+    ) 
+    {
+        return left;
+    }
+}
+
+IExpression GetEqualityExpression() :
+{
+    IExpression left;
+    IExpression right;
+}
+{
+    (
+        left = GetComparisonExpression() 
+        ( 
+            
+            "=" right = GetComparisonExpression() 
+            {
+                left = ComparisonExpression.CreateEqual(left, right);
+            }
+            |            
+            "<>" right = GetComparisonExpression() 
+            {
+                left = ComparisonExpression.CreateNotEqual(left, right);
+            }
+            |            
+            LOOKAHEAD(2)
+            <IS> <NULL>
+            {
+                left = ComparisonExpression.CreateIsNull(left);
+            }
+            |            
+            <IS> <NOT> <NULL>
+            {
+                left = ComparisonExpression.CreateIsNotNull(left);
+            }
+        )*
+    ) 
+    {
+        return left;
+    }
+}
+
+IExpression GetComparisonExpression() :
+{
+    IExpression left;
+    IExpression right;
+    IExpression low;
+    IExpression high;
+    string t;
+    string u;
+	ArrayList list;
+}
+{
+    (
+        left = GetAddExpression() 
+        ( 
+            
+                ">" right = GetAddExpression() 
+                {
+                    left = ComparisonExpression.CreateGreaterThan(left, right);
+                }
+            |            
+                ">=" right = GetAddExpression() 
+                {
+                    left = ComparisonExpression.CreateGreaterThanOrEqual(left, right);
+                }
+            |            
+                "<" right = GetAddExpression() 
+                {
+                    left = ComparisonExpression.CreateLesserThan(left, right);
+                }
+            |            
+                "<=" right = GetAddExpression() 
+                {
+                    left = ComparisonExpression.CreateLesserThanOrEqual(left, right);
+                }
+           |
+				{
+					u = null;
+				}           		
+		        <LIKE> t = GetStringLitteral() 
+		        	[ <ESCAPE> u = GetStringLitteral() ]
+		        {
+                    left = ComparisonExpression.CreateLike(left, t, u);
+		        }
+           |
+	        	LOOKAHEAD(2)
+				{
+					u=null;
+				}           		
+		        <NOT> <LIKE> t = GetStringLitteral() [ <ESCAPE> u = GetStringLitteral() ]
+		        {
+                    left = ComparisonExpression.CreateNotLike(left, t, u);
+		        }
+            |
+		        <BETWEEN> low = GetAddExpression() <AND> high = GetAddExpression()
+		        {
+					left = ComparisonExpression.CreateBetween(left, low, high);
+		        }
+	        |
+	        	LOOKAHEAD(2)
+		        <NOT> <BETWEEN> low = GetAddExpression() <AND> high = GetAddExpression()
+		        {
+					left = ComparisonExpression.CreateNotBetween(left, low, high);
+		        }
+            |
+				<IN> 
+		        "(" 
+		            t = GetStringLitteral()
+		            {
+			            list = new ArrayList();
+			            list.Add(t);
+		            }
+			        ( 
+			        	","
+			            t = GetStringLitteral() 
+			            {
+				            list.Add(t);
+			            }
+			        	
+			        )*
+		        ")"
+		        {
+		           left = ComparisonExpression.CreateIn(left, list);
+		        }
+            |
+	        	LOOKAHEAD(2)
+	            <NOT> <IN> 
+		        "(" 
+		            t = GetStringLitteral()
+		            {
+			            list = new ArrayList();
+			            list.Add(t);
+		            }
+			        ( 
+			        	","
+			            t = GetStringLitteral() 
+			            {
+				            list.Add(t);
+			            }
+			        	
+			        )*
+		        ")"
+		        {
+		           left = ComparisonExpression.CreateNotIn(left, list);
+		        }
+            
+        )*
+    ) 
+    {
+        return left;
+    }
+}
+
+IExpression GetAddExpression() :
+{
+    IExpression left;
+    IExpression right;
+}
+{
+    left = GetMultiplyExpression() 
+    ( 
+	    LOOKAHEAD( ("+"|"-") GetMultiplyExpression())
+	    (
+	        "+" right = GetMultiplyExpression() 
+	        {
+	            left = ArithmeticExpression.CreatePlus(left, right);
+	        }
+	        |            
+	        "-" right = GetMultiplyExpression() 
+	        {
+	            left = ArithmeticExpression.CreateMinus(left, right);
+	        }
+        )
+        
+    )*
+    {
+        return left;
+    }
+}
+
+IExpression GetMultiplyExpression() :
+{
+    IExpression left;
+    IExpression right;
+}
+{
+    left = GetUnaryExpression() 
+    ( 
+        "*" right = GetUnaryExpression() 
+        {
+	        left = ArithmeticExpression.CreateMultiply(left, right);
+        }
+        |            
+        "/" right = GetUnaryExpression() 
+        {
+	        left = ArithmeticExpression.CreateDivide(left, right);
+        }
+        |            
+        "%" right = GetUnaryExpression() 
+        {
+	        left = ArithmeticExpression.CreateMod(left, right);
+        }
+        
+    )*
+    {
+        return left;
+    }
+}
+
+
+IExpression GetUnaryExpression() :
+{
+    IExpression left = null;
+}
+{
+	(
+		LOOKAHEAD( "+" GetUnaryExpression() )
+	    "+" left = GetUnaryExpression()
+	    |
+	    "-" left = GetUnaryExpression()
+	    {
+	        left = UnaryExpression.CreateNegate(left);
+	    }
+	    |
+	    <NOT> left = GetUnaryExpression()
+	    {
+		    left = UnaryExpression.CreateNOT(AsBooleanExpression(left));
+	    }
+	    |
+	    left = GetPrimaryExpression()
+    )
+    {
+        return left;
+    }
+
+}
+
+IExpression GetPrimaryExpression() :
+{
+    IExpression left = null;
+}
+{
+    (
+        left = GetLiteral()
+        |
+        left = GetVariable()
+        |
+        "(" left = GetOrExpression() ")"
+    ) 
+    {
+        return left;
+    }
+}
+
+
+
+ConstantExpression GetLiteral() :
+{
+    Token t;
+    string s;
+    ConstantExpression left = null;
+}
+{
+    (
+        (
+            s = GetStringLitteral()
+            {
+                left = new ConstantExpression(s);
+            }
+        ) 
+        | 
+        (
+            t = <DECIMAL_LITERAL>
+            {
+            	left = ConstantExpression.CreateFromDecimal(t.image);
+            }    
+        ) 
+        | 
+        (
+            t = <HEX_LITERAL>
+            {
+            	left = ConstantExpression.CreateFromHex(t.image);
+            }    
+        ) 
+        | 
+        (
+            t = <OCTAL_LITERAL>
+            {
+            	left = ConstantExpression.CreateFromOctal(t.image);
+            }    
+        ) 
+        | 
+        (
+            t = <FLOATING_POINT_LITERAL>
+            {
+            	left = ConstantExpression.CreateFloat(t.image);
+            }    
+        ) 
+        | 
+        (
+            <TRUE>
+            {
+                left = ConstantExpression.TRUE;
+            }    
+        ) 
+        | 
+        (
+            <FALSE>
+            {
+                left = ConstantExpression.FALSE;
+            }    
+        ) 
+        | 
+        (
+            <NULL>
+            {
+                left = ConstantExpression.NULL;
+            }    
+        )
+    )
+    {
+        return left;
+    }
+}
+
+string GetStringLitteral() :
+{
+    Token t;
+    StringBuilder rc = new StringBuilder();
+}
+{
+    t = <STRING_LITERAL> 
+    {
+    	// Decode the sting value.
+    	String image = t.image;
+    	for(int c = 1; c < image.Length - 1; c++)
+        {
+    		char ch = image[c];
+    		if(ch == '\'')
+            {
+    			c++;    			
+            }
+   			rc.Append(ch);
+    	}
+	    return rc.ToString();
+    }    
+}
+
+PropertyExpression GetVariable() :
+{
+    Token t;
+    PropertyExpression left = null;
+}
+{
+    ( 
+        t = <ID> 
+        {
+            left = new PropertyExpression(t.image);
+        }    
+    )
+    {
+        return left;
+    }
+}

Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParserConstants.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParserConstants.cs?rev=1751831&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParserConstants.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/SelectorParserConstants.cs Thu Jul  7 20:47:10 2016
@@ -0,0 +1,75 @@
+/* Generated By:CSharpCC: Do not edit this line. SelectorParserConstants.cs */
+public  class SelectorParserConstants {
+
+  public const int EOF = 0;
+  public const int LINE_COMMENT = 6;
+  public const int BLOCK_COMMENT = 7;
+  public const int NOT = 8;
+  public const int AND = 9;
+  public const int OR = 10;
+  public const int BETWEEN = 11;
+  public const int LIKE = 12;
+  public const int ESCAPE = 13;
+  public const int IN = 14;
+  public const int IS = 15;
+  public const int TRUE = 16;
+  public const int FALSE = 17;
+  public const int NULL = 18;
+  public const int XPATH = 19;
+  public const int XQUERY = 20;
+  public const int DECIMAL_LITERAL = 21;
+  public const int HEX_LITERAL = 22;
+  public const int OCTAL_LITERAL = 23;
+  public const int FLOATING_POINT_LITERAL = 24;
+  public const int EXPONENT = 25;
+  public const int STRING_LITERAL = 26;
+  public const int ID = 27;
+
+  public const int DEFAULT = 0;
+
+  public readonly string[] tokenImage = {
+    "<EOF>",
+    "\" \"",
+    "\"\\t\"",
+    "\"\\n\"",
+    "\"\\r\"",
+    "\"\\f\"",
+    "<LINE_COMMENT>",
+    "<BLOCK_COMMENT>",
+    "\"NOT\"",
+    "\"AND\"",
+    "\"OR\"",
+    "\"BETWEEN\"",
+    "\"LIKE\"",
+    "\"ESCAPE\"",
+    "\"IN\"",
+    "\"IS\"",
+    "\"TRUE\"",
+    "\"FALSE\"",
+    "\"NULL\"",
+    "\"XPATH\"",
+    "\"XQUERY\"",
+    "<DECIMAL_LITERAL>",
+    "<HEX_LITERAL>",
+    "<OCTAL_LITERAL>",
+    "<FLOATING_POINT_LITERAL>",
+    "<EXPONENT>",
+    "<STRING_LITERAL>",
+    "<ID>",
+    "\"=\"",
+    "\"<>\"",
+    "\">\"",
+    "\">=\"",
+    "\"<\"",
+    "\"<=\"",
+    "\"(\"",
+    "\",\"",
+    "\")\"",
+    "\"+\"",
+    "\"-\"",
+    "\"*\"",
+    "\"/\"",
+    "\"%\"",
+  };
+
+}