bobe 0.0.33 → 0.0.34

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/dist/bobe.cjs.js CHANGED
@@ -932,8 +932,8 @@ class Compiler {
932
932
  }
933
933
  parseConditionalNode(node) {
934
934
  const keyword = this.tokenizer.token.value;
935
- const conditionToken = this.tokenizer.condExp();
936
- const condition = conditionToken.value;
935
+ this.tokenizer.condExp();
936
+ const condition = this.parsePropertyValue();
937
937
  this.tokenizer.nextToken();
938
938
  this.tokenizer.nextToken();
939
939
  node.type = keyword === 'if' ? NodeType.If : keyword === 'else' ? NodeType.Else : NodeType.Fail;
@@ -944,22 +944,33 @@ class Compiler {
944
944
  return node;
945
945
  }
946
946
  parseLoopNode(node) {
947
- const collection = this.tokenizer.nextToken().value;
947
+ this.tokenizer.nextToken();
948
+ const collection = this.parsePropertyValue();
948
949
  this.tokenizer.nextToken();
949
950
  const itemToken = this.tokenizer.nextToken();
950
951
  const isDestruct = itemToken.type === TokenType.InsertionExp;
951
- let item = isDestruct ? `{${itemToken.value}}` : itemToken.value;
952
+ if (isDestruct) {
953
+ itemToken.value = '{' + itemToken.value + '}';
954
+ }
955
+ const item = this.parsePropertyValue();
952
956
  let char = this.tokenizer.peekChar(),
953
957
  key,
954
958
  index;
955
959
  if (char === ';') {
956
960
  this.tokenizer.nextToken();
957
- if (this.tokenizer.peekChar() !== '\n') key = this.tokenizer.jsExp().value;
961
+ if (this.tokenizer.peekChar() !== '\n') {
962
+ this.tokenizer.jsExp();
963
+ key = this.parsePropertyValue();
964
+ }
958
965
  } else if (char === '\n') ; else {
959
- index = this.tokenizer.nextToken().value;
966
+ this.tokenizer.nextToken();
967
+ index = this.parsePropertyValue();
960
968
  if (this.tokenizer.peekChar() === ';') {
961
969
  this.tokenizer.nextToken();
962
- if (this.tokenizer.peekChar() !== '\n') key = this.tokenizer.jsExp().value;
970
+ if (this.tokenizer.peekChar() !== '\n') {
971
+ this.tokenizer.jsExp();
972
+ key = this.parsePropertyValue();
973
+ }
963
974
  }
964
975
  }
965
976
  this.tokenizer.nextToken();