00:32
yewscion left
00:55
SrainUser left
02:07
ulipink left
02:40
guifa joined
02:44
hulk joined,
kylese left
02:45
ulipink joined
02:51
ulipink left
03:12
ulipink joined,
ulipink left,
ulipink joined
03:15
hulk left,
kylese joined
03:18
ulipink left
|
|||
grondilu | Hello. Please look at this gist.github.com/grondilu/ebceff32e...fdb4516f24 and tell me what I am missing. | 03:30 | |
03:31
zetaaaa left
|
|||
grondilu | basically I'm trying to catch a pattern in a multiline string but the regex grabs all the trailing newlines. | 03:31 | |
m: say grammar { rule TOP { ^ <line>+ $ }; rule line { <.alpha>+ } } .parse: "foo\n" | 03:37 | ||
camelia | 「foo 」 line => 「foo 」 |
||
grondilu | how can I extract "foo" and not "foo\n"? | 03:38 | |
03:39
ulipink joined
|
|||
grondilu | in a nutshell I want to parse a file with blocks of text separated by empty lines. | 03:39 | |
that can't work as I've tried if the regex catches trailing newlines. | 03:40 | ||
guifa | I would use token instead | 03:42 | |
or change <ws> to be \h | |||
so | 03:43 | ||
say grammar { rule TOP { <line> %% \n }; rule line { <.alpha>+ } } .parse: "foo\nbar\nxyz\n" | 03:44 | ||
m: say grammar { rule TOP { <line> %% \n }; rule line { <.alpha>+ } } .parse: "foo\nbar\nxyz\n" | |||
camelia | ===SORRY!=== Error while compiling <tmp> Missing quantifier on the left argument of %% at <tmp>:1 ------> say grammar { rule TOP { <line> %%<HERE> \n }; rule line { <.alpha>+ } } .parse: |
||
guifa | m: say grammar { rule TOP { <line>+ %% \n }; rule line { <.alpha>+ } } .parse: "foo\nbar\nxyz\n" | ||
camelia | Nil | ||
guifa | m: say grammar { token TOP { <line>+ %% \n }; token line { <.alpha>+ } } .parse: "foo\nbar\nxyz\n" | 03:45 | |
camelia | 「foo bar xyz 」 line => 「foo」 line => 「bar」 line => 「xyz」 |
||
grondilu tries | |||
grondilu fails | 03:47 | ||
03:48
guifa left
|
|||
grondilu | m: say grammar { token TOP { <line>+ %% \n }; token line { <.alpha>+ } } .parse: "foo\n\nbar\n\nxyz\n" | 03:49 | |
camelia | Nil | ||
grondilu | there is no empty line in "foo\nbar" | ||
ugexe | <.alpha>* | 03:55 | |
03:59
ulipink left
04:19
pony left
04:27
Aedil left
04:33
Aedil joined,
nine left,
camelia left,
nine_ joined
04:41
camelia joined
05:09
ulipink joined
05:10
yewscion joined
05:13
yewscion left
06:11
yewscion joined
06:16
yewscion left
06:55
tejr joined
07:41
Sgeo left
|