webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
HyperLanguage Class Reference
Inheritance diagram for HyperLanguage:
ApacheLanguage CodeLanguage CppLanguage CsharpLanguage CssLanguage DiffLanguage IniLanguage JavaScriptLanguage PhpLanguage PythonLanguage SyntaxLanguage VbLanguage XmlLanguage

Public Member Functions

 id ()
 

Static Public Member Functions

static nameFromExt ($ext)
 
static compile (HyperLanguage $lang)
 
static compileFromName ($lang)
 

Public Attributes

const NAME = 1
 
const VERSION = 2
 
const AUTHOR = 10
 
const WEBSITE = 5
 
const EMAIL = 6
 

Protected Member Functions

 setCaseInsensitive ($value)
 
 addStates (array $states)
 
 getState ($key)
 
 removeState ($key)
 
 addRules (array $rules)
 
 getRule ($key)
 
 removeRule ($key)
 
 addMappings (array $mappings)
 
 getMapping ($key)
 
 removeMapping ($key)
 
 setInfo (array $info)
 
 setExtensions (array $extensions)
 
 addPostprocessing ($rule, HyperLanguage $language)
 

Static Protected Member Functions

static exists ($lang)
 
static fromName ($lang)
 

Detailed Description

Abstract base class of all Hyperlight language definitions.

In order to define a new language definition, this class is inherited. The only function that needs to be overridden is the constructor. Helper functions from the base class can then be called to construct the grammar and store additional information. The name of the subclass must be of the schema {Lang}Language, where {Lang} is a short, unique name for the language starting with a capital letter and continuing in lower case. For example, PhpLanguage is a valid name. The language definition must reside in a file located at languages/{lang}.php. Here, {lang} is the all-lowercase spelling of the name, e.g. languages/php.php.

Member Function Documentation

◆ addMappings()

HyperLanguage::addMappings ( array  $mappings)
protected

◆ addPostprocessing()

HyperLanguage::addPostprocessing (   $rule,
HyperLanguage  $language 
)
protected

◆ addRules()

HyperLanguage::addRules ( array  $rules)
protected

◆ addStates()

HyperLanguage::addStates ( array  $states)
protected

◆ compile()

static HyperLanguage::compile ( HyperLanguage  $lang)
static

◆ compileFromName()

static HyperLanguage::compileFromName (   $lang)
static

◆ exists()

static HyperLanguage::exists (   $lang)
staticprotected

◆ fromName()

static HyperLanguage::fromName (   $lang)
staticprotected

◆ getMapping()

HyperLanguage::getMapping (   $key)
protected

◆ getRule()

HyperLanguage::getRule (   $key)
protected

◆ getState()

HyperLanguage::getState (   $key)
protected

◆ id()

HyperLanguage::id ( )

◆ nameFromExt()

static HyperLanguage::nameFromExt (   $ext)
static

Retrieves a language definition name based on a file extension.

Uses the contents of the languages/filetypes file to guess the language definition name from a file name extension. This file has to be generated using the collect-filetypes.php script every time the language definitions have been changed.

Parameters
string$extthe file name extension.
Returns
string The language definition name or NULL.

◆ removeMapping()

HyperLanguage::removeMapping (   $key)
protected

◆ removeRule()

HyperLanguage::removeRule (   $key)
protected

◆ removeState()

HyperLanguage::removeState (   $key)
protected

◆ setCaseInsensitive()

HyperLanguage::setCaseInsensitive (   $value)
protected

◆ setExtensions()

HyperLanguage::setExtensions ( array  $extensions)
protected

◆ setInfo()

HyperLanguage::setInfo ( array  $info)
protected

Member Data Documentation

◆ AUTHOR

const HyperLanguage::AUTHOR = 10

◆ EMAIL

const HyperLanguage::EMAIL = 6

◆ NAME

const HyperLanguage::NAME = 1

Indices for information.

◆ VERSION

const HyperLanguage::VERSION = 2

◆ WEBSITE

const HyperLanguage::WEBSITE = 5

The documentation for this class was generated from the following file: