@player-ui/player
Advanced tools
Comparing version 0.3.1--canary.117.4130 to 0.3.1--canary.118.4194
{ | ||
"name": "@player-ui/player", | ||
"version": "0.3.1--canary.117.4130", | ||
"version": "0.3.1--canary.118.4194", | ||
"private": false, | ||
@@ -10,4 +10,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"@player-ui/partial-match-registry": "0.3.1--canary.117.4130", | ||
"@player-ui/types": "0.3.1--canary.117.4130", | ||
"@player-ui/partial-match-registry": "0.3.1--canary.118.4194", | ||
"@player-ui/types": "0.3.1--canary.118.4194", | ||
"dequal": "^2.0.2", | ||
@@ -14,0 +14,0 @@ "p-defer": "^3.0.0", |
import { SyncWaterfallHook, SyncBailHook } from 'tapable-ts'; | ||
import { parseExpression } from './parser'; | ||
import parse from './parser'; | ||
import * as DEFAULT_EXPRESSION_HANDLERS from './evaluator-functions'; | ||
@@ -215,3 +215,3 @@ import { isExpressionNode } from './types'; | ||
const expAST = parseExpression(matchedExp); | ||
const expAST = parse(matchedExp); | ||
this.expressionsCache.set(matchedExp, expAST); | ||
@@ -218,0 +218,0 @@ |
export * from './evaluator'; | ||
export * from './types'; | ||
export * from './utils'; | ||
export * from './parser'; |
@@ -198,11 +198,3 @@ /* eslint @typescript-eslint/no-use-before-define: 0 */ | ||
/** Parse out an expression from the string */ | ||
export function parseExpression( | ||
expr: string, | ||
options?: { | ||
/** If true (the default), will throw on invalid expressions */ | ||
strict?: boolean; | ||
} | ||
): ExpressionNode { | ||
const strictMode = options?.strict ?? true; | ||
export default function parseExpression(expr: string): ExpressionNode { | ||
// `index` stores the character number we are currently at while `length` is a constant | ||
@@ -911,49 +903,35 @@ // All of the gobbles below will modify `index` as we move along | ||
try { | ||
while (index < length) { | ||
const chIndex = exprICode(index); | ||
while (index < length) { | ||
const chIndex = exprICode(index); | ||
// Expressions can be separated by semicolons, commas, or just inferred without any | ||
// separators | ||
if (chIndex === SEMCOL_CODE || chIndex === COMMA_CODE) { | ||
index++; // ignore separators | ||
continue; | ||
} | ||
const node = gobbleExpression(); | ||
// Try to gobble each expression individually | ||
if (node) { | ||
nodes.push(node); | ||
// If we weren't able to find a binary expression and are out of room, then | ||
// the expression passed in probably has too much | ||
} else if (index < length) { | ||
throwError(`Unexpected "${exprI(index)}"`, index); | ||
} | ||
// Expressions can be separated by semicolons, commas, or just inferred without any | ||
// separators | ||
if (chIndex === SEMCOL_CODE || chIndex === COMMA_CODE) { | ||
index++; // ignore separators | ||
continue; | ||
} | ||
// If there's only one expression just try returning the expression | ||
if (nodes.length === 1) { | ||
return nodes[0]; | ||
} | ||
const node = gobbleExpression(); | ||
return { | ||
__id: ExpNodeOpaqueIdentifier, | ||
type: 'Compound', | ||
body: nodes, | ||
location: getLocation(0), | ||
}; | ||
} catch (e) { | ||
if (strictMode || !(e instanceof Error)) { | ||
throw e; | ||
// Try to gobble each expression individually | ||
if (node) { | ||
nodes.push(node); | ||
// If we weren't able to find a binary expression and are out of room, then | ||
// the expression passed in probably has too much | ||
} else if (index < length) { | ||
throwError(`Unexpected "${exprI(index)}"`, index); | ||
} | ||
} | ||
return { | ||
__id: ExpNodeOpaqueIdentifier, | ||
type: 'Compound', | ||
body: nodes, | ||
location: getLocation(0), | ||
error: e, | ||
}; | ||
// If there's only one expression just try returning the expression | ||
if (nodes.length === 1) { | ||
return nodes[0]; | ||
} | ||
return { | ||
__id: ExpNodeOpaqueIdentifier, | ||
type: 'Compound', | ||
body: nodes, | ||
location: getLocation(0), | ||
}; | ||
} |
@@ -84,8 +84,2 @@ import type { DataModelWithParser } from '../data'; | ||
location?: NodeLocation; | ||
/** | ||
* The error that occurred while parsing this node | ||
* This is only set if the parsing mode is set to non-strict | ||
*/ | ||
error?: Error; | ||
} | ||
@@ -92,0 +86,0 @@ |
@@ -33,4 +33,4 @@ import { setIn } from 'timm'; | ||
// Variables injected at build time | ||
const PLAYER_VERSION = '0.3.1--canary.117.4130'; | ||
const COMMIT = 'd05bdda3731500eb452dbd8ea8ef9f1592bcd42d'; | ||
const PLAYER_VERSION = '0.3.1--canary.118.4194'; | ||
const COMMIT = 'bd43c4ac3359247f93f29ff24846ab9ba1237931'; | ||
@@ -37,0 +37,0 @@ export interface PlayerPlugin { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
641297
18436
+ Added@player-ui/partial-match-registry@0.3.1--canary.118.4194(transitive)
+ Added@player-ui/types@0.3.1--canary.118.4194(transitive)
- Removed@player-ui/partial-match-registry@0.3.1--canary.117.4130(transitive)
- Removed@player-ui/types@0.3.1--canary.117.4130(transitive)
Updated@player-ui/partial-match-registry@0.3.1--canary.118.4194