{2}# -*- coding: utf-8 -*-{0} {2}#--------------------------------------------------------------------------{0} {2}# perl-test-sub-prototypes.pl{0} {2}#--------------------------------------------------------------------------{0} {2}# compiled all relevant subroutine prototype test cases{0} {2}#{0} {2}#--------------------------------------------------------------------------{0} {2}# Kein-Hong Man Public Domain{0} {2}#--------------------------------------------------------------------------{0} {2}# 20151227 initial document{0} {2}#--------------------------------------------------------------------------{0} {2}#--------------------------------------------------------------------------{0} {2}# test cases for sub syntax scanner{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: simple and with added module notation{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# module syntax{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# multiple module syntax{0} {5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace{0} {5}sub{0} {11}fish{0} {10}::{0} {2}# embedded comment{0} {11}chips{0} {2}# embedded comment{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# incomplete or bad syntax examples{0} {5}sub{0} {11}fish{0} {10}::{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: prototype attributes{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace{0} {5}sub{0} {11}fish{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute example (must use 'prototype'){0} {5}sub{0} {11}fish{0} {10}:{0} {4}123{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# illegal attribute{0} {5}sub{0} {11}fish{10}:{5}prototype{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong 'prototype' position{0} {5}sub{0} {11}fish{10}:{11}salted{0} {11}salt{10}:{5}prototype{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute syntax{0} {5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra attributes{0} {5}sub{0} {11}fish{10}:{11}const{10}:{11}lvalue{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){10}:{11}lvalue{10}{{0} {4}123{10};{0} {10}}{0} {2}# might be legal too{0} {5}sub{0} {11}fish{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra whitespace{0} {5}sub{0} {11}fish{0} {10}:{11}const{0} {2}# embedded comment: a constant sub{0} {10}:{5}prototype{0} {2}# embedded comment{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: mixed{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{10}::{11}chips{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{11}chips{0} {10}::{11}sauce{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace{0} {5}sub{0} {11}fish{0} {2}# embedded comment{0} {10}::{11}chips{0} {10}::{11}sauce{0} {2}# embedded comment{0} {10}:{0} {11}const{0} {2}# embedded comment{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong syntax examples, parentheses must follow ':prototype'{0} {5}sub{0} {11}fish{0} {10}:{5}prototype{0} {10}:{11}const{0} {10}({12}$){0} {10}{{0} {4}123{10};}{0} {5}sub{0} {11}fish{0} {10}:{5}prototype{0} {10}::{11}chips{0} {10}({12}$){0} {10}{{0} {4}123{10};}{0} {2}#--------------------------------------------------------------------------{0} {2}# perl-test-5200delta.pl{0} {2}#--------------------------------------------------------------------------{0} {2}# More consistent prototype parsing{0} {2}#--------------------------------------------------------------------------{0} {2}# - whitespace now allowed, lexer now allows spaces or tabs{0} {5}sub{0} {11}foo{0} {40}( $ $ ){0} {10}{}{0} {5}sub{0} {11}foo{0} {40}( ){0} {10}{}{0} {2}# spaces/tabs empty{0} {5}sub{0} {11}foo{0} {40}( * ){0} {10}{}{0} {5}sub{0} {11}foo{0} {40}(@ ){0} {10}{}{0} {5}sub{0} {11}foo{0} {40}( %){0} {10}{}{0} {2}# untested, should probably be \[ but scanner does not check this for now{0} {5}sub{0} {11}foo{0} {40}( \ [ $ @ % & * ] ){0} {10}{}{0} {2}#--------------------------------------------------------------------------{0} {2}# perl-test-5140delta.pl{0} {2}#--------------------------------------------------------------------------{0} {2}# new + prototype character, acts like (\[@%]){0} {2}#--------------------------------------------------------------------------{0} {2}# these samples work as before{0} {5}sub{0} {11}mylink{0} {40}($$){0} {2}# mylink $old, $new{0} {5}sub{0} {11}myvec{0} {40}($$$){0} {2}# myvec $var, $offset, 1{0} {5}sub{0} {11}myindex{0} {40}($$;$){0} {2}# myindex &getstring, "substr"{0} {5}sub{0} {11}mysyswrite{0} {40}($$$;$){0} {2}# mysyswrite $buf, 0, length($buf) - $off, $off{0} {5}sub{0} {11}myreverse{0} {40}(@){0} {2}# myreverse $a, $b, $c{0} {5}sub{0} {11}myjoin{0} {40}($@){0} {2}# myjoin ":", $a, $b, $c{0} {5}sub{0} {11}myopen{0} {40}(*;$){0} {2}# myopen HANDLE, $name{0} {5}sub{0} {11}mypipe{0} {40}(**){0} {2}# mypipe READHANDLE, WRITEHANDLE{0} {5}sub{0} {11}mygrep{0} {40}(&@){0} {2}# mygrep { /foo/ } $a, $b, $c{0} {5}sub{0} {11}myrand{0} {40}(;$){0} {2}# myrand 42{0} {5}sub{0} {11}mytime{0} {40}(){0} {2}# mytime{0} {2}# backslash group notation to specify more than one allowed argument type{0} {5}sub{0} {11}myref{0} {40}(\[$@%&*]){0} {10}{}{0} {5}sub{0} {11}mysub{0} {40}(_){0} {2}# underscore can be optionally used FIXED 20151211{0} {2}# these uses the new '+' prototype character{0} {5}sub{0} {11}mypop{0} {40}(+){0} {2}# mypop @array{0} {5}sub{0} {11}mysplice{0} {40}(+$$@){0} {2}# mysplice @array, 0, 2, @pushme{0} {5}sub{0} {11}mykeys{0} {40}(+){0} {2}# mykeys %{$hashref}{0} {2}#--------------------------------------------------------------------------{0} {2}# perl-test-5200delta.pl{0} {2}#--------------------------------------------------------------------------{0} {2}# Experimental Subroutine signatures (mostly works){0} {2}#--------------------------------------------------------------------------{0} {2}# INCLUDED FOR COMPLETENESS ONLY{0} {2}# IMPORTANT NOTE the subroutine prototypes lexing implementation has{0} {2}# no effect on subroutine signature syntax highlighting{0} {2}# subroutine signatures mostly looks fine except for the @ and % slurpy{0} {2}# notation which are highlighted as operators (all other parameters are{0} {2}# highlighted as vars of some sort), a minor aesthetic issue{0} {5}use{0} {11}feature{0} {7}'signatures'{10};{0} {5}sub{0} {11}foo{0} {10}({12}$left{10},{0} {HTTP/1.1 200 OK Connection: keep-alive Connection: keep-alive Connection: keep-alive Content-Disposition: inline; filename="perl-test-sub-prototypes.pl.styled" Content-Disposition: inline; filename="perl-test-sub-prototypes.pl.styled" Content-Disposition: inline; filename="perl-test-sub-prototypes.pl.styled" Content-Length: 14138 Content-Length: 14138 Content-Length: 14138 Content-Security-Policy: default-src 'none' Content-Security-Policy: default-src 'none' Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8 Date: Tue, 06 Jan 2026 06:04:31 UTC ETag: "96d5788460a85c70ac359a05e917d7a77b8956c4" ETag: "96d5788460a85c70ac359a05e917d7a77b8956c4" ETag: "96d5788460a85c70ac359a05e917d7a77b8956c4" Expires: Fri, 04 Jan 2036 06:04:31 GMT Expires: Fri, 04 Jan 2036 06:04:31 GMT Expires: Fri, 04 Jan 2036 06:04:31 GMT Last-Modified: Tue, 06 Jan 2026 06:04:31 GMT Last-Modified: Tue, 06 Jan 2026 06:04:31 GMT Last-Modified: Tue, 06 Jan 2026 06:04:31 GMT Server: OpenBSD httpd Server: OpenBSD httpd Server: OpenBSD httpd X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff {2}# -*- coding: utf-8 -*-{0} {2}#--------------------------------------------------------------------------{0} {2}# perl-test-sub-prototypes.pl{0} {2}#--------------------------------------------------------------------------{0} {2}# compiled all relevant subroutine prototype test cases{0} {2}#{0} {2}#--------------------------------------------------------------------------{0} {2}# Kein-Hong Man Public Domain{0} {2}#--------------------------------------------------------------------------{0} {2}# 20151227 initial document{0} {2}#--------------------------------------------------------------------------{0} {2}#--------------------------------------------------------------------------{0} {2}# test cases for sub syntax scanner{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: simple and with added module notation{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# module syntax{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# multiple module syntax{0} {5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace{0} {5}sub{0} {11}fish{0} {10}::{0} {2}# embedded comment{0} {11}chips{0} {2}# embedded comment{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# incomplete or bad syntax examples{0} {5}sub{0} {11}fish{0} {10}::{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: prototype attributes{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace{0} {5}sub{0} {11}fish{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute example (must use 'prototype'){0} {5}sub{0} {11}fish{0} {10}:{0} {4}123{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# illegal attribute{0} {5}sub{0} {11}fish{10}:{5}prototype{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong 'prototype' position{0} {5}sub{0} {11}fish{10}:{11}salted{0} {11}salt{10}:{5}prototype{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute syntax{0} {5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra attributes{0} {5}sub{0} {11}fish{10}:{11}const{10}:{11}lvalue{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){10}:{11}lvalue{10}{{0} {4}123{10};{0} {10}}{0} {2}# might be legal too{0} {5}sub{0} {11}fish{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra whitespace{0} {5}sub{0} {11}fish{0} {10}:{11}const{0} {2}# embedded comment: a constant sub{0} {10}:{5}prototype{0} {2}# embedded comment{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}#--------------------------------------------------------------------------{0} {2}# sub syntax: mixed{0} {2}#--------------------------------------------------------------------------{0} {5}sub{0} {11}fish{10}::{11}chips{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{0} {10}::{11}chips{0} {10}::{11}sauce{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace{0} {5}sub{0} {11}fish{0} {2}# embedded comment{0} {10}::{11}chips{0} {10}::{11}sauce{0} {2}# embedded comment{0} {10}:{0} {11}const{0} {2}# embedded comment{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong syntax examples, parentheses must follow ':prototype'{0} {5}sub{0} {11}fish{0} {10