如何使用CUP消除语法歧义?

问题描述

我有这个语法

UPDATE
  `project.database.table`
SET
  Replacetotal= (
  SELECT
    CASE
      WHEN damageLineInfo.MessageCode='MO' AND damageLineInfo.AutomatedEntry=TRUE AND damageLineInfo.LaborInfo.LaborOperation='OPO' AND damageLineInfo.LaborInfo.LaborType='LAB' AND damageLineInfo.LaborInfo.LaborInclInd=FALSE THEN damageLineInfo.LaborInfo.LaborAmt
      WHEN damageLineInfo.LaborInfo.LaborOperation='OP9'
    OR damageLineInfo.LaborInfo.LaborOperation='OP11'
    OR damageLineInfo.LaborInfo.LaborOperation='OP5'
    OR damageLineInfo.LaborInfo.LaborOperation='OP12'
    OR damageLineInfo.LaborInfo.LaborOperation='OP10'
    OR damageLineInfo.LaborInfo.LaborOperation='OP1'
    OR damageLineInfo.LaborInfo.LaborOperation='OP21' THEN
    CASE
      WHEN damageLineInfo.LaborInfo.LaborType='LAB' AND damageLineInfo.LaborInfo.LaborInclInd=FALSE THEN damageLineInfo.LaborInfo.LaborAmt
  END
  END as Replacetotal
  FROM
    UNnesT(ServiceBusEnvelope.Payload.RepairOrderFolderAddRq.damageLineInfo) AS damageLineInfo
  LIMIT 1
  )
WHERE
  TRUE

(您可以在http://jsmachines.sourceforge.net/machines/lalr1.html这里进行测试)

语法不明确,会产生S / R冲突,但真正的问题出在输入S-> Stat Stat -> Exprs WRITE Stat -> Vars READ Vars -> ID COMMA Vars Vars -> ID Exprs -> Expr COMMA Exprs Exprs -> Expr Expr -> ID Expr -> ... ... 的同时,而ID COMMA ID WRITE则解析器有效。

有没有一种方法可以在不更改CUP语法的情况下防止这种情况发生?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)