23 Sep 2025
Raku eval Exit code: 1 ===SORRY!=== Expression needs parens to avoid gobbling block at /home/glot/main.raku:1 ------> /)"),contact> -> $contact {say $contact}⏏<EOL> Missing block (apparently claimed by expression) at /home/glot/main.raku:1 ------> /)"),contact> -> $contact {say $contact}⏏<EOL> 10:27
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact} 10:28
Raku eval 「( )」 「(/)」
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact.defined} 10:29
Raku eval Exit code: 1 ===SORRY!=== Null regex not allowed. Please use .comb if you wanted to produce a sequence of characters from a string. at /home/glot/main.raku:1 ------> x TOP {<contact>}; proto regex contact{⏏}; regex contact:sym<NO> {(\h)}; regex c Proto regex body must be {*} (or <*> or <...>, which are deprecated) at /home/glot/main.raku:1 ------> st {regex TOP {<contact>}; proto regex ⏏contact{}; regex
contact:sym<NO> {(\h)};
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact} 10:30
Raku eval Exit code: 1 ===SORRY!=== Null regex not allowed. Please use .comb if you wanted to produce a sequence of characters from a string. at /home/glot/main.raku:1 ------> x TOP {<contact>}; proto regex contact{⏏}; regex contact:sym<NO> {(\h)}; regex c Proto regex body must be {*} (or <*> or <...>, which are deprecated) at /home/glot/main.raku:1 ------> st {regex TOP {<contact>}; proto regex ⏏contact{}; regex
contact:sym<NO> {(\h)};
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact} 10:31
Raku eval Exit code: 1 ===SORRY!=== Null regex not allowed. Please use .comb if you wanted to produce a sequence of characters from a string. at /home/glot/main.raku:1 ------> x TOP {<contact>}; proto regex contact{⏏}; regex contact:sym<NO> {(\h)}; regex c Proto regex body must be {*} (or <*> or <...>, which are deprecated) at /home/glot/main.raku:1 ------> st {regex TOP {<contact>}; proto regex ⏏contact{}; regex
contact:sym<NO> {(\h)};
winfredraj here, I just want to know whether the match was from contact:sym<NO> or contact:sym<NC> 10:32
m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact}; 10:33
Raku eval Exit code: 1 ===SORRY!=== Null regex not allowed. Please use .comb if you wanted to produce a sequence of characters from a string. at /home/glot/main.raku:1 ------> x TOP {<contact>}; proto regex contact{⏏}; regex contact:sym<NO> {(\h)}; regex c Proto regex body must be {*} (or <*> or <...>, which are deprecated) at /home/glot/main.raku:1 ------> st {regex TOP {<contact>}; proto regex ⏏contact{}; regex
contact:sym<NO> {(\h)};
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{*}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact} 10:34
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Unrecognized regex metacharacter / (must be quoted to match literally) at /home/glot/main.raku:1 ------> sym<NO> {(\h)}; regex contact:sym<NC> {(⏏/)};}; for test.parse("( )(/)")<contact>
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{*}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact}
Raku eval Exit code: 1 ===SORRY!=== Unrecognized regex metacharacter / (must be quoted to match literally) at /home/glot/main.raku:1 ------> <NO> {\(\h\)}; regex contact:sym<NC> {\(⏏/\)};}; for test.parse("( )(/)")<contact Malformed regex at /home/glot/main.raku:1 ------> NO> {\(\h\)}; regex contact:sym<NC> {\(/⏏\)};}; for test.parse("( )(/)")<contact>
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{*}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact} 10:35
Raku eval Nil
winfredraj copying and pasting is giving me all sorts of problems
sorry about the mess above 10:36
m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact}
Raku eval 「( )」 「(/)」
winfredraj finally 10:37
m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact.defined}
Raku eval True True
winfredraj instead of $contact.defined, how can I use $contact:sym<NO>.defined or something similar 10:38
m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact<NO>} 10:40
Raku eval Nil Nil
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact:sym<NO>} 10:41
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Variable '$contact:sym<NO>' is not declared. Perhaps you forgot a 'sub' if this was intended to be part of a signature? at /home/glot/main.raku:1 ------> rse("( )(/)")<contact> -> $contact {say ⏏$contact:sym<NO>}
winfredraj if nothing, then as recommended by Steve I can try to make an object in the action class for the regex and let it bubble up using make 10:43
I was trying to think of the grammar as a class and the regex and the proto regex as a method and though maybe I could pass the :sym<NO> as a hash but it did not work 10:46
m: grammar test {regex TOP {<contact>}; proto regex contact{}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact(sym => "NO")} 10:47
Raku eval Exit code: 1 No such method 'CALL-ME' for invocant of type 'test' in block <unit> at main.raku line 1
librasteve dihwidt 10:51
winfredraj doctor, it hurts when I do that -> what does that mean here? am I trying to do something which was not meant to be done? 11:05
im not aware of the terms usage, I had to google it up 11:06
librasteve I was just reflecting that, while grammar is a class and regex is a method, passing in :sym<NO> as a hash might be difficult since the composition of grammar and regex / token is very specialized --- my advice around grammars is limited to "follow the docs examples or it may not work out (ie hurt) if you don't" [I am sure that there are raku meta coding experts who will happily show you a way since in raku most 13:02
things are possible]
.landyacht. I've been bitten by trying to group things together under a proto before when it's easier to just have separate rules like token contact { <NO> | <NC> } .... token NO { '(' \h ')' } ... token NC { '(/)' } 13:09
then I think you could just do $contact<NO>.defined 13:10
winfredraj m: grammar test {regex TOP {<contact>}; proto regex contact{*}; regex contact:sym<NO> {(\h)}; regex contact:sym<NC> {(/)};}; for test.parse("( )(/)")<contact> -> $contact {say $contact.^methods()}; 14:59
Raku eval (sink FALLBACK STORE AT-POS AT-KEY Numeric new iterator BIND-POS BIND-KEY ASSIGN-POS ASSIGN-KEY push append unshift prepend chars chomp chop codes comb contains ends-with flip indent index indices lc lines tc tclc rindex starts-with trans substr subst substr-eq substr-rw wordcase words uc Int gist Str raku Set SetHash Bag BagHash Mix MixHash BUILDALL ords chrs)
winfredraj strange I could see all the regexes from the grammar when I ran it directly from my application 15:00
just was trying to see what is possible to make the code cleaner and concise and to avoid boilerplate 15:01
I am trying to write a grammar for a ladder diagram programming language and so the options are a lot -> too many ors for my liking 15:03
im just going to "make" an object with all the data and will let it bubble up the regexes and see if it offers a clean way out 15:05
24 Sep 2025
librasteve_ nah - looks like the IRC <=> Discord bridge is down for raku and raku-beginner 14:47
lizmat [22:35:38] disbot1 (~disbot@2001:19f0:c:d0d:5400:4ff:fe47:9405) left IRC (Ping timeout: 248 seconds) 15:03