Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit module Asistencia;
- # Captura los presentes
- grammar Asistencia {
- token TOP { ^ <link>**2 <html> $ }
- token link { '<' <-[\>]>+ '>' \n }
- token html { '<html>' \n <head> \n <body> }
- token head { '<head>' \n <meta> <title> <link> <style> '</head>' }
- token meta { '<META' <cont> '>' \n }
- token cont { <-[\>]>+ }
- token title { '<title>' <texto>+ '</title>' \n }
- token texto { <-[\<]>+ }
- token style { '<style>' <texto>+ '</style>' \n }
- token body { '<body>' \n <div> <pre> .+ }
- token div { '<div' <-[\>]>+ '>' \n <p>+ \n '</div>' \n <p> \n }
- token p { '<p>' [<texto> [<span>||<br>]* \s*]+ '</p>' }
- token span { '<span' <cont> '>' <texto>? '</span>' }
- token br { '<br>' }
- token pre { '<ul class="asistencia-presentes">' \n [<li> \n]+ '</ul>' \n }
- token nota { '<i>' <texto> '</i>' }
- token li { '<li>' <texto> <nota>? '</li>' }
- }
- class Asistencia-actions {
- method li ($/) { make $/.Str }
- }
- for dir("$*HOME/Descargas/vozyvoto/asistencias-utf8") -> $documento {
- # fail with error: This type cannot unbox to a native integer: P6opaque, Failure
- my $m = Asistencia.parse($documento.IO.slurp, :actions(Asistencia-actions.new));
- say $m.made;
- # this works for me
- # my $m = Asistencia.parse($documento.IO.slurp);
- # say $m<html><body><pre><li>>><texto>.Str;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement