mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-03 08:32:42 +01:00
Remove need to pass nick as command-line parameter to expand/paren modules (use add_nick factoid metadata)
This commit is contained in:
parent
9b2c374bbb
commit
818ad29914
@ -13,8 +13,8 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 496,
|
BUILD_REVISION => 497,
|
||||||
BUILD_DATE => "2014-03-03",
|
BUILD_DATE => "2014-03-04",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -21,7 +21,6 @@ if($#ARGV < 1) {
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $nick = shift @ARGV;
|
|
||||||
my $code = join ' ', @ARGV;
|
my $code = join ' ', @ARGV;
|
||||||
my $lang = 'C89';
|
my $lang = 'C89';
|
||||||
my $args = "";
|
my $args = "";
|
||||||
@ -301,9 +300,9 @@ if(not $has_main) {
|
|||||||
$result =~ s/\s*}\s*$//;
|
$result =~ s/\s*}\s*$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $result;
|
$output = length $result ? $result : $nooutput;
|
||||||
|
|
||||||
print "$nick: $output\n";
|
print "$output\n";
|
||||||
|
|
||||||
sub execute {
|
sub execute {
|
||||||
my $timeout = shift @_;
|
my $timeout = shift @_;
|
||||||
|
@ -66,17 +66,17 @@ def parenthesize(source):
|
|||||||
try:
|
try:
|
||||||
ast = parser.parse(source, '<input>')
|
ast = parser.parse(source, '<input>')
|
||||||
except plyparser.ParseError as e:
|
except plyparser.ParseError as e:
|
||||||
print("{0}: Error: {1}".format(sys.argv[1], e.args[0]))
|
print("Error: " + e.args[0])
|
||||||
return
|
return
|
||||||
generator = CGenerator()
|
generator = CGenerator()
|
||||||
print("{0}: {1}".format(sys.argv[1], generator.visit(ast)))
|
print(generator.visit(ast))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 1:
|
||||||
parenthesize(' '.join(sys.argv[2:]).rstrip(';'))
|
parenthesize(' '.join(sys.argv[1:]).rstrip(';'))
|
||||||
elif len(sys.argv) == 2:
|
elif len(sys.argv) == 1:
|
||||||
print(sys.argv[1] + ': ' + "Usage: paren <expression>")
|
print("Usage: paren <expression>")
|
||||||
else:
|
else:
|
||||||
print('error')
|
print('error')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user