Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ParserAbstract.php

function ParserAbstract::__construct

Same name in this branch
  1. 11.1.x vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php \PhpParser\ParserAbstract::__construct()

Class constructor

Parameters

string $source Source code:

Features $features Parser features:

array $options Parsing options:

File

vendor/mck89/peast/lib/Peast/Syntax/ParserAbstract.php, line 77

Class

ParserAbstract
Base class for parsers.

Namespace

Peast\Syntax

Code

public function __construct($source, Features $features, $options = array()) {
    $this->features = $features;
    $this->sourceType = isset($options["sourceType"]) ? $options["sourceType"] : \Peast\Peast::SOURCE_TYPE_SCRIPT;
    
    //Create the scanner
    $this->scanner = new Scanner($source, $features, $options);
    
    //Enable module scanning if required
    if ($this->sourceType === \Peast\Peast::SOURCE_TYPE_MODULE) {
        $this->scanner
            ->enableModuleMode();
    }
    
    //Enable comments scanning
    $this->comments = isset($options["comments"]) && $options["comments"];
    if ($this->comments) {
        $this->scanner
            ->enableComments();
        
        //Create the comments registry
        new CommentsRegistry($this);
    }
    // Enable jsx syntax if required
    $this->jsx = isset($options["jsx"]) && $options["jsx"];
    $this->initContext();
    $this->postInit();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal