Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error when parsing "embedded" CPT in Leapp #12

Closed
GoogleCodeExporter opened this issue Aug 4, 2015 · 1 comment
Closed

Parsing error when parsing "embedded" CPT in Leapp #12

GoogleCodeExporter opened this issue Aug 4, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Consider the following CPT example in Leapp;

x = ?:(1/3)
y = ?:(1/4)
z1 = ?! ( ~x & ~y -> ?:(1/5),
          ~x &  y -> ?:(1/7),
           x & ~y -> ?:(1/2),
           x &  y -> ?:(1/2))

Notice that z1 is independent of y when x is true (i.e. "context-specific 
Independence"). 
The following refactoring

z4 = ?! ( ~x -> ?! ( ~y -> ?:(1/5),
                      y -> ?:(1/7)),
           x -> ?:(1/2))

is not correctly parsed by Leapp, which reports

Python error: too many values to unpack (expected 2)

After activating the debug mode of Leapp, the following trace is displayed:

Traceback (most recent call last):
  File "/Users/admin/Documents/lea2/leapp_console.py", line 108, in startCmdLoop
    self.execLeappTranslatorMultilineStatement(rMultilineStatement)
  File "/Users/admin/Documents/lea2/leapp_console.py", line 71, in execLeappTranslatorMultilineStatement
    pMultilineStatement = LeappTranslator.getTarget00(rMultilineStatement)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 107, in getTarget00
    pStatementLines.append(identStr+LeappTranslator.getTarget0(unindentedLeaStatementLine))
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 143, in getTarget0
    return headTarget + LeappTranslator.getTarget0b(sourceFragment) + tailTarget
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 151, in getTarget0b
    target = LeappTranslator.getTarget1(sourceFragment)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 189, in getTarget1
    unstringedTargetFragment = LeappTranslator.getTarget(unstringedFragment)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 266, in getTarget
    targetFragment = LeappTranslator.parse(targetFragment,'?!' ,'(',')','Lea.buildCPT(*(%s,))',LeappTranslator.treatCPTExpression)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 364, in parse
    body = treatFunc(body)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 258, in treatCPTExpression
    newCPTExpression = ','.join('(%s,%s)'%(f(condExpr),distribExpr) for (condExpr,distribExpr) in cptItems)
  File "/Users/admin/Documents/lea2/leapp_translator.py", line 258, in <genexpr>
    newCPTExpression = ','.join('(%s,%s)'%(f(condExpr),distribExpr) for (condExpr,distribExpr) in cptItems)
ValueError: too many values to unpack (expected 2)



Original issue reported on code.google.com by pde@n-side.com on 14 Mar 2015 at 2:04

@GoogleCodeExporter
Copy link
Author

Corrected in Lea 2.1.1

Original comment by pde@n-side.com on 18 Mar 2015 at 12:18

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant