/sourcepawn-inc-parser

A parser written in PHP which is able to analyse sourcepawn's .inc files and comments (annotation syntax)

Primary LanguagePHP

This project is not actively maintained anymore, please fork this

About

A parser written in PHP which is able to analyse sourcepawn's .inc files and comments (annotation syntax)

Example

<?php
// This loads a very simple PHP class autoloader, doing the basics.
// You can use your own instead.
require_once "autoloader.php";

use Bcserv\SourcepawnIncParser\PawnParser;

function pawnParserCallback($pawnElement)
{
	// This dumps the whole object for demonstration.
	// You should call public getters defined in
	// src/Bcserv/SourcepawnIncParser/PawnElement/*.php
    var_dump($pawnElement);
}

$pawnParser = new PawnParser('pawnParserCallback');
$pawnParser->parseFile('/path/to/pawnfile.inc');

Requirements

Coding standards

This library follows the PHP standards psr-0 and psr-1.

Using in Symfony 2

Add this to the require section of your composer.json in the main folder of Symfony2:

"bcserv/sourcepawn-inc-parser": "1.0.x-dev"

You maybe also need to change "minimum-stability" to "dev" if it complains about this.

Then run php composer.phar update