openc3-cosmos-script-engine-cstol 1.1.0 → 1.1.1

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cstol_script_engine.py +28 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d0e4ae051329106a645f8cfafc4692be99ada07d577dc4bdef50b5f8a017c26
4
- data.tar.gz: 4a8728bf65623019a3f525ed1bcb7527865d927fcbcf1a8b14dd62d1e63f2bb2
3
+ metadata.gz: 6ef43bd11a38493eccfc313dccee63034ead05937930eaed62e5c164bd4b68a4
4
+ data.tar.gz: e63152c3a168bf6da0b6d70b3e3aa9f05cb2c974c631cbd4e1ac5f36908618a6
5
5
  SHA512:
6
- metadata.gz: e992d06108e1e8c401cb3be499f3fac0da9e3f4a0b94139099a486ffbe7906be2b508654ab4dab7c9a4f2c7dc40f1f8794ce0ca84be4c7bd9648ac3c5227fc8a
7
- data.tar.gz: d4688f23af1f74ba8969981105cb841cf0064e175e48825f33a460a54ed6559c84f80c4e1cb1209fd8aa147ef60a0ede414b3d8367c138de6b55adf0333d9071
6
+ metadata.gz: eab9091c50b1867c2d4ac4b2794f72abb67bd48352ccbd01cfa14fb442be43314c1766e73ba418cef8445d6f596d7855b54306c6b5a58cddfcca900698450107
7
+ data.tar.gz: d23e20164925cafe6a9efee37d6348b2277a1996a53fe8d05f0b31dd6fa4612635a0e34c1ffdcf893af8a5c297b175ece81a747250459ce747a97e298a3e6ece
@@ -514,6 +514,29 @@ class CstolScriptEngine(ScriptEngine):
514
514
  expressions.append(expression)
515
515
  return expressions
516
516
 
517
+ def _split_wait_timeout(self, tokens):
518
+ """Split WAIT body tokens into (condition_tokens, timeout_tokens | None).
519
+
520
+ Scans from the end of the token list looking for the last ``OR``
521
+ that is immediately followed by ``FOR`` or ``UNTIL``. That ``OR``
522
+ marks the boundary between the boolean condition and the timeout
523
+ clause.
524
+
525
+ Returns
526
+ -------
527
+ (condition_tokens, timeout_tokens)
528
+ *timeout_tokens* includes the ``FOR``/``UNTIL`` keyword and the
529
+ value that follows. If no ``OR FOR`` / ``OR UNTIL`` sequence is
530
+ found the full token list is returned as the condition and
531
+ *timeout_tokens* is ``None``.
532
+ """
533
+ # Walk backwards so we find the last OR FOR / OR UNTIL (before the timeout).
534
+ # Earlier OR tokens are boolean operators inside the condition.
535
+ for i in range(len(tokens) - 1, 0, -1):
536
+ if tokens[i - 1].upper() == "OR" and tokens[i].upper() in ("FOR", "UNTIL"):
537
+ return tokens[:i - 1], tokens[i:]
538
+ return tokens, None
539
+
517
540
  def split_vs_tokens_on_colon(self, tokens):
518
541
  """
519
542
  Split tokens on colons for VS clause processing, but preserve timestamps.
@@ -1088,11 +1111,11 @@ class CstolScriptEngine(ScriptEngine):
1088
1111
  raise ValueError(f"Invalid timestamp format at line {line_no}")
1089
1112
  else:
1090
1113
  # Conditional expression wait
1091
- expressions = self.extract_expressions(tokens[1:], seperator="OR")
1092
- python_expression = self.build_python_expression(expressions[0])
1093
- if len(expressions) > 1:
1114
+ condition_tokens, timeout_tokens = self._split_wait_timeout(tokens[1:])
1115
+ python_expression = self.build_python_expression(condition_tokens)
1116
+ if timeout_tokens is not None:
1094
1117
  # Timeout given with "OR FOR" or "OR UNTIL"
1095
- seconds = self.evaluate_expression(expressions[1][1:]) # Drop assumed FOR or UNTIL token
1118
+ seconds = self.evaluate_expression(timeout_tokens[1:]) # Drop FOR or UNTIL token
1096
1119
  if isinstance(seconds, (int, float, complex)) and not isinstance(seconds, bool):
1097
1120
  if seconds > self.ONE_YEAR_SECONDS:
1098
1121
  now = datetime.datetime.now().timestamp()
@@ -1261,4 +1284,4 @@ class CstolScriptEngine(ScriptEngine):
1261
1284
  case _:
1262
1285
  raise ValueError(f"Unknown keyword '{keyword}' at line {line_no}")
1263
1286
 
1264
- return line_no + 1
1287
+ return line_no + 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openc3-cosmos-script-engine-cstol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenC3, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-26 00:00:00.000000000 Z
11
+ date: 2026-08-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " This plugin provides a script engine to support CSTOL in Script Runner\n"
14
14
  email: