症状
unlaxer 3.0.1 で (true ? 1 : 2) などの ternary 式をパースすると:
org.unlaxer.parser.ParseException: failed to parse (P4):(true ? 1 : 2)
cause=transaction nest is illegal. check source code.
原因
TinyExpressionP4Mapper.parse(String) が ParseContext を作成するが、
ScopeStore.registerDispatcher(context) を呼ばないため、
FormulaParser(@scopeTree(mode=lexical) による TransactionListener 実装)の
onBegin/onCommit/onRollback が呼ばれない。
その結果、パース失敗時に ParseContext.close() が tokenStack.size() != 1 を検出して
IllegalStateException("transaction nest is illegal") を投げる。
影響テスト
TernaryExpressionTest (32件 ERROR)
AstEvaluatorGeneratedValuePathTest (11件 FAIL)
修正方針
TinyExpressionP4Mapper.parse に ScopeStore.registerDispatcher(context) を追加する。
または MapperGenerator.emitEntryPoint がこれを自動生成するよう修正する。
症状
unlaxer 3.0.1 で
(true ? 1 : 2)などの ternary 式をパースすると:原因
TinyExpressionP4Mapper.parse(String)がParseContextを作成するが、ScopeStore.registerDispatcher(context)を呼ばないため、FormulaParser(@scopeTree(mode=lexical)によるTransactionListener実装)のonBegin/onCommit/onRollbackが呼ばれない。その結果、パース失敗時に
ParseContext.close()がtokenStack.size() != 1を検出してIllegalStateException("transaction nest is illegal")を投げる。影響テスト
TernaryExpressionTest(32件 ERROR)AstEvaluatorGeneratedValuePathTest(11件 FAIL)修正方針
TinyExpressionP4Mapper.parseにScopeStore.registerDispatcher(context)を追加する。または
MapperGenerator.emitEntryPointがこれを自動生成するよう修正する。