Games-Axmud

 view release on metacpan or  search on metacpan

lib/Language/Axbasic/Statement.pm  view on Meta::CPAN


                        # (If ->column is not 0, the previous PRINT expression must have used a ','
                        #   or ';' character. When writing to the task window, 'echo' means 'no
                        #   newline character after this text')
                        if ($self->scriptObj->column) {
                            $taskObj->insertPrint($string, 'echo');
                        } else {
                            $taskObj->insertPrint($string);
                        }

                    } else {

                        # (When writing to the 'main' window, 'echo' means 'no newline character
                        #   before this text')
                        $session->writeText($string, 'echo');
                    }

                    $self->scriptObj->set_column($self->scriptObj->column + length($string));

                } elsif ($endChar eq ';') {

                    # Display the string without a trailing newline character and adjust the column
                    #   accordingly
                    if ($self->scriptObj->forcedWinFlag) {

                        if ($self->scriptObj->column) {
                            $taskObj->insertPrint($string, 'echo');
                        } else {
                            $taskObj->insertPrint($string);
                        }

                    } else {

                        $session->writeText($string, 'echo');
                    }

                    $self->scriptObj->set_column($self->scriptObj->column + length($string));

                } else {

                    # Display the string with a trailing newline character
                    if ($self->scriptObj->forcedWinFlag) {

                        if ($self->scriptObj->column) {
                            $taskObj->insertPrint($string, 'echo');
                        } else {
                            $taskObj->insertPrint($string);
                        }

                    } else {

                        $session->writeText($string);
                    }

                    $self->scriptObj->set_column(0);
                }
            }
        }

        # Make sure the text is visible immediately
        $axmud::CLIENT->desktopObj->updateWidgets($self->_objClass . '->implement');

        # Implementation complete
        return 1;
    }
}

{ package Language::Axbasic::Statement::profile;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    @Language::Axbasic::Statement::profile::ISA = qw(
        Language::Axbasic
        Language::Axbasic::Statement
    );

    # PROFILE [ expression ]

    ##################
    # Methods

    sub parse {

        # Called by LA::Line->parse directly after a call to LA::Statement->new
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments or if there is an error
        #   1 otherwise

        my ($self, $check) = @_;

        # Local variables
        my $nameExp;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->parse', @_);
        }

        if (! $self->tokenGroupObj->testStatementEnd()) {

            # Convert the name string into an expression
            $nameExp = Language::Axbasic::Expression::Arithmetic->new(
                $self->scriptObj,
                $self->tokenGroupObj,
            );

            if (! defined $nameExp) {

                return $self->scriptObj->setError(
                    'missing_or_illegal_expression',
                    $self->_objClass . '->parse',
                );



( run in 0.582 second using v1.01-cache-2.11-cpan-f56aa216473 )