Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.220.88.120
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : AST.pm
use strict; use warnings;
package Inline::C::Parser::Pegex::AST;
use Pegex::Base;

extends 'Pegex::Tree';

has data => {};

sub initial {
    my ($self) = @_;
    my $data = {
        functions => [],
        function => {},
        done => {},
    };
    $self->data($data);
}

sub final {
    my ($self, $got) = @_;
    return $self->{data};
}

sub got_function_definition {
    my ($self, $ast) = @_;
    my ($rtype, $name, $args) = @$ast;
    my ($rname, $rstars) = @$rtype;
    my $data = $self->data;
    my $def = $data->{function}{$name} = {};
    push @{$data->{functions}}, $name;
    $def->{return_type} = $rname . ($rstars ? " $rstars" : '');
    $def->{arg_names} = [];
    $def->{arg_types} = [];
    for my $arg (@$args) {
        my ($type, $stars, $name) = @$arg;
        push @{$def->{arg_names}}, $name;
        push @{$def->{arg_types}}, $type . ($stars ? " $stars" : '');
    }
    $data->{done}{$name} = 1;
    return;
}


sub got_arg {
    my ($self, $ast) = @_;
    pop @$ast;
    return $ast;
}

1;
© 2025 GrazzMean