mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 20:09:43 +01:00
Update Plang (progress on static type/semantic checking)
This commit is contained in:
parent
a6b67299ee
commit
43fdd4896e
2
Plang
2
Plang
@ -1 +1 @@
|
||||
Subproject commit 6fb7dd9fbad69819c684f6a60f88b62ca867506b
|
||||
Subproject commit ffb4ccf3706f8d6a3fbccd68e39bc9674ba98c7a
|
@ -38,29 +38,29 @@ sub initialize {
|
||||
$self->{plang} = Plang::Interpreter->new(embedded => 1, debug => $debug);
|
||||
|
||||
# register some PBot-specific built-in functions
|
||||
$self->{plang}->{interpreter}->add_builtin_function('factset',
|
||||
$self->{plang}->add_builtin_function('factset',
|
||||
# parameters are [['param1 name', default arg], ['param2 name', default arg], ...]
|
||||
[['String', 'channel', undef], ['String', 'keyword', undef], ['String', 'text', undef]],
|
||||
'String', # return type
|
||||
sub { $self->plang_builtin_factset(@_) });
|
||||
|
||||
$self->{plang}->{interpreter}->add_builtin_function('factget',
|
||||
$self->{plang}->add_builtin_function('factget',
|
||||
[['String', 'channel', undef], ['String', 'keyword', undef], ['String', 'meta', ['STRING', 'action']]],
|
||||
'String',
|
||||
sub { $self->plang_builtin_factget(@_) });
|
||||
|
||||
$self->{plang}->{interpreter}->add_builtin_function('factappend',
|
||||
$self->{plang}->add_builtin_function('factappend',
|
||||
[['String', 'channel', undef], ['String', 'keyword', undef], ['String', 'text', undef]],
|
||||
'String',
|
||||
sub { $self->plang_builtin_factappend(@_) });
|
||||
|
||||
$self->{plang}->{interpreter}->add_builtin_function('userget',
|
||||
$self->{plang}->add_builtin_function('userget',
|
||||
[['String', 'name', undef]],
|
||||
'Map',
|
||||
sub { $self->plang_builtin_userget(@_) });
|
||||
|
||||
# override the built-in `print` function to send to our output buffer instead
|
||||
$self->{plang}->{interpreter}->add_builtin_function('print',
|
||||
$self->{plang}->add_builtin_function('print',
|
||||
[['Any', 'expr', undef], ['String', 'end', ['STRING', "\n"]]],
|
||||
'Null',
|
||||
sub { $self->plang_builtin_print(@_) });
|
||||
|
Loading…
Reference in New Issue
Block a user