Download the PHP package dbeurive/lexer without Composer

On this page you can find all versions of the php package dbeurive/lexer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lexer

Introduction

This repository contains the implementation of a basic lexer.

A lexer explodes a given string into a list of tokens.

Installation

From the command line:

composer require dbeurive\lexer

If you want to include this package to your project, then edit your file composer.json and add the following entry:

"require": {
    "dbeurive/lexer": "*"
}

Synopsis

Specifications

Description

The lexer is configured by a list of tokens specifications:

array(
    <token specification>,
    <token specification>,
    ...
)

Each token specification is an array that contains 2 or 3 elements.

<token specification> = array(<regexp>, <type>, [<transformer callback>])

WARNING

Make sure to double all characters "\" within the regular expressions that define the tokens. That is: '/\s/' becomes '/\\s/'.

The signature of the optional third element (<transformer callback>) must be:

mixed|null function(array $inMatches)

The array ($inMatches) passed to the function comes from the processing of the regular expression that describes the token.

See the description for the PHP function preg_match().

Very important note

Be aware that the order of declarations of the tokens is important.

The example 2 illustrates this point.

The result is:

Test1: AAAA AA

type A2 AA
type A2 AA
type A2 AA

Test2: AAAA AA

type A1 A
type A1 A
type A1 A
type A1 A
type A1 A
type A1 A

API

Constructor

Please see the section "specifications" for a detailed description of the parameter.

lex()

This method "parses" a given text and returns a list of detected tokens.

The returned array contains the list of detected tokens.

Each element of the returned array is an instance of the class \dbeurive\Lexer\Token.


All versions of lexer with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dbeurive/lexer contains the following files

Loading the files please wait ....