PHP_Beautifier
[ class tree: PHP_Beautifier ] [ index: PHP_Beautifier ] [ all elements ]

Class: PHP_Beautifier_Filter_IndentStyles

Source Location: /PHP_Beautifier-0.1.2/Beautifier/Filter/IndentStyles.filter.php

Class Overview

PHP_Beautifier_Filter
   |
   --PHP_Beautifier_Filter_IndentStyles

Filter Indent Styles: Indent the code in k&r, allman, gnu or whitesmiths


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2004-2005 Claudio Bustos

Methods


Inherited Variables

Inherited Methods

Class: PHP_Beautifier_Filter

PHP_Beautifier_Filter::addSettingDefinition()
Add a setting definition
PHP_Beautifier_Filter::getDescription()
PHP_Beautifier_Filter::getName()
return @string
PHP_Beautifier_Filter::getSetting()
Get a setting of the Filter
PHP_Beautifier_Filter::handleToken()
Function called from PHP_Beautifier::process() to process the tokens.
PHP_Beautifier_Filter::off()
Turn off the Filter Use inside the code to beautify Ex.
PHP_Beautifier_Filter::on()
Turn on the Filter Use inside the code to beautify Ex.
PHP_Beautifier_Filter::postProcess()
Called from PHP_Beautifier::process() at the end of processing
PHP_Beautifier_Filter::setSetting()
Set a value of a Setting

Class Details

[line 75]
Filter Indent Styles: Indent the code in k&r, allman, gnu or whitesmiths

Use 'style' setting to select the style. You can change the style inside the file, using the callbacks features. The following is a description taken from http://catb.org/~esr/jargon/html/I/indent-style.html

K&R style ['k&r'] Named after Kernighan & Ritchie, because the examples in K&R are formatted this way. Also called kernel style because the Unix kernel is written in it, and the "One True Brace Style" (abbrev. 1TBS) by its partisans. In C code, the body is typically indented by eight spaces (or one tab) per level, as shown here. Four spaces are occasionally seen in C, but in C++ and Java four tends to be the rule rather than the exception.


1 if (<cond>) {
2 <body>
3 }

Allman style ['allman' or 'bsd'] Named for Eric Allman, a Berkeley hacker who wrote a lot of the BSD utilities in it (it is sometimes called BSD style). Resembles normal indent style in Pascal and Algol. It is the only style other than K&R in widespread use among Java programmers. Basic indent per level shown here is eight spaces, but four (or sometimes three) spaces are generally preferred by C++ and Java programmers.


1 if (<cond>)
2 {
3 <body>
4 }

Whitesmiths style ['whitesmiths']? popularized by the examples that came with Whitesmiths C, an early commercial C compiler. Basic indent per level shown here is eight spaces, but four spaces are occasionally seen.


1 if (<cond>)
2 {
3 <body>
4 }

GNU style ['gnu'] Used throughout GNU EMACS and the Free Software Foundation code, and just about nowhere else. Indents are always four spaces per level, with { and } halfway between the outer and inner indent levels.


1 if (<cond>)
2 {
3 <body>
4 }



[ Top ]


Method Detail

t_close_brace_bsd   [line 123]

void t_close_brace_bsd( string $sTag)

Close braces in BSD style

Parameters:

string   $sTag     '}'

[ Top ]

t_close_brace_gnu   [line 167]

void t_close_brace_gnu( string $sTag)

Close braces in GNU style

Parameters:

string   $sTag     '}'

[ Top ]

t_close_brace_ws   [line 151]

void t_close_brace_ws( string $sTag)

Close braces in Whitesmiths style

Parameters:

string   $sTag     '}'

[ Top ]

t_else   [line 199]

void|PHP_Beautifier_Filter::BYPASS t_else( string $sTag)

Else for bds, gnu & ws

Parameters:

string   $sTag     else or elseif

[ Top ]

t_open_brace_bsd   [line 112]

void t_open_brace_bsd( string $sTag)

Open braces in BSD style

Parameters:

string   $sTag     '{'

[ Top ]

t_open_brace_gnu   [line 185]

void t_open_brace_gnu( string $sTag)

Open braces in GNU style

Parameters:

string   $sTag     '{'

[ Top ]

t_open_brace_ws   [line 139]

void t_open_brace_ws( string $sTag)

Open braces in Whitesmiths style

Parameters:

string   $sTag     '{'

[ Top ]


Documentation generated on Fri, 4 Feb 2005 01:30:17 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.