diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage
index 541c71f..988d0f9 100644
--- a/Syntaxes/JavaScript Basic.tmLanguage
+++ b/Syntaxes/JavaScript Basic.tmLanguage
@@ -11,9 +11,19 @@
jsx
foldingStartMarker
- ^.*(\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$)|(={\s*$)|(\({$)
+ (?x)^ \s* ([^\s].*)?
+ # Open (nothing | no parens | (no parens? (nested parens ) no parens?)+ )
+ ( \[ (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ )
+ | \( (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ )
+ | \{ (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ )
+ )$
foldingStopMarker
- (^\s*\})|(^}\));
+ (?x)^ \s*
+ # (nothing | no parens | (no parens? (nested parens ) no parens?)+ ) Close
+ ( (?: | (?<noR>[^\[\]]++) | (\g<noR>? (?<round> \[ (?: \g<noR> | \g<round> )* \] ) \g<noR>? )++ ) \]
+ | (?: | (?<noS>[^\(\)]++) | (\g<noS>? (?<squar> \( (?: \g<noS> | \g<squar> )* \) ) \g<noS>? )++ ) \)
+ | (?: | (?<noC>[^\{\}]++) | (\g<noC>? (?<curly> \{ (?: \g<noC> | \g<curly> )* \} ) \g<noC>? )++ ) \}
+ )
keyEquivalent
^~J
name
diff --git a/Tests/Embedded Javascript Test.html b/Tests/Embedded Javascript Test.html
index 1c08ebb..8f8d9f1 100644
--- a/Tests/Embedded Javascript Test.html
+++ b/Tests/Embedded Javascript Test.html
@@ -10,7 +10,7 @@