@player-ui/player
Advanced tools
Comparing version 0.3.1--canary.117.4102 to 0.3.1--canary.117.4130
{ | ||
"name": "@player-ui/player", | ||
"version": "0.3.1--canary.117.4102", | ||
"version": "0.3.1--canary.117.4130", | ||
"private": false, | ||
@@ -10,4 +10,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"@player-ui/partial-match-registry": "0.3.1--canary.117.4102", | ||
"@player-ui/types": "0.3.1--canary.117.4102", | ||
"@player-ui/partial-match-registry": "0.3.1--canary.117.4130", | ||
"@player-ui/types": "0.3.1--canary.117.4130", | ||
"dequal": "^2.0.2", | ||
@@ -14,0 +14,0 @@ "p-defer": "^3.0.0", |
@@ -198,3 +198,11 @@ /* eslint @typescript-eslint/no-use-before-define: 0 */ | ||
/** Parse out an expression from the string */ | ||
export function parseExpression(expr: string): ExpressionNode { | ||
export function parseExpression( | ||
expr: string, | ||
options?: { | ||
/** If true (the default), will throw on invalid expressions */ | ||
strict?: boolean; | ||
} | ||
): ExpressionNode { | ||
const strictMode = options?.strict ?? true; | ||
// `index` stores the character number we are currently at while `length` is a constant | ||
@@ -903,35 +911,49 @@ // All of the gobbles below will modify `index` as we move along | ||
while (index < length) { | ||
const chIndex = exprICode(index); | ||
try { | ||
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; | ||
// 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); | ||
} | ||
} | ||
const node = gobbleExpression(); | ||
// If there's only one expression just try returning the expression | ||
if (nodes.length === 1) { | ||
return nodes[0]; | ||
} | ||
// 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), | ||
}; | ||
} catch (e) { | ||
if (strictMode || !(e instanceof Error)) { | ||
throw 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), | ||
error: e, | ||
}; | ||
} | ||
return { | ||
__id: ExpNodeOpaqueIdentifier, | ||
type: 'Compound', | ||
body: nodes, | ||
location: getLocation(0), | ||
}; | ||
} |
@@ -84,2 +84,8 @@ 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; | ||
} | ||
@@ -86,0 +92,0 @@ |
@@ -33,4 +33,4 @@ import { setIn } from 'timm'; | ||
// Variables injected at build time | ||
const PLAYER_VERSION = '0.3.1--canary.117.4102'; | ||
const COMMIT = '801fbafd84975a78d500fee30c76f7e7de6ea583'; | ||
const PLAYER_VERSION = '0.3.1--canary.117.4130'; | ||
const COMMIT = 'd05bdda3731500eb452dbd8ea8ef9f1592bcd42d'; | ||
@@ -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
643265
18506
+ Added@player-ui/partial-match-registry@0.3.1--canary.117.4130(transitive)
+ Added@player-ui/types@0.3.1--canary.117.4130(transitive)
- Removed@player-ui/partial-match-registry@0.3.1--canary.117.4102(transitive)
- Removed@player-ui/types@0.3.1--canary.117.4102(transitive)
Updated@player-ui/partial-match-registry@0.3.1--canary.117.4130