This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-TMP-REPO/packages/sfeel/src/index.ts
T
JCAI Main AgentandClaude Opus 5 146e9bbfad M3(1/5): @sfeel —— S-FEEL 子集的解析与求值,前后端同源
- lexer / parser(递归下降)/ evaluate / static-check,四文件纯函数,零 IO 零外部调用
- 子集封顶(ADR-006):比较 · 逻辑 · 算术 · 区间(开闭四态)· 列表与 in ·
  封闭内建函数集(字符串 / 数字 / 日期);未知函数一律拦下
- 单元格谓词(DMN 一格):`-` 任意 / 比较 / 区间 / 逗号析取
- staticCheck 给「画图即校验」用:语法 + 未知函数 + 引用路径清单
- app 侧以它替下 passthroughEvaluator:监听内容条件真求值,求值异常按不命中处置并留痕

32 个 sfeel 测试;全仓 182 个测试通过,门禁五道全绿

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
2026-07-27 01:21:45 +08:00

31 lines
1.2 KiB
TypeScript

/**
* @sfeel —— S-FEEL 子集(OS 03 定义域)的解析与求值,纯函数(编码规范 §8.3)。
*
* 被 `process`(边条件 / 失败走向)、`flow-engine`(条件谓词)、`trigger`(判定)、
* `loop-engine`(前提 ifPart / DMN 单元格)与前端 `gov-process`(画布即时校验预览)共用 ——
* **求值语义一份代码,前后端同源**;后端裁决为权威。
*
* 子集封顶(ADR-006:自研,不引第三方 FEEL 引擎):
* 比较 · 逻辑 · 算术 · 区间 · 列表与 in · 封闭的内建函数集(字符串 / 数字 / 日期)。
* **无外部调用,静态可检。**
*/
export type { Node, UnaryTest } from './ast.ts';
export type { Token, TokenKind } from './lexer.ts';
export { SfeelSyntaxError, tokenize } from './lexer.ts';
export { parse, parseUnaryTest } from './parser.ts';
export type { Scope } from './evaluate.ts';
export {
BUILTIN_FUNCTIONS,
evaluate,
evaluateCondition,
evaluateNode,
evaluateUnaryTest,
SfeelEvalError,
testMatches,
truthy,
} from './evaluate.ts';
export type { StaticCheckResult, StaticIssue } from './static-check.ts';
export { staticCheck } from './static-check.ts';
export const SFEEL_VERSION = '0.1.0-m3';