This project has moved and is read-only. For the latest updates, please go here.

Parser does not report invalid escape sequence (StringLiteral.cs)


When using the ExpressionEvaluator, "\d" evaluates to d. However, I would expect the parser to report an error about an invalid escape sequence.

Proposed solution is to add a line to StringLiteral.ConvertValue(CompoundTokenDetails) that looks for an error after calling the HandleSpecilEscape method, and returns false if one is found:
      if (Escapes.TryGetValue(first, out newFirst))
        arr[i] = newFirst + s.Substring(1);
      else {
        arr[i] = HandleSpecialEscape(arr[i], details);
        if (!string.IsNullOrEmpty(details.Error)) return false; // <--- ADDED THIS LINE
    }//for i
    value = string.Join(string.Empty, arr);
  }// if EscapeEnabled 
Adding this line causes the parser to correctly report the "invalid escape sequence" error.