vsn 0.1.120 → 0.1.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/AST.ts CHANGED
@@ -202,7 +202,7 @@ const TOKEN_PATTERNS: TokenPattern[] = [
202
202
  },
203
203
  {
204
204
  type: TokenType.WITH,
205
- pattern: /^with\s/
205
+ pattern: /^with(?=\||\s)?/ // Allows with|sequential
206
206
  },
207
207
  {
208
208
  type: TokenType.FOR,
@@ -495,9 +495,10 @@ export class Tree {
495
495
  return tokens;
496
496
  }
497
497
 
498
- public static processTokens(tokens: Token[]): BlockNode {
498
+ public static processTokens(tokens: Token[], _node: Node=null, _lastBlock: Node=null): BlockNode {
499
499
  let blockNodes: Node[] = [];
500
- let node: Node = null;
500
+ let lastBlock: Node = _lastBlock;
501
+ let node: Node = _node;
501
502
  let count: number = 0;
502
503
 
503
504
  Tree.stripWhiteSpace(tokens);
@@ -521,26 +522,34 @@ export class Tree {
521
522
  node = DispatchEventNode.parse(node, tokens[0], tokens);
522
523
  } else if (token.type === TokenType.WITH) {
523
524
  node = WithNode.parse(node, tokens[0], tokens);
525
+ lastBlock = node;
526
+ blockNodes.push(node);
527
+ node = null;
524
528
  } else if (token.type === TokenType.AS) {
525
529
  node = AsNode.parse(node, tokens[0], tokens);
526
530
  } else if (token.type === TokenType.IF) {
527
531
  node = IfStatementNode.parse(node, token, tokens);
532
+ lastBlock = node;
528
533
  blockNodes.push(node);
529
534
  node = null;
530
535
  } else if (token.type === TokenType.FOR) {
531
536
  node = ForStatementNode.parse(node, token, tokens);
537
+ lastBlock = node;
532
538
  blockNodes.push(node);
533
539
  node = null;
534
540
  } else if (token.type === TokenType.FUNC) {
535
541
  node = FunctionNode.parse(node, token, tokens);
542
+ lastBlock = node;
536
543
  blockNodes.push(node);
537
544
  node = null;
538
545
  } else if (token.type === TokenType.ON) {
539
546
  node = OnNode.parse(node, token, tokens);
547
+ lastBlock = node;
540
548
  blockNodes.push(node);
541
549
  node = null;
542
550
  } else if (token.type === TokenType.CLASS) {
543
551
  node = ClassNode.parse(node, token, tokens);
552
+ lastBlock = node;
544
553
  blockNodes.push(node);
545
554
  node = null;
546
555
  } else if (StringFormatNode.match(tokens)) {
@@ -618,7 +627,7 @@ export class Tree {
618
627
  } else if (tokens[0].type === TokenType.EXCLAMATION_POINT) {
619
628
  node = NotNode.parse(node, tokens[0], tokens);
620
629
  } else if (tokens[0].type === TokenType.MODIFIER) {
621
- node = ModifierNode.parse(node, tokens[0], tokens);
630
+ ModifierNode.parse(node ? node : lastBlock, tokens[0], tokens);
622
631
  } else {
623
632
  let code: string = Tree.toCode(tokens, 10);
624
633
  throw Error(`Syntax Error. Near ${code}`);
package/src/Scope.ts CHANGED
@@ -4,6 +4,7 @@ import {QueryReference} from "./Scope/QueryReference";
4
4
  import {WrappedArray} from "./Scope/WrappedArray";
5
5
  import {ScopeData} from "./Scope/ScopeData";
6
6
  import {DynamicScopeData} from "./Scope/DynamicScopeData";
7
+ import {DOM} from "./DOM";
7
8
 
8
9
 
9
10
  export class Scope extends EventDispatcher {
@@ -28,7 +29,11 @@ export class Scope extends EventDispatcher {
28
29
  }
29
30
 
30
31
  public get parentScope(): Scope {
31
- return this._parentScope;
32
+ if (this._parentScope)
33
+ return this._parentScope;
34
+
35
+ const rootScope = DOM.instance.root.scope;
36
+ return this == rootScope ? null : rootScope;
32
37
  }
33
38
 
34
39
  public set parentScope(scope: Scope) {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.120';
1
+ export const VERSION = '0.1.121';
2
2