⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 re2pl.bat

📁 这是一个DFA简化和生成LL(1)分析表的程序,自动生成表格及图形
💻 BAT
字号:
@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!perl
#line 15
#: re2pl.pl
#: Compile regex to perl lexing code
#: Copyright (c) 2006 Agent Zhang
#: 2006-05-19 2006-05-19

use strict;
use warnings;

use Getopt::Std;
use re::DFA::Perl;

my %opts;
getopts('hn:', \%opts);

if ($opts{h}) {
    Usage(0);
}

if (! @ARGV) {
    Usage(1);
}

sub Usage {
    my $code = shift;
    my $msg = "Usage: re2pl [-h] [-n <sub-name>] <regex>\n";
    if ($code == 0) {
        print $msg;
        exit(0);
    } else {
        warn $msg;
        exit($code);
    }
}

my $subname = $opts{n};
my $regex = shift;
my $code = re::DFA::Perl->as_code($regex, $subname);
if (defined $code) {
    print $code;
} else {
    exit(1);
}

__END__
:endofperl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -