Menu

Help with "pattern_assign_onmatch": invalid argument for unary operator

2017-12-30
2017-12-31
  • Yves Cloutier

    Yves Cloutier - 2017-12-30

    Hi again,

    When trying to match a simple pattern:

    title := "<TITLE>" || (<.+>) -> capture || "</TITLE>"
    if text ?? title then write("\\chapter{", capture, "}")
    

    I get the following error:

    "pattern_assign_onmatch": invalid argument for unary operator
    

    which references this line:

    title := "<TITLE>" || (<.+>) -> capture || "</TITLE>"
    

    What I'm trying t do is assign anything in between <TITLE> and </TITLE> to a variable.

    To my knowledge I seem to be following the correct syntax, but it seems not!

     

    Last edit: Yves Cloutier 2017-12-30
    • Bruce Rennie

      Bruce Rennie - 2017-12-30

      Good morning Yves,

      Instead of using the regex expression (<.+>) in your pattern matching
      expression, use the appropriate pattern matching expression instead.

      There are various problems with the regex facilities in the current
      implementation. A new proposed version has been submitted but is
      undergoing testing to ensure that it doesn't make a mess of other
      facilities in unicon. The new proposed version has some
      incompatibilities with the features of regex as documented in the unicon
      reports.

      regards

      Bruce Rennie

      On 31/12/17 05:02, Yves Cloutier wrote:

      Hi again,

      When trying to match a simple pattern:

      title := "<TITLE>" || (<.+>) -> capture || "</TITLE>"
      if text ?? title then write("\chapter{", capture, "}")

      I get the following error:

      |"pattern_assign_onmatch": invalid argument for unary operator|

      which references this line:

      |title := "<TITLE>" || (<.+>) -> capture || "</TITLE>"|

      What I'm trying t do is assign anything in between <TITLE> and
      </TITLE> to a variable.

      To my knowledge I seem to be following the correct syntax, but it
      seems not!


      Help with "pattern_assign_onmatch": invalid argument for unary
      operator
      https://sourceforge.net/p/unicon/discussion/general/thread/adf5a4e9/?limit=25#e845


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/unicon/discussion/general/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Yves Cloutier

        Yves Cloutier - 2017-12-31

        Hi Bruce,

        After some fiddling around I managed to clear the error by adding parens to my regular expression:

        <(.)+> instead of (<.+>)

        It's working to some degree, but I'm not getting the results I has hoping. I will need to have anther look at the html source and reassess my aproach. The html is not as clean as I initially thought.

         
        • Clinton Jeffery

          Clinton Jeffery - 2017-12-31

          Hi Yves,

          I committed (to Unicon's SVN repository) a preliminary fix for the missing
          <.+> code this evening. Perhaps the interesting part was that before my
          fix, the error message I got was different from the one you got. Thanks for
          the report. We are close to the point where, with the patterns and their
          regex literals, we can write most programs shorter, faster, and more
          readable than with just string scanning. But, the two are not mutually
          exclusive and string scanning is not going away...ever.

          Cheers,
          Clint

          On Sat, Dec 30, 2017 at 8:04 PM, Yves Cloutier cloutiy@users.sf.net wrote:

          Hi Bruce,

          After some fiddling around I managed to clear the error by adding parens
          to my regular expression:

          <(.)+> instead of (<.+>)

          It's working to some degree, but I'm not getting the results I has hoping.
          I will need to have anther look at the html source and reassess my aproach.
          The html is not as clean as I initially thought.


          Help with "pattern_assign_onmatch": invalid argument for unary operator
          https://sourceforge.net/p/unicon/discussion/general/thread/adf5a4e9/?limit=25#e845/ca42/6d2f


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/unicon/discussion/general/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

           
          • Yves Cloutier

            Yves Cloutier - 2017-12-31

            Great, thanks for looking into it Clint

             

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.