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

wrong calculate #14

Open
mnj2kk opened this issue Aug 8, 2022 · 0 comments
Open

wrong calculate #14

mnj2kk opened this issue Aug 8, 2022 · 0 comments

Comments

@mnj2kk
Copy link
Contributor

mnj2kk commented Aug 8, 2022

@yegor256, i fixed regex for left part of a rule:
^([a-z.]+)\d?(([^)]+))$.
For this eo code:

  seq2 > @
    5.div
      x
    seq2 > @
      nop
      nop

debug:

<?xml version="1.0" encoding="UTF-8"?>\n
<o expected="\perp"\n
   line="4"\n
   name="test"\n
   original-name="test"\n
   pos="0">\n
   <o line="4" name="x" pos="1">\n
      <opts>\n
         <r f=".div" pos="2" tau="3">\n
            <r f="org.eolang.seq2" pos="1" tau="2"/>\n
         </r>\n
      </opts>\n
   </o>\n
   <o base="org.eolang.seq2" line="5" name="@" pos="2">\n
      <o base=".div" line="6">\n
         <o base="org.eolang.int" data="int" line="6" pos="4">5</o>\n
         <o base="x" line="7" pos="6" ref="4"/>\n
      </o>\n
      <o base="org.eolang.seq2" line="8" name="@" pos="4">\n
         <o base="org.eolang.nop" line="9" pos="6"/>\n
         <o base="org.eolang.nop" line="10" pos="6"/>\n
      </o>\n
      <o data="5" line="6" name="κ-5-6"/>\n
   </o>\n
   <o data="5" line="6" name="κ-5-6">\n
      <opts>\n
         <r f=".div" pos="1" tau="3">\n
            <r f="org.eolang.seq2" pos="1" tau="2"/>\n
         </r>\n
      </opts>\n
   </o>\n
</o>\n
<EOF>
[DEBUG] com.yegor256.xsline.StLogged: Shift #4 via 'calculate' produced:
<?xml version="1.0" encoding="UTF-8"?>\n
<o expected="\perp"\n
   line="4"\n
   name="test"\n
   original-name="test"\n
   pos="0">\n
   <o line="4" name="x" pos="1">\n
      <opts>\n
         <opt m=".div(org.eolang.seq2(\perp)[1]=NONE)[2]" x="1">{𝜏3:1=1} {𝜏2:1=1}</opt>\n
      </opts>\n
   </o>\n
   <o base="org.eolang.seq2" line="5" name="@" pos="2">\n
      <o base=".div" line="6">\n
         <o base="org.eolang.int" data="int" line="6" pos="4">5</o>\n
         <o base="x" line="7" pos="6" ref="4"/>\n
      </o>\n
      <o base="org.eolang.seq2" line="8" name="@" pos="4">\n
         <o base="org.eolang.nop" line="9" pos="6"/>\n
         <o base="org.eolang.nop" line="10" pos="6"/>\n
      </o>\n
      <o data="5" line="6" name="κ-5-6"/>\n
   </o>\n
   <o data="5" line="6" name="κ-5-6">\n
      <opts>\n
         <opt m=".div(org.eolang.seq2(\perp)[1]=NONE)[1]" x="NONE">{𝜏3:1=1} {𝜏2:1=1}</opt>\n
      </opts>\n
   </o>\n
</o>\n
<EOF>

If replace seq2 with foo, then debug is:

[DEBUG] com.yegor256.xsline.StLogged: Shift #3 via 'reverses' produced:
<?xml version="1.0" encoding="UTF-8"?>\n
<o expected="\perp"\n
   line="4"\n
   name="test"\n
   original-name="test"\n
   pos="0">\n
   <o line="4" name="x" pos="1">\n
      <opts>\n
         <r f=".div" pos="2" tau="3">\n
            <r f="org.eolang.foo" pos="1" tau="2"/>\n
         </r>\n
      </opts>\n
   </o>\n
   <o base="org.eolang.foo" line="5" name="@" pos="2">\n
      <o base=".div" line="6">\n
         <o base="org.eolang.int" data="int" line="6" pos="4">5</o>\n
         <o base="x" line="7" pos="6" ref="4"/>\n
      </o>\n
      <o base="org.eolang.foo" line="8" name="@" pos="4">\n
         <o base="org.eolang.nop" line="9" pos="6"/>\n
         <o base="org.eolang.nop" line="10" pos="6"/>\n
      </o>\n
      <o data="5" line="6" name="κ-5-6"/>\n
   </o>\n
   <o data="5" line="6" name="κ-5-6">\n
      <opts>\n
         <r f=".div" pos="1" tau="3">\n
            <r f="org.eolang.foo" pos="1" tau="2"/>\n
         </r>\n
      </opts>\n
   </o>\n
</o>\n
<EOF>
[DEBUG] com.yegor256.xsline.StLogged: Shift #4 via 'calculate' produced:
<?xml version="1.0" encoding="UTF-8"?>\n
<o expected="\perp"\n
   line="4"\n
   name="test"\n
   original-name="test"\n
   pos="0">\n
   <o line="4" name="x" pos="1">\n
      <opts>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\any)[2]" x="\any">{𝜏3:1=1} {𝜏2:3=1}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="\perp">{𝜏3:3=1} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="\any">{𝜏3:3=2} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="0">{𝜏3:3=3} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="\perp">{𝜏3:3=1} {𝜏2:3=3}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="\any">{𝜏3:3=2} {𝜏2:3=3}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[2]" x="0">{𝜏3:3=3} {𝜏2:3=3}</opt>\n
      </opts>\n
   </o>\n
   <o base="org.eolang.foo" line="5" name="@" pos="2">\n
      <o base=".div" line="6">\n
         <o base="org.eolang.int" data="int" line="6" pos="4">5</o>\n
         <o base="x" line="7" pos="6" ref="4"/>\n
      </o>\n
      <o base="org.eolang.foo" line="8" name="@" pos="4">\n
         <o base="org.eolang.nop" line="9" pos="6"/>\n
         <o base="org.eolang.nop" line="10" pos="6"/>\n
      </o>\n
      <o data="5" line="6" name="κ-5-6"/>\n
   </o>\n
   <o data="5" line="6" name="κ-5-6">\n
      <opts>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\any)[1]" x="\any">{𝜏3:1=1} {𝜏2:3=1}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\any">{𝜏3:3=1} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\perp">{𝜏3:3=2} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\any">{𝜏3:3=3} {𝜏2:3=2}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\any">{𝜏3:3=1} {𝜏2:3=3}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\perp">{𝜏3:3=2} {𝜏2:3=3}</opt>\n
         <opt m=".div(org.eolang.foo(\perp)[1]=\perp)[1]" x="\any">{𝜏3:3=3} {𝜏2:3=3}</opt>\n
      </opts>\n
   </o>\n
</o>\n
<EOF>

Can you help because I can't understand why this is happening.

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

No branches or pull requests

1 participant