@o-lang/olang 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/parser.js +18 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/olang",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "author": "Olalekan Ogundipe <info@workfily.com>",
5
5
  "description": "O-Lang: A governance language for user-directed, rule-enforced agent workflows",
6
6
  "main": "./src/index.js",
package/src/parser.js CHANGED
@@ -29,24 +29,25 @@ function parse(code, fileName = null) {
29
29
  let line = lines[i];
30
30
 
31
31
  // ✅ FIXED: Match both "Allow resolvers" and "Allowed resolvers"
32
- const allowMatch = line.match(/^Allow(?:ed)?\s+resolvers\s*:\s*$/i);
33
- if (allowMatch) {
34
- i++;
35
- // Read all subsequent non-empty lines until a new top-level section (starts with capital letter)
36
- while (i < lines.length) {
37
- const nextLine = lines[i].trim();
38
- // Stop if line is empty or appears to be a new top-level keyword (e.g., Step, Workflow, Return)
39
- if (nextLine === '' || /^[A-Z][a-z]/.test(nextLine)) {
40
- break;
41
- }
42
- if (nextLine) {
43
- workflow.allowedResolvers.push(nextLine);
44
- workflow.resolverPolicy.declared.push(nextLine);
45
- }
46
- i++;
47
- }
48
- continue;
32
+ const allowMatch = line.match(/^Allow resolvers\s*:\s*$/i);
33
+ if (allowMatch) {
34
+ i++;
35
+ while (i < lines.length) {
36
+ const nextLine = lines[i].trim();
37
+ // Stop if line is empty or looks like a new top-level section
38
+ if (nextLine === '' || /^[A-Z][a-z]/.test(nextLine)) {
39
+ break;
40
+ }
41
+ // Strip optional YAML list marker: "- name" → "name"
42
+ const cleanVal = nextLine.replace(/^\-\s*/, '').trim();
43
+ if (cleanVal) {
44
+ workflow.allowedResolvers.push(cleanVal);
45
+ workflow.resolverPolicy.declared.push(cleanVal);
49
46
  }
47
+ i++;
48
+ }
49
+ continue;
50
+ }
50
51
 
51
52
  // ---- Math step patterns (standalone) ----
52
53
  let mathAdd = line.match(/^Add\s+\{(.+?)\}\s+and\s+\{(.+?)\}\s+Save as\s+(.+)$/i);