mistralys/jtokenizer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mistralys/jtokenizer

最新稳定版本:1.0.1

Composer 安装命令:

composer require mistralys/jtokenizer

包简介

Modernized, composer compatible version of Tim Whitlock's JTokenizer PHP Javascript parser and tokenizer library.

README 文档

README

Archived project: Please use Peast instead, as this library is no longer actively maintained.

Modernized, composer compatible version of Tim Whitlock's JTokenizer PHP Javascript parser and tokenizer library.

NOTE: This package is a good choice for very basic access to JavaScript tokens. A more modern and complete solution is Peast.

Overview

The JavaScript tokenizer is designed to mimic the PHP tokenizer. Possible uses for the tokenizer include code highlighting and simple manipulation of JavaScript source code.

Quickstart

Tokenize a JavaScript file:

$tokens = \JTokenizer\JTokenizer::getFileTokens('javascript.js');

Tokenize a JavaScript string:

$jsCode = '(JavaScript source code)';
$tokens = \JTokenizer\JTokenizer::getTokens($jsCode);

Both methods behave like the PHP token_get_all function, with the addition of a column number as well as a line number.

Token information

The getTokens() method returns an indexed array with a list of token arrays. Each token array is an indexed array with the following information:

  1. Token identifier
  2. Matched literal
  3. Line number
  4. Column number

The token identifier can be either an Integer, or a string. To get the according token type name, use the getTokenName() method.

Source

Derived from Tim Whitlock's JTokenizer package, released back in 2009. As far as my research online showed, no one else published a modernized version of it that can run without deprecated messages on PHP7.4+.

The original sources are here:

https://timwhitlock.info/blog/2009/11/jparser-and-jtokenizer-released/

统计信息

  • 总下载量: 7.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固