Coder Social home page Coder Social logo

p5-compiler-lexer's Introduction

Build Status Coverage Status

NAME

Compiler::Lexer - Lexical Analyzer for Perl5

SYNOPSIS

use Compiler::Lexer;
use Data::Dumper;

my $filename = $ARGV[0];
open my $fh, '<', $filename or die "Cannot open $filename: $!";
my $script = do { local $/; <$fh> };

my $lexer = Compiler::Lexer->new($filename);
my $tokens = $lexer->tokenize($script);
print Dumper $tokens;

my $modules = $lexer->get_used_modules($script);
print Dumper $modules;

METHODS

  • my $lexer = Compiler::Lexer->new($options);

    create new instance. You can create object from $options in hash reference.

    options list

    • filename
    • verbose : includes token of Pod, Comment and WhiteSpace
  • $lexer->tokenize($script);

    get token objects includes parameter of 'name' or 'type' or 'line' and so on. This method requires perl source code in string.

  • $lexer->set_library_path(['path1', 'path2' ...])

    set libraries path for reading recursively. Default paths are @INC.

  • $lexer->recursive_tokenize($script)

    get hash reference like { 'module_nameA' => [], 'module_nameB' => [] ... }. This method requires per source code in string.

  • $lexer->get_used_modules($script);

    get names of used module. This method requires perl source code in string.

AUTHOR

Masaaki Goshima (goccy) <goccy(at)cpan.org>

CONTRIBUTORS

tokuhirom: Tokuhiro Matsuno

LICENSE AND COPYRIGHT

Copyright (c) 2013, Masaaki Goshima (goccy). All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

p5-compiler-lexer's People

Contributors

goccy avatar briandfoy avatar moznion avatar f110 avatar dolmen avatar syohex avatar tokuhirom avatar

Watchers

Todd Rinaldo avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.