mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
compiler_vm: Remember last keyword when chaining together "and" statements in editor
This allows the more natural "replace 'a' with 'b' and 'c' with 'd'" syntax rather than the previous syntax of "replace 'a' with 'b' and replace 'c' with 'd'"
This commit is contained in:
parent
474f7ed168
commit
1ec463f021
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 535,
|
||||
BUILD_DATE => "2014-03-24",
|
||||
BUILD_REVISION => 536,
|
||||
BUILD_DATE => "2014-04-01",
|
||||
};
|
||||
|
||||
1;
|
||||
|
@ -253,12 +253,16 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
|
||||
my @replacements;
|
||||
my $prevchange = $last_code[0];
|
||||
my $got_changes = 0;
|
||||
my $last_keyword;
|
||||
|
||||
while(1) {
|
||||
$got_sub = 0;
|
||||
#$got_changes = 0;
|
||||
|
||||
$subcode =~ s/^\s*and\s+'/and $last_keyword '/ if defined $last_keyword;
|
||||
|
||||
if($subcode =~ m/^\s*(and)?\s*remove \s*([^']+)?\s*'/) {
|
||||
$last_keyword = 'remove';
|
||||
my $modifier = 'first';
|
||||
|
||||
$subcode =~ s/^\s*(and)?\s*//;
|
||||
@ -283,6 +287,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
|
||||
}
|
||||
|
||||
if($subcode =~ s/^\s*(and)?\s*prepend '//) {
|
||||
$last_keyword = 'prepend';
|
||||
$subcode = "'$subcode";
|
||||
|
||||
my ($e, $r) = extract_delimited($subcode, "'");
|
||||
@ -314,6 +319,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
|
||||
}
|
||||
|
||||
if($subcode =~ s/^\s*(and)?\s*append '//) {
|
||||
$last_keyword = 'append';
|
||||
$subcode = "'$subcode";
|
||||
|
||||
my ($e, $r) = extract_delimited($subcode, "'");
|
||||
@ -345,6 +351,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
|
||||
}
|
||||
|
||||
if($subcode =~ m/^\s*(and)?\s*replace\s*([^']+)?\s*'.*'\s*with\s*'.*?'/i) {
|
||||
$last_keyword = 'replace';
|
||||
$got_sub = 1;
|
||||
my $modifier = 'first';
|
||||
|
||||
@ -406,6 +413,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
|
||||
}
|
||||
|
||||
if($subcode =~ m/^\s*(and)?\s*s\/.*\//) {
|
||||
$last_keyword = undef;
|
||||
$got_sub = 1;
|
||||
$subcode =~ s/^\s*(and)?\s*s//;
|
||||
|
||||
@ -970,7 +978,8 @@ if($output =~ m/^\s*$/) {
|
||||
print FILE "$output\n";
|
||||
}
|
||||
|
||||
$output =~ s/In file included from prog.c:\d+:\d+:\s*//msg;
|
||||
$output =~ s/In file included from .*?:\d+:\d+.\s*from prog.c:\d+:\s*//msg;
|
||||
$output =~ s/In file included from .*?:\d+:\d+.\s*//msg;
|
||||
$output =~ s/prog: prog.c:\d+: [^:]+: Assertion/Assertion/g;
|
||||
$output =~ s,/usr/include/[^:]+:\d+:\d+:\s+,,g;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user