Skip to content

Commit 1c22dc3

Browse files
author
Nikos M
committed
v.4.0.0
1 parent e9c2235 commit 1c22dc3

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

build/codemirror_grammar.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2478,6 +2478,25 @@ function empty( state, $id )
24782478
return state;
24792479
}
24802480

2481+
function stack_clone( stack, deep )
2482+
{
2483+
if ( null == stack ) return null;
2484+
if ( deep )
2485+
{
2486+
var stack2 = new Stack( stack.val ), ptr2 = stack2, ptr = stack;
2487+
while( ptr.prev )
2488+
{
2489+
ptr2.prev = new Stack( ptr.prev.val );
2490+
ptr = ptr.prev; ptr2 = ptr2.prev;
2491+
}
2492+
return stack2;
2493+
}
2494+
else
2495+
{
2496+
return stack;
2497+
}
2498+
}
2499+
24812500
function err_recover( state, stream, token, tokenizer )
24822501
{
24832502
//var just_space = false;
@@ -3293,7 +3312,7 @@ function State( unique, s )
32933312
self.line = s.line;
32943313
self.bline = s.bline;
32953314
self.status = s.status;
3296-
self.stack = s.stack/*.slice()*/;
3315+
self.stack = stack_clone( s.stack, false );
32973316
self.token = s.token;
32983317
self.block = s.block;
32993318
self.outer = s.outer ? [s.outer[0], s.outer[1], new State(unique, s.outer[2])] : null;

0 commit comments

Comments
 (0)