![]() Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : fdshops ( 1003) PHP Version : 8.2.21 Disable Function : NONE Directory : /usr/share/doc/perl-Parse-RecDescent-1.967009/demo/ |
use v5.10; use warnings; # SHOWCASE VARIOUS ERROR MESSAGES WITH A VERY UNWELL GRAMMAR use Parse::RecDescent; open (Parse::RecDescent::ERROR, ">-") or die; $grammar = q{ <warn:3> typedef : a ... ...! ... b typedef : a ...!...!...!...! b | /type/ ident /has/ field(s) /end type/ { $result = $item[2]; } | /type/ ident /is/ ident { $result = $item[2]; } | quasit(s) | quasit(-1..3) | quasit(..0) | field(?) field end | <error> quasit "here" ...!/why/ Extend: extend Replace: replace $%^@# field : /field/ ident /is/ ident | field quasit | !quasit(s?) !| #NOTHING typedef : whatever package somewhereelse !ident : /[A-Za-z]\w*???/ { $result = $item[1]; } quasit : field | typedef }; new Parse::RecDescent ($grammar) || die "Bad grammar! No biscuit!\n";