View unanswered posts | View active topics

Reply to topic  [ 2 posts ] 
Initializing regular expression in array breaks outline. 
Author Message

Joined: Wed Apr 03, 2013 10:47 am
Posts: 11
Reply with quote
I've just noticed that if you initialize multiple regular expressions, inside array, in single line , at class level, all other declarations(including functions) insde this class are not registered in the outline.

      protected var reg:RegExp = /program\s*(\w*)\s*\{/; // this works fine.
      protected var blockDefinitions:Array = [/program\s*(\w*)\s*\{/,
      /function\s*\w*\s*\([^)]*\)/]; //this is also ok.
      protected var blockDefinitions:Array = [/program\s*(\w*)\s*\{/,/function\s*\w*\s*\([^)]*\)/];//All declarations below are missing.

Mon Nov 07, 2016 12:10 am

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Regex parsing is quite fragile so the solution is to use 'new RegExp("...")' for problematic regexes...

Wed Dec 21, 2016 3:54 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.