I improved the RegEx to allow arbitrary whitespace:

===================================================================
--- lps/components/debugger/debugger.lzx        (revision 11801)
+++ lps/components/debugger/debugger.lzx        (working copy)
@@ -261,7 +261,7 @@

<!-- Simple "path" expressions will only have symbols, `.`, or `[numbers]` -->
     <!-- @keywords private readonly -->
- <attribute name="SimpleExprPattern" value="$once{new RegExp('^([$_A-Za-z][$\\w]*)((\\.[$_A-Za-z][$\\w]*)|(\\[\\d+\\]))* $')}" /> + <attribute name="SimpleExprPattern" value="$once{new RegExp('^\ \s*([$_A-Za-z][$\\w]*)((\\s*\\.\\s*[$_A-Za-z][$\\w]*)|(\\s*\\[\\s*\\d+\ \s*\\]))*\\s*$')}" /> <!-- Now pull out just the element 'selectors', so you can walk down them -->
     <!-- @keywords private readonly -->
<attribute name="ElementPattern" value="$once{new RegExp('([$_A- Za-z][$\\w]*)|(\\d+)', 'g')}" />

On 2008-11-15, at 10:26EST, André Bargull wrote:

While testing, I've noticed you must not have leading or trailing whitespace in the expression, or the "SimpleExprPattern" will fail to match against the string. For instance in "canvas.subviews ".

Otherwise approved.


On 11/13/2008 2:37 PM, P T Withington wrote:
It's not meant to. I'm just trying to handle the simple "path" expressions you might type into the debug evaluator in order to inspect your application. I don't see any reason to need `canvas['subviews']` since the user can more easily say `canvas.subviews`.
On 2008-11-13, at 05:13EST, André Bargull wrote:
The RegExp fails for the bracket-notation, e.g. `canvas['subviews']`.

var re = new RegExp('^([$_A-Za-z][$\\w]*)((\\.[$_A-Za-z][$\\w]*)|(\ \[\\d+\\]))*$');
Debug.write(re.test("canvas['subviews']"))


On 11/13/2008 3:54 AM, P T Withington wrote:
Change 20081112-ptw-E by [EMAIL PROTECTED] on 2008-11-12 21:45:49 EST
  in /Users/ptw/OpenLaszlo/trunk
  for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Add a simple evaluator to the swf8/9 debugger

Bugs Fixed:
LPP-7271  swf9: exceptions running debugger in embedded HTML

Technical Reviewer: hminsky (pending)
QA Reviewer: [EMAIL PROTECTED] (pending)

Details:
  Added a simple evaluator that can evaluate globals, object member
  and array index expressions without having to invoke the server
  compiler (e.g., `canvas.subviews[0]`).  This will allow simple
  object inspection in the debugger in solo apps or apps deployed
  without the lps server; it will also speed up the evaluation of
  such simple expressions as the server will not be invoked to
  compile them.

Tests:
  lzc --debug someapp.lzx, load that app directly from your
filesystem, evaluate `canvas.subviews[0]` in the debugger and note
  that it works.

Files:
M      lps/components/debugger/debugger.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20081112-ptw-E.tar



Reply via email to