How to use the php-parser.create function in php-parser

To help you get started, we’ve selected a few php-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github recca0120 / vscode-phpunit / server / src / Parser.ts View on Github external
/// 
import Engine from 'php-parser';
import files from './Filesystem';
import URI from 'vscode-uri';
import { PathLike } from 'fs';
import { TestNode, TestOptions, TestSuiteNode } from './TestNode';
import {
    TextDocument,
    WorkspaceFolder as _WorkspaceFolder,
} from 'vscode-languageserver';

const engine = Engine.create({
    ast: {
        withPositions: true,
        withSource: true,
    },
    parser: {
        php7: true,
        debug: false,
        extractDoc: true,
        suppressErrors: true,
    },
    lexer: {
        all_tokens: true,
        comment_tokens: true,
        mode_eval: true,
        asp_tags: true,
        short_tags: true,
github DaGhostman / vscode-tree-view / src / providers / php.ts View on Github external
public refresh(document: vscode.TextDocument): void {
        this.config = vscode.workspace.getConfiguration("treeview.php");
        this.tree = {} as token.ITokenTree;

        if (document !== undefined) {
            this.tree = this.walk(
                require("php-parser").create({ ast: { withPositions: true } })
                    .parseCode(document.getText()).children,
            );
        }
    }
github HvyIndustries / crane / server / src / hvy / treeBuilder.ts View on Github external
return new Promise((resolve, reject) =>
        {
            var parserInst = phpParser.create({
                parser: {
                    locations: true,
                    docBlocks: true,
                    suppressErrors: true
                }
            });

            var ast = parserInst.parseCode(text);
            parserInst = null;

            this.BuildObjectTree(ast, filePath).then((tree) => {
                var symbolCache = this.BuildSymbolCache(tree, filePath).then(symbolCache => {
                    var returnObj = {
                        tree: tree,
                        symbolCache: symbolCache
                    };

php-parser

Parse PHP code from JS and returns its AST

BSD-3-Clause
Latest version published 11 months ago

Package Health Score

75 / 100
Full package analysis